[lld] r262193 - Remove remaining code for COFF.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 28 13:22:41 PST 2016


Author: ruiu
Date: Sun Feb 28 15:22:40 2016
New Revision: 262193

URL: http://llvm.org/viewvc/llvm-project?rev=262193&view=rev
Log:
Remove remaining code for COFF.

Removed:
    lld/trunk/include/lld/Core/Alias.h
Modified:
    lld/trunk/include/lld/Core/ArchiveLibraryFile.h
    lld/trunk/include/lld/Core/DefinedAtom.h
    lld/trunk/include/lld/Core/LinkingContext.h
    lld/trunk/include/lld/Core/SharedLibraryAtom.h
    lld/trunk/lib/Core/LinkingContext.cpp
    lld/trunk/lib/ReaderWriter/FileArchive.cpp

Removed: lld/trunk/include/lld/Core/Alias.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/Alias.h?rev=262192&view=auto
==============================================================================
--- lld/trunk/include/lld/Core/Alias.h (original)
+++ lld/trunk/include/lld/Core/Alias.h (removed)
@@ -1,100 +0,0 @@
-//===- lld/Core/Alias.h - Alias atoms -------------------------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-///
-/// \file
-/// \brief Provide alias atoms.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_CORE_ALIAS_H
-#define LLD_CORE_ALIAS_H
-
-#include "lld/Core/LLVM.h"
-#include "lld/Core/Simple.h"
-#include "llvm/ADT/Optional.h"
-#include <string>
-
-namespace lld {
-
-// An AliasAtom is a zero-size atom representing an alias for other atom. It has
-// a LayoutAfter reference to the target atom, so that this atom and the target
-// atom will be laid out at the same location in the final result. Initially
-// the target atom is an undefined atom. Resolver will replace it with a defined
-// one.
-//
-// It does not have attributes itself. Most member function calls are forwarded
-// to the target atom.
-class AliasAtom : public SimpleDefinedAtom {
-public:
-  AliasAtom(const File &file, StringRef name)
-      : SimpleDefinedAtom(file), _name(name) {}
-
-  StringRef name() const override { return _name; }
-  uint64_t size() const override { return 0; }
-  ArrayRef<uint8_t> rawContent() const override { return ArrayRef<uint8_t>(); }
-
-  Scope scope() const override {
-    getTarget();
-    return _target ? _target->scope() : scopeLinkageUnit;
-  }
-
-  Merge merge() const override {
-    if (_merge.hasValue())
-      return _merge.getValue();
-    getTarget();
-    return _target ? _target->merge() : mergeNo;
-  }
-
-  void setMerge(Merge val) { _merge = val; }
-
-  ContentType contentType() const override {
-    getTarget();
-    return _target ? _target->contentType() : typeUnknown;
-  }
-
-  Interposable interposable() const override {
-    getTarget();
-    return _target ? _target->interposable() : interposeNo;
-  }
-
-  SectionChoice sectionChoice() const override {
-    getTarget();
-    return _target ? _target->sectionChoice() : sectionBasedOnContent;
-  }
-
-  StringRef customSectionName() const override {
-    getTarget();
-    return _target ? _target->customSectionName() : StringRef("");
-  }
-
-  DeadStripKind deadStrip() const override { return _deadStrip; }
-  void setDeadStrip(DeadStripKind val) { _deadStrip = val; }
-
-private:
-  void getTarget() const {
-    if (_target)
-      return;
-    for (const Reference *r : *this) {
-      if (r->kindNamespace() == lld::Reference::KindNamespace::all &&
-          r->kindValue() == lld::Reference::kindLayoutAfter) {
-        _target = dyn_cast<DefinedAtom>(r->target());
-        return;
-      }
-    }
-  }
-
-  std::string _name;
-  mutable const DefinedAtom *_target = nullptr;
-  llvm::Optional<Merge> _merge = DefinedAtom::mergeNo;
-  DeadStripKind _deadStrip = DefinedAtom::deadStripNormal;
-};
-
-} // end namespace lld
-
-#endif

Modified: lld/trunk/include/lld/Core/ArchiveLibraryFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/ArchiveLibraryFile.h?rev=262193&r1=262192&r2=262193&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/ArchiveLibraryFile.h (original)
+++ lld/trunk/include/lld/Core/ArchiveLibraryFile.h Sun Feb 28 15:22:40 2016
@@ -44,12 +44,6 @@ public:
   // function doesn't affect correctness.
   virtual void preload(TaskGroup &group, StringRef symbolName) {}
 
-  /// Returns a set of all defined symbols in the archive, i.e. all
-  /// resolvable symbol using this file.
-  virtual std::set<StringRef> getDefinedSymbols() {
-    return std::set<StringRef>();
-  }
-
 protected:
   /// only subclasses of ArchiveLibraryFile can be instantiated
   ArchiveLibraryFile(StringRef path) : File(path, kindArchiveLibrary) {}

Modified: lld/trunk/include/lld/Core/DefinedAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/DefinedAtom.h?rev=262193&r1=262192&r2=262193&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/DefinedAtom.h (original)
+++ lld/trunk/include/lld/Core/DefinedAtom.h Sun Feb 28 15:22:40 2016
@@ -216,11 +216,6 @@ public:
   ///
   /// This is used by the linker to order the layout of Atoms so that the
   /// resulting image is stable and reproducible.
