[lld] r212652 - Move GOTPass and StubsPass from Core to MachO

Nick Kledzik kledzik at apple.com
Wed Jul 9 14:04:25 PDT 2014


Author: kledzik
Date: Wed Jul  9 16:04:24 2014
New Revision: 212652

URL: http://llvm.org/viewvc/llvm-project?rev=212652&view=rev
Log:
Move GOTPass and StubsPass from Core to MachO

Added:
    lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp
      - copied, changed from r212616, lld/trunk/lib/Passes/GOTPass.cpp
    lld/trunk/lib/ReaderWriter/MachO/MachOPasses.h
      - copied, changed from r212616, lld/trunk/include/lld/Core/Pass.h
    lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp
      - copied, changed from r212616, lld/trunk/lib/Passes/StubsPass.cpp
Removed:
    lld/trunk/lib/Passes/GOTPass.cpp
    lld/trunk/lib/Passes/StubsPass.cpp
    lld/trunk/test/core/pass-got-basic.objtxt
    lld/trunk/test/core/pass-stubs-basic.objtxt
Modified:
    lld/trunk/include/lld/Core/Pass.h
    lld/trunk/lib/Passes/CMakeLists.txt
    lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp
    lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt
    lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp
    lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp

Modified: lld/trunk/include/lld/Core/Pass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Pass.h?rev=212652&r1=212651&r2=212652&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Pass.h (original)
+++ lld/trunk/include/lld/Core/Pass.h Wed Jul  9 16:04:24 2014
@@ -18,7 +18,6 @@
 #include <vector>
 
 namespace lld {
-class DefinedAtom;
 class MutableFile;
 
 /// Once the core linking is done (which resolves references, coalesces atoms
@@ -43,79 +42,6 @@ protected:
   Pass() { }
 };
 
-/// Pass for adding stubs (PLT entries) for calls to functions
-/// outside the linkage unit.  This class is subclassed by each
-/// file format Writer which implements the pure virtual methods.
-class StubsPass : public Pass {
-public:
-  StubsPass() : Pass() {}
-
-  /// Scans all Atoms looking for call-site uses of SharedLibraryAtoms
-  /// and transfroms the call-site to call a stub instead using the
-  /// helper methods below.
-  void perform(std::unique_ptr<MutableFile> &mergedFile) override;
-
-  /// If true, the pass should use stubs for references
-  /// to shared library symbols. If false, the pass
-  /// will generate relocations on the text segment which the
-  /// runtime loader will use to patch the program at runtime.
-  virtual bool noTextRelocs() = 0;
-
-  /// Returns whether the Reference kind is for a call site.  The pass
-  /// uses this to find calls that need to be indirected through a stub.
-  virtual bool isCallSite(const Reference &) = 0;
-
-  /// Returns a file format specific atom for a stub/PLT entry which contains
-  /// instructions which jump to the specified atom.  May be called multiple
-  /// times for the same target atom, in which case this method should return
-  /// the same stub atom.
-  virtual const DefinedAtom *getStub(const Atom &target) = 0;
-
-  /// After the default implementation of perform() is done calling getStub(),
-  /// it will call this method to add all the stub (and support) atoms to the
-  /// master file object.
-  virtual void addStubAtoms(MutableFile &masterFile) = 0;
-
-private:
-  void replaceCalleeWithStub(const Atom *target, const Reference *ref);
-};
-
-/// Pass for adding GOT entries for pointers to functions/data
-/// outside the linkage unit. This class is subclassed by each
-/// file format Writer which implements the pure virtual methods.
-class GOTPass : public Pass {
-public:
-  GOTPass() : Pass() {}
-
-  /// Scans all Atoms looking for pointer to SharedLibraryAtoms
-  /// and transfroms them to a pointer to a GOT entry using the
-  /// helper methods below.
-  void perform(std::unique_ptr<MutableFile> &mergedFile) override;
-
-  /// If true, the pass will use GOT entries for references
-  /// to shared library symbols. If false, the pass
-  /// will generate relocations on the text segment which the
-  /// runtime loader will use to patch the program at runtime.
-  virtual bool noTextRelocs() = 0;
-
-  /// Returns whether the Reference kind is a pre-instantiated GOT access.
-  /// The default implementation of perform() uses this to figure out
-  /// what GOT entries to instantiate.
-  virtual bool isGOTAccess(const Reference &, bool &canBypassGOT) = 0;
-
-  /// The file format Writer needs to alter the reference kind from a
-  /// pre-instantiated GOT access to an actual access.  If targetIsNowGOT is
-  /// true, the pass has instantiated a GOT atom and altered the reference's
-  /// target to point to that atom.  If targetIsNowGOT is false, the pass
-  /// determined a GOT entry is not needed because the reference site can
-  /// directly access the target.
-  virtual void updateReferenceToGOT(const Reference*, bool targetIsNowGOT) = 0;
-
-  /// Returns a file format specific atom for a GOT entry targeting
-  /// the specified atom.
-  virtual const DefinedAtom *makeGOTEntry(const Atom &target) = 0;
-};
-
 } // namespace lld
 
 #endif // LLD_CORE_PASS_H

