diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2018-04-19 02:24:28 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2018-04-19 02:24:28 +0000 |
commit | 86286a6d526117c4e23bace99a10236b9bd38e79 (patch) | |
tree | e2c926db04014f11b34c9ebc0db6672fe044866d /lld/ELF/InputSection.cpp | |
parent | 62018da90b6430a8b173cd301d09505611d1698f (diff) |
Don't call getOffset twice. NFC.
Just a bit faster.
Diffstat (limited to 'lld/ELF/InputSection.cpp')
-rw-r--r-- | lld/ELF/InputSection.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 5fa1a01d277..1eb7737bb20 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -710,10 +710,11 @@ void InputSectionBase::relocateAlloc(uint8_t *Buf, uint8_t *BufEnd) { const unsigned Bits = Config->Wordsize * 8; for (const Relocation &Rel : Relocations) { - uint8_t *BufLoc = Buf + getOffset(Rel.Offset); + uint64_t Offset = getOffset(Rel.Offset); + uint8_t *BufLoc = Buf + Offset; RelType Type = Rel.Type; - uint64_t AddrLoc = getVA(Rel.Offset); + uint64_t AddrLoc = getOutputSection()->Addr + Offset; RelExpr Expr = Rel.Expr; uint64_t TargetVA = SignExtend64( getRelocTargetVA(Type, Rel.Addend, AddrLoc, *Rel.Sym, Expr), Bits); |