diff options
Diffstat (limited to 'lld/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h')
-rw-r--r-- | lld/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h b/lld/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h index e24d86dfa7e..5ff8bc647bd 100644 --- a/lld/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h +++ b/lld/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h @@ -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 |