[TargetVersion] Only enable on RISC-V and AArch64 (#115991)
[llvm-project.git] / bolt / test / AArch64 / veneer-lld-abs.s
blobd10ff46e2cb01680528485e667da7a58ade886ad
1 ## Check that llvm-bolt correctly recognizes long absolute thunks generated
2 ## by LLD.
4 # RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
5 # RUN: %clang %cflags -fno-PIC -no-pie %t.o -o %t.exe -nostdlib \
6 # RUN: -fuse-ld=lld -Wl,-q
7 # RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=CHECK-INPUT %s
8 # RUN: llvm-objcopy --remove-section .rela.mytext %t.exe
9 # RUN: llvm-bolt %t.exe -o %t.bolt --elim-link-veneers=true --lite=0
10 # RUN: llvm-objdump -d -j .text %t.bolt | \
11 # RUN: FileCheck --check-prefix=CHECK-OUTPUT %s
13 .text
14 .balign 4
15 .global foo
16 .type foo, %function
17 foo:
18 adrp x1, foo
19 ret
20 .size foo, .-foo
22 .section ".mytext", "ax"
23 .balign 4
25 .global __AArch64AbsLongThunk_foo
26 .type __AArch64AbsLongThunk_foo, %function
27 __AArch64AbsLongThunk_foo:
28 ldr x16, .L1
29 br x16
30 # CHECK-INPUT-LABEL: <__AArch64AbsLongThunk_foo>:
31 # CHECK-INPUT-NEXT: ldr
32 # CHECK-INPUT-NEXT: br
33 .L1:
34 .quad foo
35 .size __AArch64AbsLongThunk_foo, .-__AArch64AbsLongThunk_foo
37 ## Check that the thunk was removed from .text and _start() calls foo()
38 ## directly.
40 # CHECK-OUTPUT-NOT: __AArch64AbsLongThunk_foo
42 .global _start
43 .type _start, %function
44 _start:
45 # CHECK-INPUT-LABEL: <_start>:
46 # CHECK-OUTPUT-LABEL: <_start>:
47 bl __AArch64AbsLongThunk_foo
48 # CHECK-INPUT-NEXT: bl {{.*}} <__AArch64AbsLongThunk_foo>
49 # CHECK-OUTPUT-NEXT: bl {{.*}} <foo>
50 ret
51 .size _start, .-_start