[lld] r298828 - Simplify. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 26 20:41:00 PDT 2017
Author: ruiu
Date: Sun Mar 26 22:41:00 2017
New Revision: 298828
URL: http://llvm.org/viewvc/llvm-project?rev=298828&view=rev
Log:
Simplify. NFC.
This patch calls getAddend on a relocation only when the relocation is RELA.
That doesn't really improve runtime performance but should improve
readability as the code now matches the function description.
Modified:
lld/trunk/ELF/Relocations.cpp
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=298828&r1=298827&r2=298828&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Sun Mar 26 22:41:00 2017
@@ -554,11 +554,11 @@ static RelExpr adjustExpr(SymbolBody &Bo
// input section.
template <class ELFT, class RelTy>
static int64_t computeAddend(const RelTy &Rel, const uint8_t *Buf) {
- int64_t A = getAddend<ELFT>(Rel);
uint32_t Type = Rel.getType(Config->IsMips64EL);
+ int64_t A = RelTy::IsRela
+ ? getAddend<ELFT>(Rel)
+ : Target->getImplicitAddend(Buf + Rel.r_offset, Type);
- if (!RelTy::IsRela)
- A += Target->getImplicitAddend(Buf + Rel.r_offset, Type);
if (Config->EMachine == EM_PPC64 && Config->Pic && Type == R_PPC64_TOC)
A += getPPC64TocBase();
return A;
More information about the llvm-commits
mailing list