[lld] r312812 - Handle lazy symbols is computeIsPreemptible.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 8 11:41:49 PDT 2017
Author: rafael
Date: Fri Sep 8 11:41:49 2017
New Revision: 312812
URL: http://llvm.org/viewvc/llvm-project?rev=312812&view=rev
Log:
Handle lazy symbols is computeIsPreemptible.
Added:
lld/trunk/test/ELF/Inputs/dynamic-list-weak-archive.s
lld/trunk/test/ELF/dynamic-list-weak-archive.s
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=312812&r1=312811&r2=312812&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Sep 8 11:41:49 2017
@@ -1240,7 +1240,7 @@ static bool computeIsPreemptible(const S
// executables are automatically exported so that the runtime linker
// can try to resolve them. In that case, they are preemptible. So, we
// return true for an undefined symbols in all cases.
- if (B.isUndefined() || B.isShared())
+ if (!B.isInCurrentDSO())
return true;
// If we have a dynamic list it specifies which local symbols are preemptible.
Added: lld/trunk/test/ELF/Inputs/dynamic-list-weak-archive.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/dynamic-list-weak-archive.s?rev=312812&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/dynamic-list-weak-archive.s (added)
+++ lld/trunk/test/ELF/Inputs/dynamic-list-weak-archive.s Fri Sep 8 11:41:49 2017
@@ -0,0 +1,2 @@
+.globl foo
+foo:
Added: lld/trunk/test/ELF/dynamic-list-weak-archive.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynamic-list-weak-archive.s?rev=312812&view=auto
==============================================================================
--- lld/trunk/test/ELF/dynamic-list-weak-archive.s (added)
+++ lld/trunk/test/ELF/dynamic-list-weak-archive.s Fri Sep 8 11:41:49 2017
@@ -0,0 +1,18 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/dynamic-list-weak-archive.s -o %t2.o
+# RUN: rm -f %t.a
+# RUN: llvm-ar rcs %t.a %t2.o
+# RUN: echo "{ zed; };" > %t.list
+# RUN: ld.lld -shared --dynamic-list %t.list %t1.o %t.a -o %t.so
+# RUN: llvm-readobj -r %t.so | FileCheck %s
+
+# CHECK: Relocations [
+# CHECK-NEXT: Section ({{.*}}) .rela.plt {
+# CHECK-NEXT: 0x2018 R_X86_64_JUMP_SLOT foo
+# CHECK-NEXT: }
+# CHECK-NEXT: ]
+
+callq foo at PLT
+.weak foo
More information about the llvm-commits
mailing list