[PATCH] D18780: ELF: Preserve MustBeInDynSym for bitcode symbols.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 4 17:53:21 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL265371: ELF: Preserve MustBeInDynSym for bitcode symbols. (authored by pcc).
Changed prior to commit:
http://reviews.llvm.org/D18780?vs=52646&id=52649#toc
Repository:
rL LLVM
http://reviews.llvm.org/D18780
Files:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.cpp
lld/trunk/test/ELF/lto/Inputs/dynsym.s
lld/trunk/test/ELF/lto/dynsym.ll
Index: lld/trunk/ELF/Symbols.cpp
===================================================================
--- lld/trunk/ELF/Symbols.cpp
+++ lld/trunk/ELF/Symbols.cpp
@@ -205,8 +205,10 @@
// and in DSOs, so that the symbols in the executable can interrupt
// symbols in the DSO at runtime.
if (isShared() != Other->isShared())
- if (isa<DefinedRegular<ELFT>>(isShared() ? Other : this))
+ if (isa<Defined>(isShared() ? Other : this)) {
+ IsUsedInRegularObj = Other->IsUsedInRegularObj = true;
MustBeInDynSym = Other->MustBeInDynSym = true;
+ }
if (L != R)
return -1;
Index: lld/trunk/ELF/SymbolTable.cpp
===================================================================
--- lld/trunk/ELF/SymbolTable.cpp
+++ lld/trunk/ELF/SymbolTable.cpp
@@ -112,6 +112,8 @@
Sym->Body->setUsedInRegularObj();
if (!Sym->Body->isUndefined() && Body->isUndefined())
continue;
+ if (Sym->Body->MustBeInDynSym)
+ Body->MustBeInDynSym = true;
Sym->Body = Body;
}
ObjectFiles.emplace_back(Obj);
Index: lld/trunk/test/ELF/lto/dynsym.ll
===================================================================
--- lld/trunk/test/ELF/lto/dynsym.ll
+++ lld/trunk/test/ELF/lto/dynsym.ll
@@ -0,0 +1,25 @@
+; REQUIRES: x86
+; RUN: llvm-mc -filetype=obj -o %t.o %p/Inputs/dynsym.s
+; RUN: ld.lld -m elf_x86_64 %t.o -o %t.so -shared
+; RUN: llvm-as %s -o %t2.o
+; RUN: ld.lld -m elf_x86_64 %t2.o %t.so -o %t
+; RUN: llvm-readobj -dyn-symbols %t | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @_start() {
+ call void @foo()
+ ret void
+}
+
+; CHECK: Name: foo
+; CHECK-NEXT: Value:
+; CHECK-NEXT: Size:
+; CHECK-NEXT: Binding:
+; CHECK-NEXT: Type:
+; CHECK-NEXT: Other:
+; CHECK-NEXT: Section: .text
+define void @foo() {
+ ret void
+}
Index: lld/trunk/test/ELF/lto/Inputs/dynsym.s
===================================================================
--- lld/trunk/test/ELF/lto/Inputs/dynsym.s
+++ lld/trunk/test/ELF/lto/Inputs/dynsym.s
@@ -0,0 +1,3 @@
+.globl foo
+foo:
+ret
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18780.52649.patch
Type: text/x-patch
Size: 2106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160405/14ab00b6/attachment.bin>
More information about the llvm-commits
mailing list