[llvm-commits] [lld] r160982 - in /lld/trunk: lib/ReaderWriter/MachO/StubsPass.hpp test/darwin/hello-world.objtxt tools/lld-core/TestingHelpers.hpp

Nick Kledzik kledzik at apple.com
Mon Jul 30 13:10:46 PDT 2012


Author: kledzik
Date: Mon Jul 30 15:10:46 2012
New Revision: 160982

URL: http://llvm.org/viewvc/llvm-project?rev=160982&view=rev
Log:
PR13467: Fix mach-o writer to handle case of zero stubs.  Renumber TestingHelpers kind values

Modified:
    lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp
    lld/trunk/test/darwin/hello-world.objtxt
    lld/trunk/tools/lld-core/TestingHelpers.hpp

Modified: lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp?rev=160982&r1=160981&r2=160982&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp Mon Jul 30 15:10:46 2012
@@ -117,6 +117,9 @@
 
 
   virtual void addStubAtoms(File &mergedFile) {
+    // Exit early if no stubs needed.
+    if ( _targetToStub.size() == 0 )
+      return;
     // Add all stubs to master file.
     for (auto it : _targetToStub) {
       mergedFile.addAtom(*it.second);

Modified: lld/trunk/test/darwin/hello-world.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/darwin/hello-world.objtxt?rev=160982&r1=160981&r2=160982&view=diff
==============================================================================
--- lld/trunk/test/darwin/hello-world.objtxt (original)
+++ lld/trunk/test/darwin/hello-world.objtxt Mon Jul 30 15:10:46 2012
@@ -1,4 +1,4 @@
-# RUN: lld-core -platform darwin -stubs-pass %s -o %t && llvm-nm %t | FileCheck %s
+# RUN: lld-core -writer=mach-o -stubs-pass %s -o %t && llvm-nm %t | FileCheck %s
 
 #
 # Test that hello-world can be linked into a mach-o executable

Modified: lld/trunk/tools/lld-core/TestingHelpers.hpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/tools/lld-core/TestingHelpers.hpp?rev=160982&r1=160981&r2=160982&view=diff
==============================================================================
--- lld/trunk/tools/lld-core/TestingHelpers.hpp (original)
+++ lld/trunk/tools/lld-core/TestingHelpers.hpp Mon Jul 30 15:10:46 2012
@@ -275,11 +275,11 @@
 // Table of fixup kinds in YAML documents used for testing
 //
 const TestingKindMapping sKinds[] = {
-    { "call32",         1,    true,  false, false},
-    { "pcrel32",        2,    false, false, false },
-    { "gotLoad32",      3,    false, true,  true },
-    { "gotUse32",       4,    false, false, true },
-    { "lea32wasGot",    5,    false, false, false },
+    { "call32",         2,    true,  false, false},
+    { "pcrel32",        3,    false, false, false },
+    { "gotLoad32",      7,    false, true,  true },
+    { "gotUse32",       9,    false, false, true },
+    { "lea32wasGot",    8,    false, false, false },
     { nullptr,          0,    false, false, false }
   };
 
@@ -336,9 +336,9 @@
 
   virtual void updateReferenceToGOT(const Reference *ref, bool targetIsNowGOT) {
     if ( targetIsNowGOT )
-      (const_cast<Reference*>(ref))->setKind(2); // pcrel32
+      (const_cast<Reference*>(ref))->setKind(3); // pcrel32
     else
-      (const_cast<Reference*>(ref))->setKind(5); // lea32wasGot
+      (const_cast<Reference*>(ref))->setKind(8); // lea32wasGot
   }
 
   virtual const DefinedAtom* makeGOTEntry(const Atom &target) {





More information about the llvm-commits mailing list