Fix another case we used the wrong visibility.

In here too we want the computed output visibility.

llvm-svn: 322586
This commit is contained in:
Rafael Espindola 2018-01-16 19:02:46 +00:00
parent 9f9fb0ba35
commit 7e6aeb614c
3 changed files with 8 additions and 2 deletions

View File

@ -488,8 +488,8 @@ void SymbolTable::addShared(StringRef Name, SharedFile<ELFT> &File,
// An undefined symbol with non default visibility must be satisfied
// in the same DSO.
if (WasInserted || ((S->isUndefined() || S->isLazy()) &&
S->getVisibility() == STV_DEFAULT)) {
if (WasInserted ||
((S->isUndefined() || S->isLazy()) && S->Visibility == STV_DEFAULT)) {
uint8_t Binding = S->Binding;
replaceSymbol<SharedSymbol>(S, File, Name, Sym.getBinding(), Sym.st_other,
Sym.getType(), Sym.st_value, Sym.st_size,

View File

@ -0,0 +1 @@
.quad foo

View File

@ -2,10 +2,15 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/hidden-shared-err.s -o %t2.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/hidden-shared-err2.s -o %t3.o
# RUN: ld.lld -shared -o %t2.so %t2.o
# RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
# RUN: not ld.lld %t2.so %t.o -o %t 2>&1 | FileCheck %s
# RUN: not ld.lld %t.o %t3.o %t2.so -o %t 2>&1 | FileCheck %s
# RUN: not ld.lld %t3.o %t.o %t2.so -o %t 2>&1 | FileCheck %s
# CHECK: undefined symbol: foo
.global _start