[lld] r322576 - Use the combined visibility when computing dso_local.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 09:34:26 PST 2018


Author: rafael
Date: Tue Jan 16 09:34:26 2018
New Revision: 322576

URL: http://llvm.org/viewvc/llvm-project?rev=322576&view=rev
Log:
Use the combined visibility when computing dso_local.

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.

Modified:
    lld/trunk/ELF/LTO.cpp
    lld/trunk/test/ELF/lto/visibility.ll

Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=322576&r1=322575&r2=322576&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Tue Jan 16 09:34:26 2018
@@ -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);

Modified: lld/trunk/test/ELF/lto/visibility.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/visibility.ll?rev=322576&r1=322575&r2=322576&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/visibility.ll (original)
+++ lld/trunk/test/ELF/lto/visibility.ll Tue Jan 16 09:34:26 2018
@@ -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:12
 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




More information about the llvm-commits mailing list