xref: /llvm-project/lld/test/ELF/wrap-lazy.test (revision 2a04f5c455c83c443c71a86b1cee653b4c791bef)
1# REQUIRES: x86
2
3# RUN: split-file %s %t
4# RUN: llvm-as %t/lazy.ll -o %tlazybitcode.o
5# RUN: llvm-mc -filetype=obj -triple=x86_64-elf %t/dummy.s -o %tdummy.o
6# RUN: llvm-mc -filetype=obj -triple=x86_64-elf %t/lazy.s -o %tlazy.o
7# RUN: llvm-mc -filetype=obj -triple=x86_64-elf %t/ref.s -o %tref.o
8# RUN: llvm-mc -filetype=obj -triple=x86_64-elf %t/weakref.s -o %tweakref.o
9# RUN: ld.lld -shared -o %t1.so %tdummy.o --start-lib %tlazy.o --wrap lazy
10# RUN: llvm-readelf -s %t1.so | FileCheck --check-prefix=NO-LAZY %s
11# RUN: ld.lld -shared -o %t2.so %tdummy.o --start-lib %tlazybitcode.o --wrap lazy
12# RUN: llvm-readelf -s %t2.so | FileCheck --check-prefix=NO-LAZY %s
13# RUN: ld.lld -shared -o %t3.so %tdummy.o --start-lib %tlazy.o -u lazy --wrap lazy
14# RUN: llvm-readelf -s %t3.so | FileCheck --check-prefix=LAZY-DEF %s
15# RUN: ld.lld -shared -o %t4.so %tdummy.o %tlazy.o --wrap lazy
16# RUN: llvm-readelf -s %t4.so | FileCheck --check-prefix=LAZY-DEF %s
17# RUN: ld.lld -shared -o %t5.so %tref.o --start-lib %tlazy.o --wrap lazy
18# RUN: llvm-readelf -s %t5.so | FileCheck --check-prefix=LAZY-DEF %s
19# RUN: ld.lld -shared -o %t6.so %tweakref.o --start-lib %tlazy.o --wrap lazy
20# RUN: llvm-readelf -s %t6.so | FileCheck --check-prefix=LAZY-REF %s
21# RUN: ld.lld -shared -o %t7.so %tweakref.o --start-lib %tlazybitcode.o --wrap lazy
22# RUN: llvm-readelf -s %t7.so | FileCheck --check-prefix=LAZY-REF %s
23# RUN: ld.lld -shared -o %tweakref.so %tweakref.o -soname libweakref.so
24# RUN: ld.lld -shared -o %t8.so %tdummy.o %tweakref.so --start-lib %tlazy.o --wrap lazy
25# RUN: llvm-readelf -s %t8.so | FileCheck --check-prefix=NO-LAZY %s
26
27# NO-LAZY-NOT: lazy
28# NO-LAZY-NOT: __wrap_lazy
29
30# LAZY-DEF-DAG: [[#]] lazy
31# LAZY-DEF-DAG: UND __wrap_lazy
32
33# LAZY-REF-NOT: UND lazy
34# LAZY-REF-DAG: UND __wrap_lazy
35# LAZY-REF-NOT: UND lazy
36
37#--- dummy.s
38.globl dummy
39dummy:
40	retq
41
42#--- lazy.ll
43target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
44target triple = "x86_64-elf"
45define void @lazy() {
46  ret void
47}
48
49#--- lazy.s
50.globl lazy
51lazy:
52	retq
53
54#--- ref.s
55	jmp	lazy
56
57#--- weakref.s
58.weak lazy
59	jmp	lazy
60