summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/InputSection.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 94e81593e02..52f58dec4f1 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -670,6 +670,8 @@ static uint64_t getRelocTargetVA(uint32_t Type, int64_t A, uint64_t P,
// function as a performance optimization.
template <class ELFT, class RelTy>
void InputSection::relocateNonAlloc(uint8_t *Buf, ArrayRef<RelTy> Rels) {
+ const unsigned Bits = sizeof(typename ELFT::uint) * 8;
+
for (const RelTy &Rel : Rels) {
uint32_t Type = Rel.getType(Config->IsMips64EL);
uint64_t Offset = getOffset(Rel.r_offset);
@@ -687,12 +689,10 @@ void InputSection::relocateNonAlloc(uint8_t *Buf, ArrayRef<RelTy> Rels) {
return;
}
- uint64_t AddrLoc = getParent()->Addr + Offset;
- uint64_t SymVA = 0;
- if (!Sym.isTls() || Out::TlsPhdr)
- SymVA = SignExtend64<sizeof(typename ELFT::uint) * 8>(
- getRelocTargetVA(Type, Addend, AddrLoc, Sym, R_ABS));
- Target->relocateOne(BufLoc, Type, SymVA);
+ if (Sym.isTls() && !Out::TlsPhdr)
+ Target->relocateOne(BufLoc, Type, 0);
+ else
+ Target->relocateOne(BufLoc, Type, SignExtend64<Bits>(Sym.getVA(Addend)));
}
}
OpenPOWER on IntegriCloud