[lld] r255628 - Revert of r255626 "[ELF] - refactor of code in RelocationSection<ELFT>::writeTo()"

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 00:40:38 PST 2015


Author: grimar
Date: Tue Dec 15 02:39:42 2015
New Revision: 255628

URL: http://llvm.org/viewvc/llvm-project?rev=255628&view=rev
Log:
Revert of r255626 "[ELF] - refactor of code in RelocationSection<ELFT>::writeTo()"

as it broke buildbot: 
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/17836/steps/build_Lld/logs/stdio
/Users/buildslave/as-bldslv9/lld-x86_64-darwin13/llvm.src/tools/lld/ELF/OutputSections.cpp:268:14: error: redefinition of 'Rel'
    unsigned Rel;   ^
/Users/buildslave/as-bldslv9/lld-x86_64-darwin13/llvm.src/tools/lld/ELF/OutputSections.cpp:241:34: note: previous definition is here
  for (const DynamicReloc<ELFT> &Rel : Relocs) {

That compiles fine on my MSVS 2015 thought.



Modified:
    lld/trunk/ELF/OutputSections.cpp

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=255628&r1=255627&r2=255628&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Dec 15 02:39:42 2015
@@ -264,19 +264,21 @@ template <class ELFT> void RelocationSec
     bool LazyReloc = Body && Target->supportsLazyRelocations() &&
                      Target->relocNeedsPlt(Type, *Body);
 
-    unsigned Sym = CanBePreempted ? Body->getDynamicSymbolTableIndex() : 0;
-    unsigned Rel;
-    if (!CanBePreempted)
-      Rel = Target->getRelativeReloc();
-    else if (LazyReloc)
-      Rel = Target->getPltReloc();
-    else if (NeedsGot)
-      Rel = Body->isTLS() ? Target->getTlsGotReloc() : Target->getGotReloc();
-    else if (NeedsCopy)
-      Rel = Target->getCopyReloc();
-    else
-      Rel = Target->getDynReloc(Type);
-    P->setSymbolAndType(Sym, Rel, Config->Mips64EL);
+    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);
+    }
 
     if (NeedsGot) {
       if (LazyReloc)




More information about the llvm-commits mailing list