34 lines · plain
1# REQUIRES: x862 3# RUN: rm -rf %t && split-file %s %t4# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/main.s -o %t/main.o5# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/wrap.s -o %t/wrap.o6# RUN: ld.lld -shared --soname=fixed %t/wrap.o -o %t/wrap.so7 8## GNU ld does not wrap a defined symbol in an object file9## https://sourceware.org/bugzilla/show_bug.cgi?id=2635810## We choose to wrap defined symbols so that LTO, non-LTO and relocatable links11## behave the same. The 'call bar' in main.o will reference __wrap_bar. We cannot12## easily distinguish the case from cases where bar is not referenced, so we13## export __wrap_bar whenever bar is defined, regardless of whether it is indeed14## referenced.15 16# RUN: ld.lld -shared %t/main.o --wrap bar -o %t1.so17# RUN: llvm-objdump -d %t1.so | FileCheck %s18# RUN: ld.lld %t/main.o %t/wrap.so --wrap bar -o %t119# RUN: llvm-objdump -d %t1 | FileCheck %s20 21# CHECK: <_start>:22# CHECK-NEXT: callq {{.*}} <__wrap_bar@plt>23 24#--- main.s25.globl _start, bar26_start:27 call bar28bar:29 30#--- wrap.s31.globl __wrap_bar32__wrap_bar:33 retq34