Weak undefined symbols should not fetch archive members.

llvm-svn: 249160
This commit is contained in:
Rafael Espindola 2015-10-02 17:41:22 +00:00
parent e9021117a1
commit b2a5cafb37
3 changed files with 9 additions and 2 deletions

View File

@ -226,7 +226,7 @@ void SymbolTable::addLazy(Lazy *New) {
if (Sym->Body == New)
return;
SymbolBody *Existing = Sym->Body;
if (Existing->isDefined() || Existing->isLazy())
if (Existing->isDefined() || Existing->isLazy() || Existing->isWeak())
return;
Sym->Body = New;
assert(Existing->isUndefined() && "Unexpected symbol kind.");

View File

@ -0,0 +1,2 @@
.global foo
foo:

View File

@ -1,6 +1,7 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/archive.s -o %t2
# RUN: llvm-ar rcs %tar %t2
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/archive2.s -o %t3
# RUN: llvm-ar rcs %tar %t2 %t3
# RUN: lld -flavor gnu2 %t %tar -o %tout
# RUN: llvm-nm %tout | FileCheck %s
# REQUIRES: x86
@ -9,5 +10,9 @@
.quad end
.weak foo
.quad foo
# CHECK: T _start
# CHECK: T end
# CHECK: w foo