[lld] r263226 - [ELF] - Evaluate addend earlier and use it instead getAddend() calls. NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 04:53:18 PST 2016


Author: grimar
Date: Fri Mar 11 06:53:17 2016
New Revision: 263226

URL: http://llvm.org/viewvc/llvm-project?rev=263226&view=rev
Log:
[ELF] - Evaluate addend earlier and use it instead getAddend() calls. NFC.

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=263226&r1=263225&r2=263226&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Mar 11 06:53:17 2016
@@ -182,6 +182,7 @@ void InputSectionBase<ELFT>::relocate(ui
     uint32_t SymIndex = RI.getSymbol(Config->Mips64EL);
     uint32_t Type = RI.getType(Config->Mips64EL);
     uintX_t Offset = getOffset(RI.r_offset);
+    uintX_t A = getAddend<ELFT>(RI);
     if (Offset == (uintX_t)-1)
       continue;
 
@@ -192,8 +193,7 @@ void InputSectionBase<ELFT>::relocate(ui
     if (Target->pointsToLocalDynamicGotEntry(Type) &&
         !Target->canRelaxTls(Type, nullptr)) {
       Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
-                          Out<ELFT>::Got->getTlsIndexVA() +
-                              getAddend<ELFT>(RI));
+                          Out<ELFT>::Got->getTlsIndexVA() + A);
       continue;
     }
 
@@ -214,8 +214,6 @@ void InputSectionBase<ELFT>::relocate(ui
       continue;
     }
 
-    uintX_t A = getAddend<ELFT>(RI);
-
     // PPC64 has a special relocation representing the TOC base pointer
     // that does not have a corresponding symbol.
     if (Config->EMachine == EM_PPC64 && RI.getType(false) == R_PPC64_TOC) {
@@ -258,8 +256,7 @@ void InputSectionBase<ELFT>::relocate(ui
     if (Target->isTlsGlobalDynamicRel(Type) &&
         !Target->canRelaxTls(Type, &Body)) {
       Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc,
-                          Out<ELFT>::Got->getGlobalDynAddr(Body) +
-                              getAddend<ELFT>(RI));
+                          Out<ELFT>::Got->getGlobalDynAddr(Body) + A);
       continue;
     }
 




More information about the llvm-commits mailing list