[lld] r213699 - [PECOFF] Parameterize ResovalbeSymbols object.
Rui Ueyama
ruiu at google.com
Tue Jul 22 15:55:07 PDT 2014
Author: ruiu
Date: Tue Jul 22 17:55:06 2014
New Revision: 213699
URL: http://llvm.org/viewvc/llvm-project?rev=213699&view=rev
Log:
[PECOFF] Parameterize ResovalbeSymbols object.
So that it can be shared by multiple input files.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
Modified: lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h?rev=213699&r1=213698&r2=213699&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h Tue Jul 22 17:55:06 2014
@@ -232,14 +232,13 @@ private:
// next visit.
class ExportedSymbolRenameFile : public impl::VirtualArchiveLibraryFile {
public:
- ExportedSymbolRenameFile(const PECOFFLinkingContext &ctx)
- : VirtualArchiveLibraryFile("<export>") {
+ ExportedSymbolRenameFile(const PECOFFLinkingContext &ctx,
+ std::shared_ptr<ResolvableSymbols> syms)
+ : VirtualArchiveLibraryFile("<export>"), _syms(syms) {
for (const PECOFFLinkingContext::ExportDesc &desc : ctx.getDllExports())
_exportedSyms.insert(desc.name);
}
- void addResolvableSymbols(File *file) { _syms.add(file); }
-
const File *find(StringRef sym, bool dataSymbolOnly) const override {
if (_exportedSyms.count(sym) == 0)
return nullptr;
@@ -254,7 +253,7 @@ private:
// by @number suffix.
bool findSymbolWithAtsignSuffix(std::string sym, std::string &res) const {
sym.append("@");
- const std::set<std::string> &defined = _syms.defined();
+ const std::set<std::string> &defined = _syms->defined();
auto it = defined.lower_bound(sym);
for (auto e = defined.end(); it != e; ++it) {
if (!StringRef(*it).startswith(sym))
@@ -271,7 +270,7 @@ private:
}
std::set<std::string> _exportedSyms;
- mutable ResolvableSymbols _syms;
+ mutable std::shared_ptr<ResolvableSymbols> _syms;
mutable llvm::BumpPtrAllocator _alloc;
};
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=213699&r1=213698&r2=213699&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Tue Jul 22 17:55:06 2014
@@ -119,14 +119,15 @@ bool PECOFFLinkingContext::createImplici
getInputGraph().insertElementAt(std::move(impFileNode),
InputGraph::Position::END);
+ std::shared_ptr<pecoff::ResolvableSymbols> syms(
+ new pecoff::ResolvableSymbols());
+ getInputGraph().registerObserver([=](File *file) { syms->add(file); });
+
// Create a file for dllexported symbols.
std::unique_ptr<SimpleFileNode> exportNode(new SimpleFileNode("<export>"));
- pecoff::ExportedSymbolRenameFile *renameFile =
- new pecoff::ExportedSymbolRenameFile(*this);
+ auto *renameFile = new pecoff::ExportedSymbolRenameFile(*this, syms);
exportNode->appendInputFile(std::unique_ptr<File>(renameFile));
getLibraryGroup()->addFile(std::move(exportNode));
- getInputGraph().registerObserver(
- [=](File *file) { renameFile->addResolvableSymbols(file); });
return true;
}
More information about the llvm-commits
mailing list