Never fetch members for weak undefined symbols.

We were still fetching them when the archive was seen first.

We should experiment with just letting lazy symbols get to compare, it
might be cleaner for ELF.

llvm-svn: 249417
This commit is contained in:
Rafael Espindola 2015-10-06 15:18:50 +00:00
parent 1b3341724c
commit 85a6e0f870
2 changed files with 10 additions and 1 deletions

View File

@ -222,6 +222,12 @@ template <class ELFT> void SymbolTable::resolve(SymbolBody *New) {
if (Lazy *L = dyn_cast<Lazy>(Existing)) { if (Lazy *L = dyn_cast<Lazy>(Existing)) {
if (New->isUndefined()) { if (New->isUndefined()) {
if (New->isWeak()) {
// See the explanation in SymbolTable::addLazy
L->setUsedInRegularObj();
L->setWeak();
return;
}
addMemberFile(L); addMemberFile(L);
return; return;
} }

View File

@ -30,4 +30,7 @@
# RUN: lld -flavor gnu2 %tar %t -o %tout # RUN: lld -flavor gnu2 %tar %t -o %tout
# RUN: llvm-nm %tout | FileCheck --check-prefix=AR-FIRST %s # RUN: llvm-nm %tout | FileCheck --check-prefix=AR-FIRST %s
# AR-FIRST: T _start # AR-FIRST: T _start
# AR-FIRST-NEXT: w bar
# AR-FIRST-NEXT: T end
# AR-FIRST-NEXT: w foo