summaryrefslogtreecommitdiffstats
path: root/lld/lib/Core/Resolver.cpp
diff options
context:
space:
mode:
authorShankar Easwaran <shankare@codeaurora.org>2013-11-21 03:50:59 +0000
committerShankar Easwaran <shankare@codeaurora.org>2013-11-21 03:50:59 +0000
commit178324d903d74382d33f6258074e5c982b17aef1 (patch)
tree42b5618de9d452cc176a39edd793f2937f02794d /lld/lib/Core/Resolver.cpp
parent84fe12d1e954a344b24069367bd5282b6a08dcc7 (diff)
downloadbcm5719-llvm-178324d903d74382d33f6258074e5c982b17aef1.tar.gz
bcm5719-llvm-178324d903d74382d33f6258074e5c982b17aef1.zip
[LinkingContext] Limit shared library undefined atoms to be added.
This adds functionality to limit shared library undefined atoms to be added only once by the Resolver. Dynamic libraries may be processed more than once if they exist within a Group. Also adds a test to verify the change. llvm-svn: 195307
Diffstat (limited to 'lld/lib/Core/Resolver.cpp')
-rw-r--r--lld/lib/Core/Resolver.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp
index cdacc64a7eb..51325896ad7 100644
--- a/lld/lib/Core/Resolver.cpp
+++ b/lld/lib/Core/Resolver.cpp
@@ -75,22 +75,27 @@ void Resolver::doFile(const File &file) {}
void Resolver::handleFile(const File &file) {
uint32_t resolverState = Resolver::StateNoChange;
+ const SharedLibraryFile *sharedLibraryFile =
+ llvm::dyn_cast<SharedLibraryFile>(&file);
+
doFile(file);
for (const DefinedAtom *atom : file.defined()) {
doDefinedAtom(*atom);
resolverState |= StateNewDefinedAtoms;
}
- for (const UndefinedAtom *undefAtom : file.undefined()) {
- doUndefinedAtom(*undefAtom);
- resolverState |= StateNewUndefinedAtoms;
-
- // If the undefined symbol has an alternative name, try to resolve the
- // symbol with the name to give it a second chance. This feature is used for
- // COFF "weak external" symbol.
- if (!_symbolTable.isDefined(undefAtom->name())) {
- if (const UndefinedAtom *fallbackAtom = undefAtom->fallback()) {
- doUndefinedAtom(*fallbackAtom);
- _symbolTable.addReplacement(undefAtom, fallbackAtom);
+ if (!sharedLibraryFile ||
+ _context.addUndefinedAtomsFromSharedLibrary(sharedLibraryFile)) {
+ for (const UndefinedAtom *undefAtom : file.undefined()) {
+ doUndefinedAtom(*undefAtom);
+ resolverState |= StateNewUndefinedAtoms;
+ // If the undefined symbol has an alternative name, try to resolve the
+ // symbol with the name to give it a second chance. This feature is used
+ // for COFF "weak external" symbol.
+ if (!_symbolTable.isDefined(undefAtom->name())) {
+ if (const UndefinedAtom *fallbackAtom = undefAtom->fallback()) {
+ doUndefinedAtom(*fallbackAtom);
+ _symbolTable.addReplacement(undefAtom, fallbackAtom);
+ }
}
}
}
OpenPOWER on IntegriCloud