diff options
| author | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-04-24 19:00:26 +0000 |
|---|---|---|
| committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-04-24 19:00:26 +0000 |
| commit | 9d70cef481bc8c8c98e77a3c54f2edf615eba466 (patch) | |
| tree | 37e9bb7b9537a26578eb963cbc862684e505be36 /lld/lib/Core/Resolver.cpp | |
| parent | ef35f3a68289ba4aa7b787c8393f563864e08798 (diff) | |
| download | bcm5719-llvm-9d70cef481bc8c8c98e77a3c54f2edf615eba466.tar.gz bcm5719-llvm-9d70cef481bc8c8c98e77a3c54f2edf615eba466.zip | |
[Core] Allow weak symbols in shared library when linking.
Patch by Rui Ueyama.
llvm-svn: 180209
Diffstat (limited to 'lld/lib/Core/Resolver.cpp')
| -rw-r--r-- | lld/lib/Core/Resolver.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp index fa3467c473b..8e94929340f 100644 --- a/lld/lib/Core/Resolver.cpp +++ b/lld/lib/Core/Resolver.cpp @@ -315,17 +315,19 @@ bool Resolver::checkUndefines(bool final) { bool foundUndefines = false; for (const UndefinedAtom *undefAtom : undefinedAtoms) { const File &f = undefAtom->file(); - bool isAtomUndefined = false; - if (isa<SharedLibraryFile>(f)) { - if (!_targetInfo.allowShlibUndefines()) { - foundUndefines = true; - isAtomUndefined = true; - } - } else if (undefAtom->canBeNull() == UndefinedAtom::canBeNullNever) { - foundUndefines = true; - isAtomUndefined = true; - } - if (isAtomUndefined && _targetInfo.printRemainingUndefines()) { + + // Skip over a weak symbol. + if (undefAtom->canBeNull() != UndefinedAtom::canBeNullNever) + continue; + + // If this is a library and undefined symbols are allowed on the + // target platform, skip over it. + if (isa<SharedLibraryFile>(f) && _targetInfo.allowShlibUndefines()) + continue; + + // Seems like this symbol is undefined. Warn that. + foundUndefines = true; + if (_targetInfo.printRemainingUndefines()) { llvm::errs() << "Undefined Symbol: " << undefAtom->file().path() << " : " << undefAtom->name() << "\n"; } |