-  ///
-  /// Note that this should not be confused with ordinals of exported symbols in
-  /// Windows DLLs. In Windows terminology, ordinals are symbols' export table
-  /// indices (small integers) which can be used instead of symbol names to
-  /// refer items in a DLL.
   virtual uint64_t ordinal() const = 0;
 
   /// \brief the number of bytes of space this atom's content will occupy in the

Modified: lld/trunk/include/lld/Core/LinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=262193&r1=262192&r2=262193&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/LinkingContext.h (original)
+++ lld/trunk/include/lld/Core/LinkingContext.h Sun Feb 28 15:22:40 2016
@@ -203,11 +203,6 @@ public:
 
   void appendLLVMOption(const char *opt) { _llvmOptions.push_back(opt); }
 
-  void addAlias(StringRef from, StringRef to) { _aliasSymbols[from] = to; }
-  const std::map<std::string, std::string> &getAliases() const {
-    return _aliasSymbols;
-  }
-
   std::vector<std::unique_ptr<Node>> &getNodes() { return _nodes; }
   const std::vector<std::unique_ptr<Node>> &getNodes() const { return _nodes; }
 
@@ -349,7 +344,6 @@ protected:
   bool _allowShlibUndefines;
   OutputFileType _outputFileType;
   std::vector<StringRef> _deadStripRoots;
-  std::map<std::string, std::string> _aliasSymbols;
   std::vector<const char *> _llvmOptions;
   StringRefVector _initialUndefinedSymbols;
   std::vector<std::unique_ptr<Node>> _nodes;

Modified: lld/trunk/include/lld/Core/SharedLibraryAtom.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/SharedLibraryAtom.h?rev=262193&r1=262192&r2=262193&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/SharedLibraryAtom.h (original)
+++ lld/trunk/include/lld/Core/SharedLibraryAtom.h Sun Feb 28 15:22:40 2016
@@ -25,9 +25,7 @@ public:
   };
 
   /// Returns shared library name used to load it at runtime.
-  /// On linux that is the DT_NEEDED name.
   /// On Darwin it is the LC_DYLIB_LOAD dylib name.
-  /// On Windows it is the DLL name that to be referred from .idata section.
   virtual StringRef loadName() const = 0;
 
   /// Returns if shared library symbol can be missing at runtime and if

Modified: lld/trunk/lib/Core/LinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/LinkingContext.cpp?rev=262193&r1=262192&r2=262193&view=diff
==============================================================================
--- lld/trunk/lib/Core/LinkingContext.cpp (original)
+++ lld/trunk/lib/Core/LinkingContext.cpp Sun Feb 28 15:22:40 2016
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lld/Core/Alias.h"
 #include "lld/Core/LinkingContext.h"
 #include "lld/Core/Resolver.h"
 #include "lld/Core/Simple.h"
@@ -73,33 +72,12 @@ LinkingContext::createUndefinedSymbolFil
   return std::move(undefinedSymFile);
 }
 
-std::unique_ptr<File> LinkingContext::createAliasSymbolFile() const {
-  if (getAliases().empty())
-    return nullptr;
-  std::unique_ptr<SimpleFile> file(
-    new SimpleFile("<alias>", File::kindUndefinedSymsObject));
-  for (const auto &i : getAliases()) {
-    StringRef from = i.first;
-    StringRef to = i.second;
-    SimpleDefinedAtom *fromAtom = new (_allocator) AliasAtom(*file, from);
-    UndefinedAtom *toAtom = new (_allocator) SimpleUndefinedAtom(*file, to);
-    fromAtom->addReference(Reference::KindNamespace::all,
-                           Reference::KindArch::all, Reference::kindLayoutAfter,
-                           0, toAtom, 0);
-    file->addAtom(*fromAtom);
-    file->addAtom(*toAtom);
-  }
-  return std::move(file);
-}
-
 void LinkingContext::createInternalFiles(
     std::vector<std::unique_ptr<File> > &result) const {
   if (std::unique_ptr<File> file = createEntrySymbolFile())
     result.push_back(std::move(file));
   if (std::unique_ptr<File> file = createUndefinedSymbolFile())
     result.push_back(std::move(file));
-  if (std::unique_ptr<File> file = createAliasSymbolFile())
-    result.push_back(std::move(file));
 }
 
 void LinkingContext::addPasses(PassManager &pm) {}

Modified: lld/trunk/lib/ReaderWriter/FileArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/FileArchive.cpp?rev=262193&r1=262192&r2=262193&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/FileArchive.cpp (original)
+++ lld/trunk/lib/ReaderWriter/FileArchive.cpp Sun Feb 28 15:22:40 2016
@@ -149,15 +149,6 @@ public:
     return _noAbsoluteAtoms;
   }
 
-  /// Returns a set of all defined symbols in the archive.
-  std::set<StringRef> getDefinedSymbols() override {
-    parse();
-    std::set<StringRef> ret;
-    for (const auto &e : _symbolMemberMap)
-      ret.insert(e.first);
-    return ret;
-  }
-
 protected:
   std::error_code doParse() override {
     // Make Archive object which will be owned by FileArchive object.




More information about the llvm-commits mailing list