[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / riscv-relax-wrap.s
blob6b507de09be2321586fa95a7c175d026eb6b0a15
1 # REQUIRES: riscv
2 ## Don't forget to update st_value(foo) when foo is defined in another relocatable object file.
4 # RUN: rm -rf %t && split-file %s %t && cd %t
5 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax a.s -o a.o
6 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax b.s -o b.o
7 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax w.s -o w.o
8 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax w2.s -o w2.o
9 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+relax call_foo.s -o call_foo.o
11 # RUN: ld.lld -r b.o w.o -o bw.o
12 # RUN: ld.lld -Ttext=0x10000 a.o bw.o --wrap=foo -o 1
13 # RUN: llvm-objdump -d --no-show-raw-insn 1 | FileCheck %s
15 # RUN: ld.lld -r a.o b.o -o ab.o
16 # RUN: ld.lld -Ttext=0x10000 ab.o w.o --wrap=foo -o 2
17 # RUN: llvm-objdump -d --no-show-raw-insn 2 | FileCheck %s
19 # RUN: ld.lld -Ttext=0x10000 w2.o call_foo.o --wrap=foo -o 3
20 # RUN: llvm-objdump -d --no-show-raw-insn 3 | FileCheck %s --check-prefix=CHECK2
22 # CHECK-LABEL: <_start>:
23 # CHECK-NEXT: 10000: jal {{.*}} <__wrap_foo>
24 # CHECK-EMPTY:
25 # CHECK-NEXT: <foo>:
26 # CHECK-NEXT: 10004: jal {{.*}} <__wrap_foo>
27 # CHECK-EMPTY:
28 # CHECK-NEXT: <__wrap_foo>:
29 # CHECK-NEXT: 10008: jal {{.*}} <foo>
31 # CHECK2-LABEL: <_start>:
32 # CHECK2-NEXT: jal {{.*}} <call_foo>
33 # CHECK2-EMPTY:
34 # CHECK2-NEXT: <__wrap_foo>:
35 # CHECK2-NEXT: ret
36 # CHECK2-EMPTY:
37 # CHECK2-NEXT: <call_foo>:
38 # CHECK2-NEXT: jal {{.*}} <__wrap_foo>
40 #--- a.s
41 .globl _start
42 _start:
43 call foo
45 #--- b.s
46 .globl foo
47 foo:
48 call __wrap_foo
50 #--- w.s
51 .globl __wrap_foo
52 __wrap_foo:
53 call __real_foo
55 #--- w2.s
56 .globl _start, __wrap_foo
57 _start:
58 call call_foo
60 __wrap_foo:
61 ret
63 #--- call_foo.s
64 .globl call_foo
65 call_foo:
66 call foo