Modified: lld/trunk/lib/Passes/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/CMakeLists.txt?rev=212652&r1=212651&r2=212652&view=diff
==============================================================================
--- lld/trunk/lib/Passes/CMakeLists.txt (original)
+++ lld/trunk/lib/Passes/CMakeLists.txt Wed Jul  9 16:04:24 2014
@@ -1,6 +1,4 @@
 add_lld_library(lldPasses
-  GOTPass.cpp
-  StubsPass.cpp
   LayoutPass.cpp
   RoundTripNativePass.cpp
   RoundTripYAMLPass.cpp

Removed: lld/trunk/lib/Passes/GOTPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/GOTPass.cpp?rev=212651&view=auto
==============================================================================
--- lld/trunk/lib/Passes/GOTPass.cpp (original)
+++ lld/trunk/lib/Passes/GOTPass.cpp (removed)
@@ -1,107 +0,0 @@
-//===- Passes/GOTPass.cpp - Adds GOT entries ------------------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file
-/// This linker pass transforms all GOT kind references to real references.
-/// That is, in assembly you can write something like:
-///     movq foo at GOTPCREL(%rip), %rax
-/// which means you want to load a pointer to "foo" out of the GOT (global
-/// Offsets Table). In the object file, the Atom containing this instruction
-/// has a Reference whose target is an Atom named "foo" and the Reference
-/// kind is a GOT load.  The linker needs to instantiate a pointer sized
-/// GOT entry.  This is done be creating a GOT Atom to represent that pointer
-/// sized data in this pass, and altering the Atom graph so the Reference now
-/// points to the GOT Atom entry (corresponding to "foo") and changing the
-/// Reference Kind to reflect it is now pointing to a GOT entry (rather
-/// then needing a GOT entry).
-///
-/// There is one optimization the linker can do here.  If the target of the GOT
-/// is in the same linkage unit and does not need to be interposable, and
-/// the GOT use is just a load (not some other operation), this pass can
-/// transform that load into an LEA (add).  This optimizes away one memory load
-/// which at runtime that could stall the pipeline.  This optimization only
-/// works for architectures in which a (GOT) load instruction can be change to
-/// an LEA instruction that is the same size.  The method isGOTAccess() should
-/// only return true for "canBypassGOT" if this optimization is supported.
-///
-//===----------------------------------------------------------------------===//
-
-#include "lld/Core/DefinedAtom.h"
-#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
-#include "lld/Core/Pass.h"
-#include "lld/Core/Reference.h"
-#include "llvm/ADT/DenseMap.h"
-
-namespace lld {
-
-static bool shouldReplaceTargetWithGOTAtom(const Atom *target,
-                                           bool canBypassGOT) {
-  // Accesses to shared library symbols must go through GOT.
-  if (target->definition() == Atom::definitionSharedLibrary)
-    return true;
-  // Accesses to interposable symbols in same linkage unit must also go
-  // through GOT.
-  const DefinedAtom *defTarget = dyn_cast<DefinedAtom>(target);
-  if (defTarget != nullptr &&
-      defTarget->interposable() != DefinedAtom::interposeNo) {
-    assert(defTarget->scope() != DefinedAtom::scopeTranslationUnit);
-    return true;
-  }
-  // Target does not require indirection.  So, if instruction allows GOT to be
-  // by-passed, do that optimization and don't create GOT entry.
-  return !canBypassGOT;
-}
-
-static const DefinedAtom *
-findGOTAtom(const Atom *target,
-            llvm::DenseMap<const Atom *, const DefinedAtom *> &targetToGOT) {
-  auto pos = targetToGOT.find(target);
-  return (pos == targetToGOT.end()) ? nullptr : pos->second;
-}
-
-void GOTPass::perform(std::unique_ptr<MutableFile> &mergedFile) {
-  // Use map so all pointers to same symbol use same GOT entry.
-  llvm::DenseMap<const Atom*, const DefinedAtom*> targetToGOT;
-
-  // Scan all references in all atoms.
-  for (const DefinedAtom *atom : mergedFile->defined()) {
-    for (const Reference *ref : *atom) {
-      // Look at instructions accessing the GOT.
-      bool canBypassGOT;
-      if (!isGOTAccess(*ref, canBypassGOT))
-        continue;
-      const Atom *target = ref->target();
-      assert(target != nullptr);
-
-      if (!shouldReplaceTargetWithGOTAtom(target, canBypassGOT)) {
-        // Update reference kind to reflect that target is a direct accesss.
-        updateReferenceToGOT(ref, false);
-        continue;
-      }
-      // Replace the target with a reference to a GOT entry.
-      const DefinedAtom *gotEntry = findGOTAtom(target, targetToGOT);
-      if (!gotEntry) {
-        gotEntry = makeGOTEntry(*target);
-        assert(gotEntry != nullptr);
-        assert(gotEntry->contentType() == DefinedAtom::typeGOT);
-        targetToGOT[target] = gotEntry;
-      }
-      const_cast<Reference *>(ref)->setTarget(gotEntry);
-      // Update reference kind to reflect that target is now a GOT entry.
-      updateReferenceToGOT(ref, true);
-    }
-  }
-
-  // add all created GOT Atoms to master file
-  for (auto &it : targetToGOT)
-    mergedFile->addAtom(*it.second);
-}
-
-} // end namesapce lld

Removed: lld/trunk/lib/Passes/StubsPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Passes/StubsPass.cpp?rev=212651&view=auto
==============================================================================
--- lld/trunk/lib/Passes/StubsPass.cpp (original)
+++ lld/trunk/lib/Passes/StubsPass.cpp (removed)
@@ -1,66 +0,0 @@
-//===- Passes/StubsPass.cpp - Adds stubs ----------------------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This linker pass updates call-sites which have references to shared library
-// atoms to instead have a reference to a stub (PLT entry) for the specified
-// symbol.  Each file format defines a subclass of StubsPass which implements
-// the abstract methods for creating the file format specific StubAtoms.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lld/Core/DefinedAtom.h"
-#include "lld/Core/File.h"
-#include "lld/Core/LLVM.h"
-#include "lld/Core/Pass.h"
-#include "lld/Core/Reference.h"
-#include "llvm/ADT/DenseMap.h"
-
-namespace lld {
-
-void StubsPass::perform(std::unique_ptr<MutableFile> &mergedFile) {
-  // Skip this pass if output format uses text relocations instead of stubs.
-  if (!this->noTextRelocs())
-    return;
-
-  // Scan all references in all atoms.
-  for (const DefinedAtom *atom : mergedFile->defined()) {
-    for (const Reference *ref : *atom) {
-      // Look at call-sites.
-      if (!this->isCallSite(*ref))
-        continue;
-      const Atom *target = ref->target();
-      assert(target != nullptr);
-      if (target->definition() == Atom::definitionSharedLibrary) {
-        // Calls to shared libraries go through stubs.
-        replaceCalleeWithStub(target, ref);
-        continue;
-      }
-      const DefinedAtom *defTarget = dyn_cast<DefinedAtom>(target);
-      if (defTarget && defTarget->interposable() != DefinedAtom::interposeNo) {
-        // Calls to interposable functions in same linkage unit must also go
-        // through a stub.
-        assert(defTarget->scope() != DefinedAtom::scopeTranslationUnit);
-        replaceCalleeWithStub(target, ref);
-      }
-    }
-  }
-  // Add all created stubs and support Atoms.
-  this->addStubAtoms(*mergedFile);
-}
-
-void StubsPass::replaceCalleeWithStub(const Atom *target,
-                                      const Reference *ref) {
-  // Make file-format specific stub and other support atoms.
-  const DefinedAtom *stub = this->getStub(*target);
-  assert(stub != nullptr);
-  // Switch call site to reference stub atom instead.
-  const_cast<Reference *>(ref)->setTarget(stub);
-}
-
-} // end namespace lld

Modified: lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp?rev=212652&r1=212651&r2=212652&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/CoreLinkingContext.cpp Wed Jul  9 16:04:24 2014
@@ -184,67 +184,6 @@ private:
 };
 
 
