1# REQUIRES: x86 2# RUN: split-file %s %t 3# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/a.s -o %t/a.o 4# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/def.s -o %t/def.o 5# RUN: ld.lld %t/def.o -o %t/def.so -shared --soname=def 6# RUN: ld.lld %t/a.o %t/def.so -o %t1 --wrap foo 7# RUN: llvm-readelf --dyn-syms %t1 | FileCheck %s 8 9# Test that the dynamic relocation uses foo. We used to produce a 10# relocation with __real_foo. 11 12# CHECK: Symbol table '.dynsym' contains 2 entries: 13# CHECK: NOTYPE LOCAL DEFAULT UND 14# CHECK-NEXT: NOTYPE GLOBAL DEFAULT UND foo 15 16# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/b.s -o %t/b.o 17# RUN: ld.lld -shared --wrap foo %t/b.o -o %t2.so 18# RUN: llvm-readelf --dyn-syms %t2.so | FileCheck %s --check-prefix=SYM2 19 20# SYM2: Symbol table '.dynsym' contains 4 entries: 21# SYM2: NOTYPE LOCAL DEFAULT UND 22# SYM2-NEXT: NOTYPE WEAK DEFAULT UND foo 23# SYM2-NEXT: NOTYPE WEAK DEFAULT UND __wrap_foo 24# SYM2-NEXT: NOTYPE GLOBAL DEFAULT [[#]] _start 25 26#--- a.s 27.global _start 28_start: 29 callq __real_foo@plt 30 31#--- def.s 32.globl foo 33foo: 34 35#--- b.s 36.weak foo 37.weak __real_foo 38.global _start 39_start: 40 call __real_foo@plt 41 call foo@plt 42