[lld] r270275 - Simplify a bit. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 14:14:06 PDT 2016


Author: rafael
Date: Fri May 20 16:14:06 2016
New Revision: 270275

URL: http://llvm.org/viewvc/llvm-project?rev=270275&view=rev
Log:
Simplify a bit. 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=270275&r1=270274&r2=270275&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri May 20 16:14:06 2016
@@ -292,30 +292,30 @@ void InputSectionBase<ELFT>::relocate(ui
     uint64_t SymVA = SignExtend64<Bits>(
         getSymVA<ELFT>(Type, A, AddrLoc, *Rel.Sym, BufLoc, *File, Expr));
 
-    if (Expr == R_RELAX_TLS_IE_TO_LE) {
-      Target->relaxTlsIeToLe(BufLoc, Type, SymVA);
-      continue;
-    }
-    if (Expr == R_RELAX_TLS_LD_TO_LE) {
-      Target->relaxTlsLdToLe(BufLoc, Type, SymVA);
-      continue;
-    }
-    if (Expr == R_RELAX_TLS_GD_TO_LE) {
-      Target->relaxTlsGdToLe(BufLoc, Type, SymVA);
-      continue;
-    }
-    if (Expr == R_RELAX_TLS_GD_TO_IE_PC || Expr == R_RELAX_TLS_GD_TO_IE) {
-      Target->relaxTlsGdToIe(BufLoc, Type, SymVA);
-      continue;
-    }
-
     if (Expr == R_PPC_PLT_OPD) {
       uint32_t Nop = 0x60000000;
       if (BufLoc + 8 <= BufEnd && read32be(BufLoc + 4) == Nop)
         write32be(BufLoc + 4, 0xe8410028); // ld %r2, 40(%r1)
     }
 
-    Target->relocateOne(BufLoc, Type, SymVA);
+    switch (Expr) {
+    case R_RELAX_TLS_IE_TO_LE:
+      Target->relaxTlsIeToLe(BufLoc, Type, SymVA);
+      break;
+    case R_RELAX_TLS_LD_TO_LE:
+      Target->relaxTlsLdToLe(BufLoc, Type, SymVA);
+      break;
+    case R_RELAX_TLS_GD_TO_LE:
+      Target->relaxTlsGdToLe(BufLoc, Type, SymVA);
+      break;
+    case R_RELAX_TLS_GD_TO_IE_PC:
+    case R_RELAX_TLS_GD_TO_IE:
+      Target->relaxTlsGdToIe(BufLoc, Type, SymVA);
+      break;
+    default:
+      Target->relocateOne(BufLoc, Type, SymVA);
+      break;
+    }
   }
 }
 




More information about the llvm-commits mailing list