Reapply fixed r255626 that broke buildbot:
authorGeorge Rimar <grimar@accesssoftek.com>
Tue, 15 Dec 2015 08:48:39 +0000 (08:48 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Tue, 15 Dec 2015 08:48:39 +0000 (08:48 +0000)
[ELF] - refactor of code in RelocationSection<ELFT>::writeTo()

Just a little reformat of 'if' conditions, NFC.

Differential revision: http://reviews.llvm.org/D15453

Fix was:
* Renamed unsigned Rel; to unsigned Reloc;

llvm-svn: 255631

lld/ELF/OutputSections.cpp

index c64610f..740e33f 100644 (file)
@@ -264,21 +264,19 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
     bool LazyReloc = Body && Target->supportsLazyRelocations() &&
                      Target->relocNeedsPlt(Type, *Body);
 
-    if (CanBePreempted) {
-      unsigned GotReloc =
-          Body->isTLS() ? Target->getTlsGotReloc() : Target->getGotReloc();
-      if (NeedsGot)
-        P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
-                            LazyReloc ? Target->getPltReloc() : GotReloc,
-                            Config->Mips64EL);
-      else
-        P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
-                            NeedsCopy ? Target->getCopyReloc()
-                                      : Target->getDynReloc(Type),
-                            Config->Mips64EL);
-    } else {
-      P->setSymbolAndType(0, Target->getRelativeReloc(), Config->Mips64EL);
-    }
+    unsigned Sym = CanBePreempted ? Body->getDynamicSymbolTableIndex() : 0;
+    unsigned Reloc;
+    if (!CanBePreempted)
+      Reloc = Target->getRelativeReloc();
+    else if (LazyReloc)
+      Reloc = Target->getPltReloc();
+    else if (NeedsGot)
+      Reloc = Body->isTLS() ? Target->getTlsGotReloc() : Target->getGotReloc();
+    else if (NeedsCopy)
+      Reloc = Target->getCopyReloc();
+    else
+      Reloc = Target->getDynReloc(Type);
+    P->setSymbolAndType(Sym, Reloc, Config->Mips64EL);
 
     if (NeedsGot) {
       if (LazyReloc)