From 701c3250e57a428ca3b0d6fca7760f5810230e89 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sun, 28 Feb 2016 21:22:40 +0000 Subject: [PATCH] Remove remaining code for COFF. llvm-svn: 262193 --- lld/include/lld/Core/Alias.h | 100 ------------------------------ lld/include/lld/Core/ArchiveLibraryFile.h | 6 -- lld/include/lld/Core/DefinedAtom.h | 5 -- lld/include/lld/Core/LinkingContext.h | 6 -- lld/include/lld/Core/SharedLibraryAtom.h | 2 - lld/lib/Core/LinkingContext.cpp | 22 ------- lld/lib/ReaderWriter/FileArchive.cpp | 9 --- 7 files changed, 150 deletions(-) delete mode 100644 lld/include/lld/Core/Alias.h diff --git a/lld/include/lld/Core/Alias.h b/lld/include/lld/Core/Alias.h deleted file mode 100644 index fa99929..0000000 --- a/lld/include/lld/Core/Alias.h +++ /dev/null @@ -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 - -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 rawContent() const override { return ArrayRef(); } - - 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(r->target()); - return; - } - } - } - - std::string _name; - mutable const DefinedAtom *_target = nullptr; - llvm::Optional _merge = DefinedAtom::mergeNo; - DeadStripKind _deadStrip = DefinedAtom::deadStripNormal; -}; - -} // end namespace lld - -#endif diff --git a/lld/include/lld/Core/ArchiveLibraryFile.h b/lld/include/lld/Core/ArchiveLibraryFile.h index ff379d4..dfb862e 100644 --- a/lld/include/lld/Core/ArchiveLibraryFile.h +++ b/lld/include/lld/Core/ArchiveLibraryFile.h @@ -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 getDefinedSymbols() { - return std::set(); - } - protected: /// only subclasses of ArchiveLibraryFile can be instantiated ArchiveLibraryFile(StringRef path) : File(path, kindArchiveLibrary) {} diff --git a/lld/include/lld/Core/DefinedAtom.h b/lld/include/lld/Core/DefinedAtom.h index e3ab133..1a2f525 100644 --- a/lld/include/lld/Core/DefinedAtom.h +++ b/lld/include/lld/Core/DefinedAtom.h @@ -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 diff --git a/lld/include/lld/Core/LinkingContext.h b/lld/include/lld/Core/LinkingContext.h index c54ab88..bd13961 100644 --- a/lld/include/lld/Core/LinkingContext.h +++ b/lld/include/lld/Core/LinkingContext.h @@ -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 &getAliases() const { - return _aliasSymbols; - } - std::vector> &getNodes() { return _nodes; } const std::vector> &getNodes() const { return _nodes; } @@ -349,7 +344,6 @@ protected: bool _allowShlibUndefines; OutputFileType _outputFileType; std::vector _deadStripRoots; - std::map _aliasSymbols; std::vector _llvmOptions; StringRefVector _initialUndefinedSymbols; std::vector> _nodes; diff --git a/lld/include/lld/Core/SharedLibraryAtom.h b/lld/include/lld/Core/SharedLibraryAtom.h index 1b0c37c..0f4648f 100644 --- a/lld/include/lld/Core/SharedLibraryAtom.h +++ b/lld/include/lld/Core/SharedLibraryAtom.h @@ -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 diff --git a/lld/lib/Core/LinkingContext.cpp b/lld/lib/Core/LinkingContext.cpp index 567f15d..54d2c51 100644 --- a/lld/lib/Core/LinkingContext.cpp +++ b/lld/lib/Core/LinkingContext.cpp @@ -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::createUndefinedSymbolFile(StringRef filename) const { return std::move(undefinedSymFile); } -std::unique_ptr LinkingContext::createAliasSymbolFile() const { - if (getAliases().empty()) - return nullptr; - std::unique_ptr file( - new SimpleFile("", 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 > &result) const { if (std::unique_ptr file = createEntrySymbolFile()) result.push_back(std::move(file)); if (std::unique_ptr file = createUndefinedSymbolFile()) result.push_back(std::move(file)); - if (std::unique_ptr file = createAliasSymbolFile()) - result.push_back(std::move(file)); } void LinkingContext::addPasses(PassManager &pm) {} diff --git a/lld/lib/ReaderWriter/FileArchive.cpp b/lld/lib/ReaderWriter/FileArchive.cpp index a09923f..7786d11 100644 --- a/lld/lib/ReaderWriter/FileArchive.cpp +++ b/lld/lib/ReaderWriter/FileArchive.cpp @@ -149,15 +149,6 @@ public: return _noAbsoluteAtoms; } - /// Returns a set of all defined symbols in the archive. - std::set getDefinedSymbols() override { - parse(); - std::set 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. -- 2.7.4