[PATCH] D115041: [ELF] Do not report undefined weak references in shared libraries

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 3 22:46:36 PST 2021


MaskRay added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:1539
       s->exportDynamic = true;
-      if (s->isUndefined() && !s->isWeak() &&
+      if (s->isUndefined() && sym.getBinding() == STB_GLOBAL &&
           config->unresolvedSymbolsInShlib != UnresolvedPolicy::Ignore)
----------------
MaskRay wrote:
> I just noticed that we did not (before this patch) have test coverage for `&& !s->isWeak()`. 
> 
> If the binding check is tested here, Writer.cpp:1978 binding check may be deleted.
`!sym.isWeak()` would be better if we consider STB_GNU_UNIQUE.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115041/new/

https://reviews.llvm.org/D115041



More information about the llvm-commits mailing list