Use getSize to find the size of a section. NFC.

llvm-svn: 280305
This commit is contained in:
Rafael Espindola 2016-08-31 23:01:13 +00:00
parent 34151b3000
commit 7f4f9cd546
2 changed files with 3 additions and 8 deletions

View 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;

View 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; }