From 9d70cef481bc8c8c98e77a3c54f2edf615eba466 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Wed, 24 Apr 2013 19:00:26 +0000 Subject: [Core] Allow weak symbols in shared library when linking. Patch by Rui Ueyama. llvm-svn: 180209 --- lld/lib/Core/Resolver.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'lld/lib/Core/Resolver.cpp') 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(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(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"; } -- cgit v1.2.3