[lld] r208433 - Revert "temporary commit."

Rui Ueyama ruiu at google.com
Fri May 9 09:47:20 PDT 2014


Author: ruiu
Date: Fri May  9 11:47:20 2014
New Revision: 208433

URL: http://llvm.org/viewvc/llvm-project?rev=208433&view=rev
Log:
Revert "temporary commit."

This reverts accidental commit r208427.

Modified:
    lld/trunk/include/lld/Core/ArchiveLibraryFile.h
    lld/trunk/include/lld/Core/InputGraph.h
    lld/trunk/lib/Core/InputGraph.cpp
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/lib/ReaderWriter/FileArchive.cpp
    lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h

Modified: lld/trunk/include/lld/Core/ArchiveLibraryFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/ArchiveLibraryFile.h?rev=208433&r1=208432&r2=208433&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/ArchiveLibraryFile.h (original)
+++ lld/trunk/include/lld/Core/ArchiveLibraryFile.h Fri May  9 11:47:20 2014
@@ -12,8 +12,6 @@
 
 #include "lld/Core/File.h"
 
-#include <set>
-
 namespace lld {
 
 ///
@@ -38,10 +36,6 @@ public:
   virtual error_code
   parseAllMembers(std::vector<std::unique_ptr<File>> &result) const = 0;
 
-  virtual std::set<StringRef> getDefinedSymbols() const {
-    return std::set<StringRef>();
-  }
-
 protected:
   /// only subclasses of ArchiveLibraryFile can be instantiated
   ArchiveLibraryFile(StringRef path) : File(path, kindArchiveLibrary) {}

Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=208433&r1=208432&r2=208433&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Fri May  9 11:47:20 2014
@@ -23,7 +23,6 @@
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
 
-#include <functional>
 #include <memory>
 #include <stack>
 #include <vector>
@@ -68,11 +67,6 @@ public:
   /// whether it should iterate over again or terminate or not.
   void notifyProgress();
 
-  /// Adds an observer of getNextFile(). Each time a new file is about to be
-  /// returned from getNextFile(), registered observers are called with the file
-  /// being returned.
-  void registerObserver(std::function<void(File*)> &fn);
-
   /// \brief Adds a node into the InputGraph
   void addInputElement(std::unique_ptr<InputElement>);
 
@@ -99,7 +93,6 @@ protected:
   // Index of the next element to be processed
   uint32_t _nextElementIndex;
   InputElement *_currentInputElement;
-  std::vector<std::function<void(File *)>> _observers;
 
 private:
   ErrorOr<InputElement *> getNextInputElement();

Modified: lld/trunk/lib/Core/InputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/InputGraph.cpp?rev=208433&r1=208432&r2=208433&view=diff
==============================================================================
--- lld/trunk/lib/Core/InputGraph.cpp (original)
+++ lld/trunk/lib/Core/InputGraph.cpp Fri May  9 11:47:20 2014
@@ -21,12 +21,9 @@ ErrorOr<File &> InputGraph::getNextFile(
   // it will succeed. If not, try to get the next file in the input graph.
   for (;;) {
     if (_currentInputElement) {
-      ErrorOr<File &> next = _currentInputElement->getNextFile();
-      if (next.getError() != InputGraphError::no_more_files) {
-        for (std::function<void(File*)> &observer : _observers)
-          observer(&next.get());
-        return std::move(next);
-      }
+      ErrorOr<File &> nextFile = _currentInputElement->getNextFile();
+      if (nextFile.getError() != InputGraphError::no_more_files)
+        return std::move(nextFile);
     }
 
     ErrorOr<InputElement *> elt = getNextInputElement();
@@ -38,10 +35,6 @@ ErrorOr<File &> InputGraph::getNextFile(
 
 void InputGraph::notifyProgress() { _currentInputElement->notifyProgress(); }
 
-void InputGraph::registerObserver(std::function<void(File*)> &fn) {
-  _observers.push_back(fn);
-}
-
 void InputGraph::addInputElement(std::unique_ptr<InputElement> ie) {
   _inputArgs.push_back(std::move(ie));
 }

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=208433&r1=208432&r2=208433&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Fri May  9 11:47:20 2014
@@ -13,12 +13,10 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "lld/Core/ArchiveLibraryFile.h"
 #include "lld/Driver/Driver.h"
 #include "lld/Driver/WinLinkInputGraph.h"
 #include "lld/Driver/WinLinkModuleDef.h"
 #include "lld/ReaderWriter/PECOFFLinkingContext.h"
-#include "../ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h"
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Optional.h"
@@ -36,7 +34,6 @@
 
 #include <algorithm>
 #include <cctype>
-#include <functional>
 #include <map>
 #include <memory>
 #include <sstream>
@@ -1296,19 +1293,6 @@ bool WinLinkDriver::parse(int argc, cons
     }
   }
 
-  if (!isReadingDirectiveSection) {
-    std::unique_ptr<SimpleFileNode> node(new SimpleFileNode("<export>"));
-    pecoff::ExportedSymbolRenameFile *renameFile =
-        new pecoff::ExportedSymbolRenameFile(ctx);
-    node->appendInputFile(std::unique_ptr<File>(renameFile));
-    ctx.getLibraryGroup()->addFile(std::move(node));
-    std::function<void(File *)> observer = [=](File *file) {
-      if (auto *archive = dyn_cast<ArchiveLibraryFile>(file))
-        renameFile->addResolvableSymbols(archive);
-    };
-    ctx.getInputGraph().registerObserver(observer);
-  }
-
   // Validate the combination of options used.
   return ctx.validate(diag);
 }

Modified: lld/trunk/lib/ReaderWriter/FileArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/FileArchive.cpp?rev=208433&r1=208432&r2=208433&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/FileArchive.cpp (original)
+++ lld/trunk/lib/ReaderWriter/FileArchive.cpp Fri May  9 11:47:20 2014
@@ -97,16 +97,6 @@ public:
     return _absoluteAtoms;
   }
 
-  /// Returns a set of all defined symbols in the archive.
-  std::set<StringRef> getDefinedSymbols() const override {
-    std::set<StringRef> ret;
-    for (const auto &e : _symbolMemberMap) {
-      StringRef sym = e.first;
-      ret.insert(sym);
-    }
-    return ret;
-  }
-
 protected:
   error_code
   instantiateMember(Archive::child_iterator member,

Modified: lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h?rev=208433&r1=208432&r2=208433&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h Fri May  9 11:47:20 2014
@@ -13,9 +13,6 @@
 #include "lld/ReaderWriter/PECOFFLinkingContext.h"
 #include "lld/ReaderWriter/Simple.h"
 #include "llvm/Support/Allocator.h"
-#include "llvm/Support/Debug.h"
-
-#include <mutex>
 
 namespace lld {
 namespace pecoff {
@@ -89,18 +86,6 @@ private:
   atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
 };
 
-class SymbolRenameFile : public SimpleFile {
-public:
-  SymbolRenameFile(StringRef from, StringRef to)
-      : SimpleFile("<symbol-rename>"), _to(*this, to), _from(*this, from, &_to) {
-    addAtom(_from);
-  };
-
-private:
-  COFFUndefinedAtom _to;
-  COFFUndefinedAtom _from;
-};
-
 } // anonymous namespace
 
 // A virtual file containing absolute symbol __ImageBase. __ImageBase (or
@@ -156,51 +141,5 @@ private:
   mutable llvm::BumpPtrAllocator _alloc;
 };
 
-class ExportedSymbolRenameFile : public VirtualArchiveLibraryFile {
-public:
-  ExportedSymbolRenameFile(const PECOFFLinkingContext &ctx)
-      : VirtualArchiveLibraryFile("<export>") {
-    for (const PECOFFLinkingContext::ExportDesc &desc : ctx.getDllExports())
-      _exportedSyms.insert(desc.name);
-  }
-
-  void addResolvableSymbols(ArchiveLibraryFile *archive) {
-    std::lock_guard<std::mutex> lock(_mutex);
-    if (_seen.count(archive) > 0)
-      return;
-    _seen.insert(archive);
-    for (const std::string &sym : archive->getDefinedSymbols())
-      _resolvableSyms.insert(sym);
-  }
-
-  const File *find(StringRef sym, bool dataSymbolOnly) const override {
-    if (_exportedSyms.count(sym) == 0)
-      return nullptr;
-    std::string expsym = sym;
-    expsym.append("@");
-    auto it = _resolvableSyms.lower_bound(expsym);
-    for (auto e = _resolvableSyms.end(); it != e; ++it) {
-      if (!StringRef(*it).startswith(expsym))
-        return nullptr;
-      if (it->size() == expsym.size())
-        continue;
-      StringRef suffix = it->substr(expsym.size());
-      bool digitSuffix =
-          suffix.find_first_not_of("0123456789") == StringRef::npos;
-      if (digitSuffix) {
-        return new (_alloc) SymbolRenameFile(sym, *it);
-      }
-    }
-    return nullptr;
-  }
-
-private:
-  std::set<std::string> _exportedSyms;
-  std::set<std::string> _resolvableSyms;
-  std::set<ArchiveLibraryFile *> _seen;
-  mutable std::mutex _mutex;
-  mutable llvm::BumpPtrAllocator _alloc;
-};
-
 } // end namespace pecoff
 } // end namespace lld





More information about the llvm-commits mailing list