[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / aarch64-feature-bti-plt.s
blob12025c4d4166f6b5431ced3378e0b47a16929de3
1 # REQUIRES: aarch64
3 # RUN: rm -rf %t && split-file %s %t
5 # RUN: llvm-mc --triple=aarch64 --filetype=obj -o %t.o %t/a.s
6 # RUN: ld.lld --shared -T %t/largegap.lds -z force-bti %t.o -o %t.elf
7 # RUN: llvm-objdump -d %t.elf | FileCheck %s
9 #--- largegap.lds
10 SECTIONS {
11 .plt : { *(.plt) }
12 .text.near 0x1000 : AT(0x1000) { *(.text.near) }
13 .text.far 0xf0000000 : AT(0xf0000000) { *(.text.far) }
16 #--- a.s
17 # CHECK: <.plt>:
18 # CHECK-NEXT: bti c
20 ## foo@plt is targeted by a range extension thunk with an indirect branch.
21 ## Add a bti c instruction.
22 # CHECK: <foo@plt>:
23 # CHECK-NEXT: bti c
25 ## biz is not targeted by a thunk using an indirect branch, so no need for bti c.
26 # CHECK: <biz@plt>:
27 # CHECK-NEXT: adrp x16, {{.*}} <func>
29 # CHECK: <bar>:
30 # CHECK-NEXT: bl {{.*}} <foo@plt>
31 # CHECK-NEXT: bl {{.*}} <biz@plt>
33 # CHECK: <func>:
34 # CHECK-NEXT: bl {{.*}} <__AArch64ADRPThunk_foo>
36 # CHECK: <__AArch64ADRPThunk_foo>:
37 # CHECK-NEXT: adrp x16, 0x0 <foo>
38 # CHECK-NEXT: add x16, x16, {{.*}}
39 # CHECK-NEXT: br x16
41 .global foo
42 .global biz
43 .section .text.near, "ax", %progbits
44 bar:
45 .type bar, %function
46 bl foo
47 bl biz
48 ret
50 .section .text.far, "ax", %progbits
51 func:
52 .type func, %function
53 bl foo
54 ret