diff options
| author | Nick Kledzik <kledzik@apple.com> | 2012-04-20 01:24:37 +0000 |
|---|---|---|
| committer | Nick Kledzik <kledzik@apple.com> | 2012-04-20 01:24:37 +0000 |
| commit | 20e652d62701d83c9326ec487afb8d9baa2465ae (patch) | |
| tree | 8dc18f05951b66e71557b37e71a1becb8d33a4a6 /lld/lib/Core/Resolver.cpp | |
| parent | 205ee3b389812e19232f73b46677d132da18017f (diff) | |
| download | bcm5719-llvm-20e652d62701d83c9326ec487afb8d9baa2465ae.tar.gz bcm5719-llvm-20e652d62701d83c9326ec487afb8d9baa2465ae.zip | |
Add way to represent static archives in yaml test cases.
Add SharedLibraryFile and ArchiveLibraryFile subclasses of File.
Add command line options to lld-core to set various ResolverOptions settings
and added lots of test cases to verify the options work.
llvm-svn: 155183
Diffstat (limited to 'lld/lib/Core/Resolver.cpp')
| -rw-r--r-- | lld/lib/Core/Resolver.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp index a758a8628ab..f16a67a94fe 100644 --- a/lld/lib/Core/Resolver.cpp +++ b/lld/lib/Core/Resolver.cpp @@ -137,7 +137,7 @@ void Resolver::addAtoms(const std::vector<const DefinedAtom*>& newAtoms) { void Resolver::resolveUndefines() { const bool searchArchives = _options.searchArchivesToOverrideTentativeDefinitions(); - const bool searchDylibs = + const bool searchSharedLibs = _options.searchSharedLibrariesToOverrideTentativeDefinitions(); // keep looping until no more undefines were added in last loop @@ -154,24 +154,20 @@ void Resolver::resolveUndefines() { } } // search libraries for overrides of common symbols - if (searchArchives || searchDylibs) { - std::vector<const Atom *> tents; - for ( const Atom *tent : tents ) { - if (const DefinedAtom* defAtom = dyn_cast<DefinedAtom>(tent)) { - if ( defAtom->merge() == DefinedAtom::mergeAsTentative ) - tents.push_back(defAtom); - } - } - for ( const Atom *tent : tents ) { - // load for previous tentative may also have loaded - // this tentative, so check again - StringRef tentName = tent->name(); - const Atom *curAtom = _symbolTable.findByName(tentName); + if (searchArchives || searchSharedLibs) { + std::vector<StringRef> tentDefNames; + _symbolTable.tentativeDefinitions(tentDefNames); + for ( StringRef tentDefName : tentDefNames ) { + // Load for previous tentative may also have loaded + // something that overrode this tentative, so always check. + const Atom *curAtom = _symbolTable.findByName(tentDefName); assert(curAtom != nullptr); if (const DefinedAtom* curDefAtom = dyn_cast<DefinedAtom>(curAtom)) { - if (curDefAtom->merge() == DefinedAtom::mergeAsTentative ) - _inputFiles.searchLibraries(tentName, searchDylibs, - true, true, *this); + if (curDefAtom->merge() == DefinedAtom::mergeAsTentative ) { + // Still tentative definition, so look for override. + _inputFiles.searchLibraries(tentDefName, searchSharedLibs, + searchArchives, true, *this); + } } } } |

