[lld] r330306 - Don't call getOffset twice. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 18 19:24:28 PDT 2018
Author: rafael
Date: Wed Apr 18 19:24:28 2018
New Revision: 330306
URL: http://llvm.org/viewvc/llvm-project?rev=330306&view=rev
Log:
Don't call getOffset twice. NFC.
Just a bit faster.
Modified:
lld/trunk/ELF/InputSection.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=330306&r1=330305&r2=330306&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Apr 18 19:24:28 2018
@@ -710,10 +710,11 @@ void InputSectionBase::relocateAlloc(uin
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);
More information about the llvm-commits
mailing list