Files
clang-p2996/lld/test/ELF/as-needed-weak.s
Rafael Espindola 61376d9bed Bring r329960 back.
The fix is to copy Used when replacing the symbol.

Original message:

Do not keep shared symbols created from garbage-collected eliminated DSOs.

If all references to a DSO happen to be weak, and if the DSO is
specified with --as-needed, the DSO is not added to DT_NEEDED.
If that happens, we also need to eliminate shared symbols created
from the DSO. Otherwise, they become dangling references that point
to non-exsitent DSO.

Fixes https://bugs.llvm.org/show_bug.cgi?id=36991

Differential Revision: https://reviews.llvm.org/D45536

llvm-svn: 330788
2018-04-25 00:29:13 +00:00

23 lines
676 B
ArmAsm

# REQUIRES: x86
# RUN: echo '.globl foo; .type foo, @function; foo:' | \
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t1.o
# RUN: ld.lld -shared -o %t1.so -soname libfoo %t1.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2.o
# RUN: ld.lld -o %t.exe %t2.o --as-needed %t1.so
# RUN: llvm-readelf -dynamic-table -dyn-symbols %t.exe | FileCheck %s
# CHECK-NOT: libfoo
# CHECK: Symbol table of .hash for image:
# CHECK-NEXT: Num Buc: Value Size Type Bind Vis Ndx Name
# CHECK-NEXT: 1 1: 0000000000000000 0 FUNC WEAK DEFAULT UND foo@
.globl _start
.weak foo
_start:
mov $foo, %eax
callq foo