Fix another case of propagating IsUsedRegularObj.

I have an idea on how to clean this up, but lets get the tests passing
first.

llvm-svn: 265374
This commit is contained in:
Rafael Espindola 2016-04-05 01:38:43 +00:00
parent c393c028a9
commit 5cea969dca
3 changed files with 28 additions and 1 deletions

View File

@ -228,7 +228,8 @@ template <class ELFT> void SymbolTable<ELFT>::resolve(SymbolBody *New) {
}
// Found a definition for something also in an archive.
// Ignore the archive definition.
New->setUsedInRegularObj();
if (L->isUsedInRegularObj())
New->setUsedInRegularObj();
Sym->Body = New;
return;
}
@ -282,6 +283,8 @@ template <class ELFT> void SymbolTable<ELFT>::addLazy(Lazy *L) {
template <class ELFT>
void SymbolTable<ELFT>::addMemberFile(Undefined *Undef, Lazy *L) {
if (Undef->isUsedInRegularObj())
L->setUsedInRegularObj();
// Weak undefined symbols should not fetch members from archives.
// If we were to keep old symbol we would not know that an archive member was
// available if a strong undefined symbol shows up afterwards in the link.

View File

@ -0,0 +1,5 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @foo() {
ret void
}

View File

@ -0,0 +1,19 @@
; REQUIRES: x86
; RUN: llvm-as %S/Inputs/archive-3.ll -o %t1.o
; RUN: llvm-as %s -o %t2.o
; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t3 -save-temps
; RUN: llvm-dis %t3.lto.bc -o - | FileCheck %s
; RUN: rm -f %t.a
; RUN: llvm-ar rcs %t.a %t1.o
; RUN: ld.lld -m elf_x86_64 %t.a %t1.o %t2.o -o %t3 -save-temps
; RUN: llvm-dis %t3.lto.bc -o - | FileCheck %s
; CHECK: define internal void @foo() {
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
define void @_start() {
ret void
}