[lld] r298576 - Simplify. No functionality change intended.

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


Author: ruiu
Date: Wed Mar 22 22:44:08 2017
New Revision: 298576

URL: http://llvm.org/viewvc/llvm-project?rev=298576&view=rev
Log:
Simplify. No functionality change intended.

I honestly do not understand this part of code as it is too tangled.
What I'm trying now is to carefully disentangle it by transforming
code without changing meaining to see if I can improve overall
readability.

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=298576&r1=298575&r2=298576&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Mar 22 22:44:08 2017
@@ -138,14 +138,14 @@ template <class ELFT>
 static unsigned
 handleTlsRelocation(uint32_t Type, SymbolBody &Body, InputSectionBase &C,
                     typename ELFT::uint Offset, int64_t Addend, RelExpr Expr) {
+  typedef typename ELFT::uint uintX_t;
+
   if (!(C.Flags & SHF_ALLOC))
     return 0;
 
   if (!Body.isTls())
     return 0;
 
-  typedef typename ELFT::uint uintX_t;
-
   if (Config->EMachine == EM_ARM)
     return handleNoRelaxTlsRelocation<ELFT>(In<ELFT>::Got, Type, Body, C,
                                             Offset, Addend, Expr);
@@ -221,11 +221,11 @@ handleTlsRelocation(uint32_t Type, Symbo
         In<ELFT>::RelaDyn->addReloc({Target->TlsGotRel, In<ELFT>::Got,
                                      Body.getGotOffset(), false, &Body, 0});
       }
-      return Target->TlsGdRelaxSkip;
+    } else {
+      C.Relocations.push_back(
+          {Target->adjustRelaxExpr(Type, nullptr, R_RELAX_TLS_GD_TO_LE), Type,
+                Offset, Addend, &Body});
     }
-    C.Relocations.push_back(
-        {Target->adjustRelaxExpr(Type, nullptr, R_RELAX_TLS_GD_TO_LE), Type,
-         Offset, Addend, &Body});
     return Target->TlsGdRelaxSkip;
   }
 




More information about the llvm-commits mailing list