[PATCH] D17971: [lto] Don't add variables with private linkage to the symbol table.
Sean Silva via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 8 15:55:51 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262968: [lto] Don't add variables with private linkage to the symbol table. (authored by silvas).
Changed prior to commit:
http://reviews.llvm.org/D17971?vs=50076&id=50085#toc
Repository:
rL LLVM
http://reviews.llvm.org/D17971
Files:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/test/ELF/lto/linkage.ll
Index: lld/trunk/test/ELF/lto/linkage.ll
===================================================================
--- lld/trunk/test/ELF/lto/linkage.ll
+++ lld/trunk/test/ELF/lto/linkage.ll
@@ -0,0 +1,9 @@
+; REQUIRES: x86
+; RUN: llvm-as %s -o %t1.o
+; RUN: ld.lld -m elf_x86_64 %t1.o %t1.o -o %t.so -shared
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Should not encounter a duplicate symbol error for @.str
+ at .str = private unnamed_addr constant [4 x i8] c"Hey\00", align 1
Index: lld/trunk/ELF/InputFiles.cpp
===================================================================
--- lld/trunk/ELF/InputFiles.cpp
+++ lld/trunk/ELF/InputFiles.cpp
@@ -440,10 +440,13 @@
for (const BasicSymbolRef &Sym : Obj->symbols()) {
uint8_t Visibility = STV_DEFAULT;
const GlobalValue *GV = Obj->getSymbolGV(Sym.getRawDataRefImpl());
+ uint32_t Flags = Sym.getFlags();
if (GV) {
if (const Comdat *C = GV->getComdat())
if (!KeptComdats.count(C))
continue;
+ if (!(Flags & object::BasicSymbolRef::SF_Global))
+ continue;
Visibility = getGvVisibility(GV);
}
@@ -453,7 +456,6 @@
StringRef NameRef = Saver.save(StringRef(Name));
SymbolBody *Body;
- uint32_t Flags = Sym.getFlags();
bool IsWeak = Flags & BasicSymbolRef::SF_Weak;
if (Flags & BasicSymbolRef::SF_Undefined) {
Body = new (Alloc) Undefined(NameRef, IsWeak, Visibility, false);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17971.50085.patch
Type: text/x-patch
Size: 1489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160308/a26a8de7/attachment.bin>
More information about the llvm-commits
mailing list