diff options
| author | Rui Ueyama <ruiu@google.com> | 2017-10-10 04:45:48 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2017-10-10 04:45:48 +0000 |
| commit | ce135ff6f388ac0239025bedc0f2729908c19b49 (patch) | |
| tree | 7a561c38aee521d21dec23f5547ffabcde9ec9a6 | |
| parent | 6b7f1969097dba8d01fff83c5163656f258d8865 (diff) | |
| download | bcm5719-llvm-ce135ff6f388ac0239025bedc0f2729908c19b49.tar.gz bcm5719-llvm-ce135ff6f388ac0239025bedc0f2729908c19b49.zip | |
Simplify.
llvm-svn: 315270
| -rw-r--r-- | lld/ELF/InputSection.cpp | 12 |
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))); } } |

