Use getSize to find the size of a section. NFC.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 31 Aug 2016 23:01:13 +0000 (23:01 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 31 Aug 2016 23:01:13 +0000 (23:01 +0000)
llvm-svn: 280305

lld/ELF/InputSection.cpp
lld/ELF/OutputSections.h

index 774d3f0..f349141 100644 (file)
@@ -190,14 +190,11 @@ template <class ELFT>
 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<ELFT>::Got->getTlsIndexOff() + A -
-           Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
+    return Out<ELFT>::Got->getTlsIndexOff() + A - Out<ELFT>::Got->getSize();
   case R_TLSLD_PC:
     return Out<ELFT>::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<ELFT>::Got->getGlobalDynOffset(Body) + A -
-           Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
+           Out<ELFT>::Got->getSize();
   case R_TLSGD_PC:
     return Out<ELFT>::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<ELFT>(A) - Out<ELFT>::Got->getVA();
   case R_RELAX_TLS_GD_TO_IE_END:
   case R_GOT_FROM_END:
-    return Body.getGotOffset<ELFT>() + A -
-           Out<ELFT>::Got->getNumEntries() * sizeof(uintX_t);
+    return Body.getGotOffset<ELFT>() + A - Out<ELFT>::Got->getSize();
   case R_RELAX_TLS_GD_TO_IE_ABS:
   case R_GOT:
     return Body.getGotVA<ELFT>() + A;
index b350bef..2619e98 100644 (file)
@@ -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; }