[lld] r322586 - Fix another case we used the wrong visibility.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 11:02:46 PST 2018


Author: rafael
Date: Tue Jan 16 11:02:46 2018
New Revision: 322586

URL: http://llvm.org/viewvc/llvm-project?rev=322586&view=rev
Log:
Fix another case we used the wrong visibility.

In here too we want the computed output visibility.

Added:
    lld/trunk/test/ELF/Inputs/hidden-shared-err2.s
Modified:
    lld/trunk/ELF/SymbolTable.cpp
    lld/trunk/test/ELF/hidden-shared-err.s

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=322586&r1=322585&r2=322586&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Jan 16 11:02:46 2018
@@ -488,8 +488,8 @@ void SymbolTable::addShared(StringRef Na
 
   // 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,

Added: lld/trunk/test/ELF/Inputs/hidden-shared-err2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/hidden-shared-err2.s?rev=322586&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/hidden-shared-err2.s (added)
+++ lld/trunk/test/ELF/Inputs/hidden-shared-err2.s Tue Jan 16 11:02:46 2018
@@ -0,0 +1 @@
+.quad foo

Modified: lld/trunk/test/ELF/hidden-shared-err.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/hidden-shared-err.s?rev=322586&r1=322585&r2=322586&view=diff
==============================================================================
--- lld/trunk/test/ELF/hidden-shared-err.s (original)
+++ lld/trunk/test/ELF/hidden-shared-err.s Tue Jan 16 11:02:46 2018
@@ -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




More information about the llvm-commits mailing list