From 7f4f9cd5469cf2547d9cc89d07dae524107335f9 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 31 Aug 2016 23:01:13 +0000 Subject: [PATCH] Use getSize to find the size of a section. NFC. llvm-svn: 280305 --- lld/ELF/InputSection.cpp | 10 +++------- lld/ELF/OutputSections.h | 1 - 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 774d3f0..f349141 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -190,14 +190,11 @@ template static typename ELFT::uint getSymVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P, const SymbolBody &Body, RelExpr Expr) { - typedef typename ELFT::uint uintX_t; - switch (Expr) { case R_HINT: llvm_unreachable("cannot relocate hint relocs"); case R_TLSLD: - return Out::Got->getTlsIndexOff() + A - - Out::Got->getNumEntries() * sizeof(uintX_t); + return Out::Got->getTlsIndexOff() + A - Out::Got->getSize(); case R_TLSLD_PC: return Out::Got->getTlsIndexVA() + A - P; case R_THUNK_ABS: @@ -209,7 +206,7 @@ static typename ELFT::uint getSymVA(uint32_t Type, typename ELFT::uint A, return getPPC64TocBase() + A; case R_TLSGD: return Out::Got->getGlobalDynOffset(Body) + A - - Out::Got->getNumEntries() * sizeof(uintX_t); + Out::Got->getSize(); case R_TLSGD_PC: return Out::Got->getGlobalDynAddr(Body) + A - P; case R_TLSDESC: @@ -228,8 +225,7 @@ static typename ELFT::uint getSymVA(uint32_t Type, typename ELFT::uint A, return Body.getVA(A) - Out::Got->getVA(); case R_RELAX_TLS_GD_TO_IE_END: case R_GOT_FROM_END: - return Body.getGotOffset() + A - - Out::Got->getNumEntries() * sizeof(uintX_t); + return Body.getGotOffset() + A - Out::Got->getSize(); case R_RELAX_TLS_GD_TO_IE_ABS: case R_GOT: return Body.getGotVA() + A; diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index b350bef..2619e98 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -135,7 +135,6 @@ public: uintX_t getMipsGotOffset(const SymbolBody &B, uintX_t Addend) const; uintX_t getGlobalDynAddr(const SymbolBody &B) const; uintX_t getGlobalDynOffset(const SymbolBody &B) const; - uintX_t getNumEntries() const { return Entries.size(); } typename Base::Kind getKind() const override { return Base::Got; } static bool classof(const Base *B) { return B->getKind() == Base::Got; } -- 2.7.4