From 4670bb00b5660b3832b37a6d89cf9ddfc75a5430 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Thu, 16 Mar 2017 12:58:11 +0000 Subject: [PATCH] [ELF] - Detemplate SymbolBody::getGotPltVA and SymbolBody::getGotPltOffset(). NFC. That opens road to detemplate PltSection, what allows then to detemplate all methods of SymbolBody. llvm-svn: 297950 --- lld/ELF/Relocations.cpp | 6 +++--- lld/ELF/Symbols.cpp | 18 ++++-------------- lld/ELF/Symbols.h | 4 ++-- lld/ELF/SyntheticSections.cpp | 2 +- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 325da9cc6604..d8863e56c15b 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -795,13 +795,13 @@ static void scanRelocs(InputSectionBase &C, ArrayRef Rels) { In::Iplt->addEntry(Body); In::IgotPlt->addEntry(Body); In::RelaIplt->addReloc({Target->IRelativeRel, In::IgotPlt, - Body.getGotPltOffset(), - !Preemptible, &Body, 0}); + Body.getGotPltOffset(), !Preemptible, + &Body, 0}); } else { In::Plt->addEntry(Body); In::GotPlt->addEntry(Body); In::RelaPlt->addReloc({Target->PltRel, In::GotPlt, - Body.getGotPltOffset(), !Preemptible, + Body.getGotPltOffset(), !Preemptible, &Body, 0}); } continue; diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index a0cff7ee16c1..081cc5829528 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -171,13 +171,13 @@ template typename ELFT::uint SymbolBody::getGotOffset() const { return GotIndex * Target->GotEntrySize; } -template typename ELFT::uint SymbolBody::getGotPltVA() const { +uint64_t SymbolBody::getGotPltVA() const { if (this->IsInIgot) - return In::IgotPlt->getVA() + getGotPltOffset(); - return In::GotPlt->getVA() + getGotPltOffset(); + return InX::IgotPlt->getVA() + getGotPltOffset(); + return InX::GotPlt->getVA() + getGotPltOffset(); } -template 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() const; template uint64_t SymbolBody::template getGotOffset() const; template uint64_t SymbolBody::template getGotOffset() const; -template uint32_t SymbolBody::template getGotPltVA() const; -template uint32_t SymbolBody::template getGotPltVA() const; -template uint64_t SymbolBody::template getGotPltVA() const; -template uint64_t SymbolBody::template getGotPltVA() const; - -template uint32_t SymbolBody::template getGotPltOffset() const; -template uint32_t SymbolBody::template getGotPltOffset() const; -template uint64_t SymbolBody::template getGotPltOffset() const; -template uint64_t SymbolBody::template getGotPltOffset() const; - template uint32_t SymbolBody::template getPltVA() const; template uint32_t SymbolBody::template getPltVA() const; template uint64_t SymbolBody::template getPltVA() const; diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index 4f48011d2311..568fe08cfd1c 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -79,8 +79,8 @@ public: template typename ELFT::uint getGotOffset() const; template typename ELFT::uint getGotVA() const; - template typename ELFT::uint getGotPltOffset() const; - template typename ELFT::uint getGotPltVA() const; + uint64_t getGotPltOffset() const; + uint64_t getGotPltVA() const; template typename ELFT::uint getPltVA() const; template typename ELFT::uint getSize() const; OutputSection *getOutputSection() const; diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 12ecad92920f..7c1c203d0e68 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -1659,7 +1659,7 @@ template void PltSection::writeTo(uint8_t *Buf) { for (auto &I : Entries) { const SymbolBody *B = I.first; unsigned RelOff = I.second + PltOff; - uint64_t Got = B->getGotPltVA(); + uint64_t Got = B->getGotPltVA(); uint64_t Plt = this->getVA() + Off; Target->writePlt(Buf + Off, Got, Plt, B->PltIndex, RelOff); Off += Target->PltEntrySize;