-class TestingStubsPass : public StubsPass {
-public:
-  TestingStubsPass(const LinkingContext &ctx) : _file(ctx) {}
-
-  bool noTextRelocs() override { return true; }
-
-  bool isCallSite(const Reference &ref) override {
-    if (ref.kindNamespace() != Reference::KindNamespace::testing)
-      return false;
-    return (ref.kindValue() == CoreLinkingContext::TEST_RELOC_CALL32);
-  }
-
-  const DefinedAtom *getStub(const Atom &target) override {
-    const DefinedAtom *result = new TestingStubAtom(_file, target);
-    _file.addAtom(*result);
-    return result;
-  }
-
-  void addStubAtoms(MutableFile &mergedFile) override {
-    for (const DefinedAtom *stub : _file.defined()) {
-      mergedFile.addAtom(*stub);
-    }
-  }
-
-private:
-  TestingPassFile _file;
-};
-
-class TestingGOTPass : public GOTPass {
-public:
-  TestingGOTPass(const LinkingContext &ctx) : _file(ctx) {}
-
-  bool noTextRelocs() override { return true; }
-
-  bool isGOTAccess(const Reference &ref, bool &canBypassGOT) override {
-    if (ref.kindNamespace() != Reference::KindNamespace::testing)
-      return false;
-    switch (ref.kindValue()) {
-    case CoreLinkingContext::TEST_RELOC_GOT_LOAD32:
-      canBypassGOT = true;
-      return true;
-    case CoreLinkingContext::TEST_RELOC_GOT_USE32:
-      canBypassGOT = false;
-      return true;
-    }
-    return false;
-  }
-
-  void updateReferenceToGOT(const Reference *ref, bool targetIsNowGOT) override {
-    const_cast<Reference *>(ref)->setKindValue(
-        targetIsNowGOT ? CoreLinkingContext::TEST_RELOC_PCREL32
-                       : CoreLinkingContext::TEST_RELOC_LEA32_WAS_GOT);
-  }
-
-  const DefinedAtom *makeGOTEntry(const Atom &target) override {
-    return new TestingGOTAtom(_file, target);
-  }
-
-private:
-  TestingPassFile _file;
-};
 
 } // anonymous namespace
 
