From: naddy Date: Tue, 28 Dec 2021 21:13:20 +0000 (+0000) Subject: lld: do not report undefined weak references in shared libraries X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=afd66fcf82d52c61b4e5c455b75f61a094f5fa13;p=openbsd lld: do not report undefined weak references in shared libraries https://github.com/llvm/llvm-project/commit/52bfd2c1ccd86ff813ee6df5a6700690acdd912f This fixes an issue introduced in D101996. A weak reference in a shared library could be incorrectly reported if there is another library that has a strong reference to the same symbol. Differential Revision: https://reviews.llvm.org/D115041 ok patrick@ kettenis@ --- diff --git a/gnu/llvm/lld/ELF/InputFiles.cpp b/gnu/llvm/lld/ELF/InputFiles.cpp index d5b9efbe18f..ab65571887d 100644 --- a/gnu/llvm/lld/ELF/InputFiles.cpp +++ b/gnu/llvm/lld/ELF/InputFiles.cpp @@ -1567,7 +1567,7 @@ template void SharedFile::parse() { Symbol *s = symtab->addSymbol( Undefined{this, name, sym.getBinding(), sym.st_other, sym.getType()}); s->exportDynamic = true; - if (s->isUndefined() && !s->isWeak() && + if (s->isUndefined() && sym.getBinding() != STB_WEAK && config->unresolvedSymbolsInShlib != UnresolvedPolicy::Ignore) requiredSymbols.push_back(s); continue;