[ELF] --warn-backref: don't report backref to weak symbols.
authorFangrui Song <maskray@google.com>
Thu, 10 May 2018 23:53:05 +0000 (23:53 +0000)
committerFangrui Song <maskray@google.com>
Thu, 10 May 2018 23:53:05 +0000 (23:53 +0000)
commitc638db5913099d9a46ee507400982b15f60b9ae4
treee095c54ee6a0b01ce6f0f820afdab7915b3caab8
parentf6f7e0940aef0b1d894a1956c101fb63b366fd52
[ELF] --warn-backref: don't report backref to weak symbols.

Summary:
Suppose we visit symbols in this order:

1. weak definition of foo in a lazy object
2. reference of foo
3 (optional). definition of foo

bfd/gold allows 123 but not 12.

Current --warn-backrefs implementation will report both cases as a backward reference. With this change, both 123 (intended) and 12 (unintended) are allowed. The usage of weak definitions usually imply there are also global definitions, so the trade-off is justified.

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

Differential Revision: https://reviews.llvm.org/D46624

llvm-svn: 332061
lld/ELF/SymbolTable.cpp
lld/test/ELF/warn-backrefs.s