@@ -259,10 +198,6 @@ void CoreLinkingContext::addPasses(PassM
   for (StringRef name : _passNames) {
     if (name.equals("layout"))
       pm.add(std::unique_ptr<Pass>(new LayoutPass(registry())));
-    else if (name.equals("GOT"))
-      pm.add(std::unique_ptr<Pass>(new TestingGOTPass(*this)));
-    else if (name.equals("stubs"))
-      pm.add(std::unique_ptr<Pass>(new TestingStubsPass(*this)));
     else
       llvm_unreachable("bad pass name");
   }

Modified: lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt?rev=212652&r1=212651&r2=212652&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt (original)
+++ lld/trunk/lib/ReaderWriter/MachO/CMakeLists.txt Wed Jul  9 16:04:24 2014
@@ -1,4 +1,5 @@
 add_lld_library(lldMachO
+  GOTPass.cpp
   MachOLinkingContext.cpp
   MachONormalizedFileBinaryReader.cpp
   MachONormalizedFileBinaryWriter.cpp
@@ -6,6 +7,7 @@ add_lld_library(lldMachO
   MachONormalizedFileToAtoms.cpp
   MachONormalizedFileYAML.cpp
   ReferenceKinds.cpp
+  StubsPass.cpp
   WriterMachO.cpp
   )
 

Copied: lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp (from r212616, lld/trunk/lib/Passes/GOTPass.cpp)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp?p2=lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp&p1=lld/trunk/lib/Passes/GOTPass.cpp&r1=212616&r2=212652&rev=212652&view=diff
==============================================================================
--- lld/trunk/lib/Passes/GOTPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/GOTPass.cpp Wed Jul  9 16:04:24 2014
@@ -1,4 +1,4 @@
-//===- Passes/GOTPass.cpp - Adds GOT entries ------------------------------===//
+//===- lib/ReaderWriter/MachO/GOTPass.cpp ---------------------------------===//
 //
 //                             The LLVM Linker
 //
@@ -35,10 +35,11 @@
 #include "lld/Core/DefinedAtom.h"
 #include "lld/Core/File.h"
 #include "lld/Core/LLVM.h"
-#include "lld/Core/Pass.h"
 #include "lld/Core/Reference.h"
 #include "llvm/ADT/DenseMap.h"
 
+#include "MachOPasses.h"
+
 namespace lld {
 
 static bool shouldReplaceTargetWithGOTAtom(const Atom *target,

Modified: lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp?rev=212652&r1=212651&r2=212652&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/GOTPass.hpp Wed Jul  9 16:04:24 2014
@@ -16,6 +16,7 @@
 #include "lld/Core/Reference.h"
 #include "lld/Core/Pass.h"
 
+#include "MachOPasses.h"
 #include "ReferenceKinds.h"
 #include "StubAtoms.hpp"
 

Copied: lld/trunk/lib/ReaderWriter/MachO/MachOPasses.h (from r212616, lld/trunk/include/lld/Core/Pass.h)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOPasses.h?p2=lld/trunk/lib/ReaderWriter/MachO/MachOPasses.h&p1=lld/trunk/include/lld/Core/Pass.h&r1=212616&r2=212652&rev=212652&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/Pass.h (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachOPasses.h Wed Jul  9 16:04:24 2014
@@ -1,4 +1,4 @@
-//===------ Core/Pass.h - Base class for linker passes --------------------===//
+//===- lib/ReaderWriter/MachO/MachOPasses.h -------------------------------===//
 //
 //                             The LLVM Linker
 //
@@ -7,11 +7,12 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLD_CORE_PASS_H
-#define LLD_CORE_PASS_H
+#ifndef LLD_READER_WRITER_MACHO_PASSES_H
+#define LLD_READER_WRITER_MACHO_PASSES_H
 
 #include "lld/Core/Atom.h"
 #include "lld/Core/File.h"
+#include "lld/Core/Pass.h"
 #include "lld/Core/range.h"
 #include "lld/Core/Reference.h"
 
@@ -21,27 +22,6 @@ namespace lld {
 class DefinedAtom;
 class MutableFile;
 
-/// Once the core linking is done (which resolves references, coalesces atoms
-/// and produces a complete Atom graph), the linker runs a series of passes
-/// on the Atom graph. The graph is modeled as a File, which means the pass
-/// has access to all the atoms and to File level attributes. Each pass does
-/// a particular transformation to the Atom graph or to the File attributes.
-///
-/// This is the abstract base class for all passes.  A Pass does its
-/// actual work in it perform() method.  It can iterator over Atoms in the
-/// graph using the *begin()/*end() atom iterator of the File.  It can add
-/// new Atoms to the graph using the File's addAtom() method.
-class Pass {
-public:
-  virtual ~Pass() { }
-
-  /// Do the actual work of the Pass.
-  virtual void perform(std::unique_ptr<MutableFile> &mergedFile) = 0;
-
-protected:
-  // Only subclassess can be instantiated.
-  Pass() { }
-};
 
 /// Pass for adding stubs (PLT entries) for calls to functions
 /// outside the linkage unit.  This class is subclassed by each
@@ -118,4 +98,4 @@ public:
 
 } // namespace lld
 
-#endif // LLD_CORE_PASS_H
+#endif // LLD_READER_WRITER_MACHO_PASSES_H

Copied: lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp (from r212616, lld/trunk/lib/Passes/StubsPass.cpp)
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp?p2=lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp&p1=lld/trunk/lib/Passes/StubsPass.cpp&r1=212616&r2=212652&rev=212652&view=diff
==============================================================================
--- lld/trunk/lib/Passes/StubsPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/StubsPass.cpp Wed Jul  9 16:04:24 2014
@@ -1,4 +1,4 @@
-//===- Passes/StubsPass.cpp - Adds stubs ----------------------------------===//
+//===- lib/ReaderWriter/MachO/StubsPass.cpp -------------------------------===//
 //
 //                             The LLVM Linker
 //
@@ -17,10 +17,11 @@
 #include "lld/Core/DefinedAtom.h"
 #include "lld/Core/File.h"
 #include "lld/Core/LLVM.h"
-#include "lld/Core/Pass.h"
 #include "lld/Core/Reference.h"
 #include "llvm/ADT/DenseMap.h"
 
+#include "MachOPasses.h"
+
 namespace lld {
 
 void StubsPass::perform(std::unique_ptr<MutableFile> &mergedFile) {

Modified: lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp?rev=212652&r1=212651&r2=212652&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/StubsPass.hpp Wed Jul  9 16:04:24 2014
@@ -19,6 +19,7 @@
 #include "lld/Core/SharedLibraryAtom.h"
 #include "lld/Core/Simple.h"
 
+#include "MachOPasses.h"
 #include "ReferenceKinds.h"
 #include "StubAtoms.hpp"
 

Removed: lld/trunk/test/core/pass-got-basic.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/core/pass-got-basic.objtxt?rev=212651&view=auto
==============================================================================
--- lld/trunk/test/core/pass-got-basic.objtxt (original)
+++ lld/trunk/test/core/pass-got-basic.objtxt (removed)
@@ -1,82 +0,0 @@
-# RUN: lld -core %s --add-pass GOT  | FileCheck %s
-
-#
-# Test that GOT pass instantiates GOT entires and alters references
-#
-
----
-defined-atoms:
-    - name:              foo
-      type:              code
-      content:           [ 48, 8B, 0D, 00, 00, 00, 00,
-                           48, 8B, 0D, 00, 00, 00, 00,
-                           48, 8B, 0D, 00, 00, 00, 00,
-                           48, 83, 3D, 00, 00, 00, 00, 00,
-                           48, 83, 3D, 00, 00, 00, 00, 00,
-                           48, 83, 3D, 00, 00, 00, 00, 00,
-                           48, 83, 3D, 00, 00, 00, 00, 00 ]
-      references:
-      - offset:          3
-        kind:            gotLoad32
-        target:          malloc
-      - offset:          10
-        kind:            gotLoad32
-        target:          myPrivate
-      - offset:          17
-        kind:            gotLoad32
-        target:          myInterposable
-      - offset:          24
-        kind:            gotUse32
-        target:          malloc
-      - offset:          32
-        kind:            gotUse32
-        target:          myPrivate
-      - offset:          40
-        kind:            gotUse32
-        target:          myInterposable
-
-    - name:              myPrivate
-      scope:             global
-      interposable:      no
-
-    - name:              myInterposable
-      scope:             global
-      interposable:      yes
-
-shared-library-atoms:
-    - name:              malloc
-      load-name:         libc.so
-
-...
-
-# CHECK:  defined-atoms:
-# CHECK:       name:         foo
-# CHECK:       references:
-# CHECK:        kind:         pcrel32
-# CHECK:        offset:       3
-# CHECK:        target:       L
-# CHECK:        kind:         lea32wasGot
-# CHECK:        offset:       10
-# CHECK:        target:       myPrivate
-# CHECK:        kind:         pcrel32
-# CHECK:        offset:       17
-# CHECK:        target:       L
-# CHECK:        kind:         pcrel32
-# CHECK:        offset:       24
-# CHECK:        target:       L
-# CHECK:        kind:         pcrel32
-# CHECK:        offset:       32
-# CHECK:        target:       L
-# CHECK:        kind:         pcrel32
-# CHECK:        offset:       40
-# CHECK:        target:       L
-# CHECK:       name:         myPrivate
-# CHECK:       name:         myInterposable
-# CHECK:       interposable: yes
-# CHECK:       name:         L
-# CHECK:       type:         got
-# CHECK:       type:         got
-# CHECK:       type:         got
-# CHECK:   shared-library-atoms:
-# CHECK:       name:         malloc
-# CHECK:       ...

Removed: lld/trunk/test/core/pass-stubs-basic.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/core/pass-stubs-basic.objtxt?rev=212651&view=auto
==============================================================================
--- lld/trunk/test/core/pass-stubs-basic.objtxt (original)
+++ lld/trunk/test/core/pass-stubs-basic.objtxt (removed)
@@ -1,47 +0,0 @@
-# RUN: lld -core %s --add-pass stubs  | FileCheck %s
-
-#
-# Test that stubs pass adds stubs and rebinds call sites to the stub
-#
-
----
-defined-atoms:
-    - name:              foo
-      type:              code
-      content:           [ E8, 00, 00, 00, 00, E8, 00, 00, 00,
-                           00, 48 ,8B, 05, 00, 00, 00, 00 ]
-      references:
-      - offset:          1
-        kind:            call32
-        target:          malloc
-      - offset:          6
-        kind:            call32
-        target:          free
-      - offset:          13
-        kind:            gotLoad32
-        target:          malloc
-
-shared-library-atoms:
-    - name:              malloc
-      load-name:         libc.so
-
-    - name:              free
-      load-name:         libc.so
-
-...
-
-# CHECK:       name:         foo
-# CHECK:       references:
-# CHECK:       kind:         call32
-# CHECK:       target:       L
-# CHECK:       kind:         call32
-# CHECK:       target:       L
-# CHECK:       kind:         gotLoad32
-# CHECK:       target:       malloc
-# CHECK:       name:         L
-# CHECK:       type:         stub
-# CHECK:       name:         L
-# CHECK:       type:         stub
-# CHECK:       name:         malloc
-# CHECK:       name:         free
-# CHECK:       ...





More information about the llvm-commits mailing list