Use the combined visibility when computing dso_local.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 16 Jan 2018 17:34:26 +0000 (17:34 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 16 Jan 2018 17:34:26 +0000 (17:34 +0000)
We track both the combined visibility that will be used for the output
symbol and the original input visibility of the selected symbol.

Almost everything should use the computed visibility.

I will make the names less confusing an a followup patch.

llvm-svn: 322576

lld/ELF/LTO.cpp
lld/test/ELF/lto/visibility.ll

index 57f3b90..ca813f3 100644 (file)
@@ -159,8 +159,7 @@ void BitcodeCompiler::add(BitcodeFile &F) {
                             (R.Prevailing && Sym->includeInDynsym()) ||
                             UsedStartStop.count(ObjSym.getSectionName());
     R.FinalDefinitionInLinkageUnit =
-        Sym->isDefined() &&
-        (IsExecutable || Sym->getVisibility() != STV_DEFAULT);
+        Sym->isDefined() && (IsExecutable || Sym->Visibility != STV_DEFAULT);
 
     if (R.Prevailing)
       undefine(Sym);
index 9acc0e2..5327993 100644 (file)
@@ -1,7 +1,8 @@
 ; REQUIRES: x86
 ; RUN: llvm-as %s -o %t1.o
 ; RUN: llvm-mc -triple=x86_64-pc-linux %p/Inputs/visibility.s -o %t2.o -filetype=obj
-; RUN: ld.lld %t1.o %t2.o -o %t.so -shared
+; RUN: ld.lld %t1.o %t2.o -o %t.so -shared -save-temps
+; RUN: llvm-dis < %t.so.0.2.internalize.bc | FileCheck --check-prefix=IR %s
 ; RUN: llvm-readobj -t %t.so | FileCheck %s
 
 ; CHECK:      Name: g
@@ -28,6 +29,8 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 
 declare hidden void @g()
+; IR: declare dso_local hidden void @g()
+
 define void @f() {
   call void @g()
   ret void