diff options
author | George Rimar <grimar@accesssoftek.com> | 2017-03-16 12:58:11 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2017-03-16 12:58:11 +0000 |
commit | 4670bb00b5660b3832b37a6d89cf9ddfc75a5430 (patch) | |
tree | 5c2b861672319cb6180968ba7bb109aae93b847f | |
parent | f00c18384730ef4bc36bfb3a4f5946f3e5c210d6 (diff) | |
download | bcm5719-llvm-4670bb00b5660b3832b37a6d89cf9ddfc75a5430.tar.gz bcm5719-llvm-4670bb00b5660b3832b37a6d89cf9ddfc75a5430.zip |
[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
-rw-r--r-- | lld/ELF/Relocations.cpp | 6 | ||||
-rw-r--r-- | lld/ELF/Symbols.cpp | 18 | ||||
-rw-r--r-- | lld/ELF/Symbols.h | 4 | ||||
-rw-r--r-- | 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 325da9cc660..d8863e56c15 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -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; diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index a0cff7ee16c..081cc582952 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -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; diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index 4f48011d231..568fe08cfd1 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -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; diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 12ecad92920..7c1c203d0e6 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -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; |