brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · f3784aa Raw
49 lines · plain
1## If the original of a wrapped symbol becomes unreferenced after wrapping, it2## should be dropped from the dynamic symbol table even if defined in a shared3## library.4 5# REQUIRES: x866 7# RUN: rm -rf %t && split-file %s %t8# RUN: llvm-mc -filetype=obj -triple=x86_64-elf %t/original.s -o %t/original.o9# RUN: llvm-mc -filetype=obj -triple=x86_64-elf %t/wrapped.s -o %t/wrapped.o10# RUN: llvm-mc -filetype=obj -triple=x86_64-elf %t/ref.s -o %t/ref.o11# RUN: ld.lld -shared -o %t/liboriginal.so -soname liboriginal.so %t/original.o12# RUN: ld.lld -shared -o %t/liboriginal-and-wrapped.so \13# RUN:   -soname liboriginal-and-wrapped.so %t/original.o %t/wrapped.o14# RUN: ld.lld -shared -o %t/libref-with-original.so %t/ref.o \15# RUN:   --as-needed %t/liboriginal.so --wrap foo16# RUN: llvm-readelf --dynamic --dyn-syms %t/libref-with-original.so | \17# RUN:   FileCheck --check-prefix=ORIGINAL %s18# RUN: ld.lld -shared -o %t/libref-with-original-and-wrapped.so %t/ref.o \19# RUN:   --as-needed %t/liboriginal-and-wrapped.so --wrap foo20# RUN: llvm-readelf --dynamic --dyn-syms %t/libref-with-original-and-wrapped.so | \21# RUN:   FileCheck --check-prefix=ORIGINAL-AND-WRAPPED %s22 23# ORIGINAL-NOT: (NEEDED) Shared library: [liboriginal.so]24# ORIGINAL:      Symbol table '.dynsym' contains 3 entries:25# ORIGINAL:      NOTYPE  LOCAL  DEFAULT   UND26# ORIGINAL-NEXT: NOTYPE  GLOBAL DEFAULT   UND __wrap_foo27# ORIGINAL-NEXT: NOTYPE  GLOBAL DEFAULT     6 ref28 29# ORIGINAL-AND-WRAPPED: (NEEDED) Shared library: [liboriginal-and-wrapped.so]30# ORIGINAL-AND-WRAPPED:      Symbol table '.dynsym' contains 3 entries:31# ORIGINAL-AND-WRAPPED:      NOTYPE  LOCAL  DEFAULT   UND32# ORIGINAL-AND-WRAPPED-NEXT: NOTYPE  GLOBAL DEFAULT   UND __wrap_foo33# ORIGINAL-AND-WRAPPED-NEXT: NOTYPE  GLOBAL DEFAULT     6 ref34 35#--- original.s36.globl foo37foo:38	retq39 40#--- wrapped.s41.globl __wrap_foo42__wrap_foo:43	retq44 45#--- ref.s46.globl ref47ref:48	jmp	foo@plt49