<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 20, 2016 at 2:14 PM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Fri May 20 16:14:06 2016<br>
New Revision: 270275<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=270275&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=270275&view=rev</a><br>
Log:<br>
Simplify a bit. NFC.<br>
<br>
Modified:<br>
    lld/trunk/ELF/InputSection.cpp<br>
<br>
Modified: lld/trunk/ELF/InputSection.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=270275&r1=270274&r2=270275&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=270275&r1=270274&r2=270275&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/InputSection.cpp (original)<br>
+++ lld/trunk/ELF/InputSection.cpp Fri May 20 16:14:06 2016<br>
@@ -292,30 +292,30 @@ void InputSectionBase<ELFT>::relocate(ui<br>
     uint64_t SymVA = SignExtend64<Bits>(<br>
         getSymVA<ELFT>(Type, A, AddrLoc, *Rel.Sym, BufLoc, *File, Expr));<br>
<br>
-    if (Expr == R_RELAX_TLS_IE_TO_LE) {<br>
-      Target->relaxTlsIeToLe(BufLoc, Type, SymVA);<br>
-      continue;<br>
-    }<br>
-    if (Expr == R_RELAX_TLS_LD_TO_LE) {<br>
-      Target->relaxTlsLdToLe(BufLoc, Type, SymVA);<br>
-      continue;<br>
-    }<br>
-    if (Expr == R_RELAX_TLS_GD_TO_LE) {<br>
-      Target->relaxTlsGdToLe(BufLoc, Type, SymVA);<br>
-      continue;<br>
-    }<br>
-    if (Expr == R_RELAX_TLS_GD_TO_IE_PC || Expr == R_RELAX_TLS_GD_TO_IE) {<br>
-      Target->relaxTlsGdToIe(BufLoc, Type, SymVA);<br>
-      continue;<br>
-    }<br>
-<br>
     if (Expr == R_PPC_PLT_OPD) {<br>
       uint32_t Nop = 0x60000000;<br>
       if (BufLoc + 8 <= BufEnd && read32be(BufLoc + 4) == Nop)<br>
         write32be(BufLoc + 4, 0xe8410028); // ld %r2, 40(%r1)<br>
     }<br>
<br>
-    Target->relocateOne(BufLoc, Type, SymVA);<br>
+    switch (Expr) {<br>
+    case R_RELAX_TLS_IE_TO_LE:<br>
+      Target->relaxTlsIeToLe(BufLoc, Type, SymVA);<br>
+      break;<br>
+    case R_RELAX_TLS_LD_TO_LE:<br>
+      Target->relaxTlsLdToLe(BufLoc, Type, SymVA);<br>
+      break;<br>
+    case R_RELAX_TLS_GD_TO_LE:<br>
+      Target->relaxTlsGdToLe(BufLoc, Type, SymVA);<br>
+      break;<br>
+    case R_RELAX_TLS_GD_TO_IE_PC:<br>
+    case R_RELAX_TLS_GD_TO_IE:<br>
+      Target->relaxTlsGdToIe(BufLoc, Type, SymVA);<br>
+      break;<br></blockquote><div><br></div><div>You could move the code for R_PPC_PLT_ORD here and fallthrough to default, if you want. (I'm not saying that it's better, but just noticed.)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    default:<br>
+      Target->relocateOne(BufLoc, Type, SymVA);<br>
+      break;<br>
+    }<br>
   }<br>
 }<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>