From 4afe42e5c4dab65e95b38992dce02286decd4e52 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Fri, 17 Mar 2017 14:12:51 +0000 Subject: [PATCH] [ELF] - Detemplate SymbolBody::getGotOffset(). NFC. llvm-svn: 298091 --- lld/ELF/InputSection.cpp | 4 ++-- lld/ELF/Relocations.cpp | 9 ++++----- lld/ELF/Symbols.cpp | 9 ++------- lld/ELF/Symbols.h | 2 +- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index b1d10e70542e..4b9bd3dcfaae 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -356,7 +356,7 @@ getRelocTargetVA(uint32_t Type, int64_t A, typename ELFT::uint P, return Body.getVA(A) - In::Got->getVA() - In::Got->getSize(); case R_RELAX_TLS_GD_TO_IE_END: case R_GOT_FROM_END: - return Body.getGotOffset() + A - In::Got->getSize(); + return Body.getGotOffset() + A - In::Got->getSize(); case R_RELAX_TLS_GD_TO_IE_ABS: case R_GOT: return Body.getGotVA() + A; @@ -392,7 +392,7 @@ getRelocTargetVA(uint32_t Type, int64_t A, typename ELFT::uint P, case R_RELAX_GOT_PC_NOPIC: return Body.getVA(A); case R_GOT_OFF: - return Body.getGotOffset() + A; + return Body.getGotOffset() + A; case R_MIPS_GOT_LOCAL_PAGE: // If relocation against MIPS local symbol requires GOT entry, this entry // should be initialized by 'page address'. This address is high 16-bits diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index ef8ba550d4cc..fc9ee6149fa1 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -218,8 +218,7 @@ handleTlsRelocation(uint32_t Type, SymbolBody &Body, InputSectionBase &C, if (!Body.isInGot()) { In::Got->addEntry(Body); In::RelaDyn->addReloc({Target->TlsGotRel, In::Got, - Body.getGotOffset(), false, &Body, - 0}); + Body.getGotOffset(), false, &Body, 0}); } return Target->TlsGdRelaxSkip; } @@ -815,8 +814,8 @@ static void scanRelocs(InputSectionBase &C, ArrayRef Rels) { // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf In::MipsGot->addEntry(Body, Addend, Expr); if (Body.isTls() && Body.isPreemptible()) - AddDyn({Target->TlsGotRel, In::MipsGot, - Body.getGotOffset(), false, &Body, 0}); + AddDyn({Target->TlsGotRel, In::MipsGot, Body.getGotOffset(), + false, &Body, 0}); continue; } @@ -824,7 +823,7 @@ static void scanRelocs(InputSectionBase &C, ArrayRef Rels) { continue; In::Got->addEntry(Body); - uintX_t Off = Body.getGotOffset(); + uintX_t Off = Body.getGotOffset(); uint32_t DynType; RelExpr GotRE = R_ABS; if (Body.isTls()) { diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index 746263440900..ee0db4340359 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -163,10 +163,10 @@ uint64_t SymbolBody::getVA(int64_t Addend) const { } template typename ELFT::uint SymbolBody::getGotVA() const { - return In::Got->getVA() + getGotOffset(); + return In::Got->getVA() + getGotOffset(); } -template typename ELFT::uint SymbolBody::getGotOffset() const { +uint64_t SymbolBody::getGotOffset() const { return GotIndex * Target->GotEntrySize; } @@ -380,11 +380,6 @@ template uint32_t SymbolBody::template getGotVA() const; template uint64_t SymbolBody::template getGotVA() const; template uint64_t SymbolBody::template getGotVA() const; -template uint32_t SymbolBody::template getGotOffset() const; -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 getSize() const; template uint32_t SymbolBody::template getSize() const; template uint64_t SymbolBody::template getSize() const; diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index ae4cfae35476..88e83f973468 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -77,7 +77,7 @@ public: uint64_t getVA(int64_t Addend = 0) const; - template typename ELFT::uint getGotOffset() const; + uint64_t getGotOffset() const; template typename ELFT::uint getGotVA() const; uint64_t getGotPltOffset() const; uint64_t getGotPltVA() const;