[lld] r298575 - Remove unnecessary local variable.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 20:11:03 PDT 2017


Author: ruiu
Date: Wed Mar 22 22:11:03 2017
New Revision: 298575

URL: http://llvm.org/viewvc/llvm-project?rev=298575&view=rev
Log:
Remove unnecessary local variable.

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=298575&r1=298574&r2=298575&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Mar 22 22:11:03 2017
@@ -95,8 +95,7 @@ static unsigned
 handleNoRelaxTlsRelocation(GOT *Got, uint32_t Type, SymbolBody &Body,
                            InputSectionBase &C, typename ELFT::uint Offset,
                            int64_t Addend, RelExpr Expr) {
-  typedef typename ELFT::uint uintX_t;
-  auto addModuleReloc = [](SymbolBody &Body, GOT *Got, uintX_t Off, bool LD) {
+  auto addModuleReloc = [&](uint64_t Off, bool LD) {
     // The Dynamic TLS Module Index Relocation can be statically resolved to 1
     // if we know that we are linking an executable. For ARM we resolve the
     // relocation when writing the Got. MIPS has a custom Got implementation
@@ -110,25 +109,27 @@ handleNoRelaxTlsRelocation(GOT *Got, uin
           {Target->TlsModuleIndexRel, Got, Off, false, Dest, 0});
     }
   };
+
   if (isRelExprOneOf<R_MIPS_TLSLD, R_TLSLD_PC>(Expr)) {
     if (Got->addTlsIndex() && (Config->Pic || Config->EMachine == EM_ARM))
-      addModuleReloc(Body, Got, Got->getTlsIndexOff(), true);
+      addModuleReloc(Got->getTlsIndexOff(), true);
     C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});
     return 1;
   }
+
   if (Target->isTlsGlobalDynamicRel(Type)) {
     if (Got->addDynTlsEntry(Body) &&
         (Body.isPreemptible() || Config->EMachine == EM_ARM)) {
-      uintX_t Off = Got->getGlobalDynOffset(Body);
-      addModuleReloc(Body, Got, Off, false);
+      uint64_t Off = Got->getGlobalDynOffset(Body);
+      addModuleReloc(Off, false);
       if (Body.isPreemptible())
         In<ELFT>::RelaDyn->addReloc({Target->TlsOffsetRel, Got,
-                                     Off + (uintX_t)sizeof(uintX_t), false,
-                                     &Body, 0});
+                                     Off + Config->Wordsize, false, &Body, 0});
     }
     C.Relocations.push_back({Expr, Type, Offset, Addend, &Body});
     return 1;
   }
+
   return 0;
 }
 




More information about the llvm-commits mailing list