[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / arm-thumb-plt-range-thunk-os.s
blob65e7e4b525926c07470745320b705766fe856b66
1 // REQUIRES: arm
2 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
3 // RUN: ld.lld %t --shared --icf=all -o %t.so
4 // The output file is large, most of it zeroes. We dissassemble only the
5 // parts we need to speed up the test and avoid a large output file
6 // RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x2000000 --stop-address=0x2000018 | FileCheck --check-prefix=CHECK1 %s
7 // RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x2800004 --stop-address=0x2800034 | FileCheck --check-prefix=CHECK2 %s
8 // RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x4000000 --stop-address=0x4000010 | FileCheck --check-prefix=CHECK3 %s
9 // RUN: llvm-objdump --no-print-imm-hex -d %t.so --start-address=0x4000010 --stop-address=0x4000100 --triple=armv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK4 %s
10 // RUN: rm %t.so
11 .syntax unified
12 .thumb
14 // Make sure that we generate a range extension thunk to a PLT entry
15 .section ".text.1", "ax", %progbits
16 .global sym1
17 .global elsewhere
18 .type elsewhere, %function
19 .global preemptible
20 .type preemptible, %function
21 .global far_preemptible
22 .type far_preemptible, %function
23 .global far_nonpreemptible
24 .hidden far_nonpreemptible
25 .type far_nonpreemptible, %function
26 .global far_nonpreemptible_alias
27 .hidden far_nonpreemptible_alias
28 .type far_nonpreemptible_alias, %function
29 sym1:
30 bl elsewhere
31 bl preemptible
32 bx lr
33 preemptible:
34 bl far_preemptible
35 bl far_nonpreemptible
36 bl far_nonpreemptible_alias
37 bx lr
38 // CHECK1: Disassembly of section .text:
39 // CHECK1-EMPTY:
40 // CHECK1-NEXT: <sym1>:
41 // CHECK1-NEXT: 2000000: f000 d800 bl 0x2800004 <__ThumbV7PILongThunk_elsewhere>
42 // CHECK1-NEXT: 2000004: f000 d804 bl 0x2800010 <__ThumbV7PILongThunk_preemptible>
43 // CHECK1-NEXT: 2000008: 4770 bx lr
44 // CHECK1: <preemptible>:
45 // CHECK1-NEXT: 200000a: f000 d807 bl 0x280001c <__ThumbV7PILongThunk_far_preemptible>
46 // CHECK1-NEXT: 200000e: f000 d80b bl 0x2800028 <__ThumbV7PILongThunk_far_nonpreemptible>
47 // CHECK1-NEXT: 2000012: f000 d809 bl 0x2800028 <__ThumbV7PILongThunk_far_nonpreemptible>
48 // CHECK1-NEXT: 2000016: 4770 bx lr
50 .section .text.2, "ax", %progbits
51 .balign 0x0800000
52 bx lr
53 // CHECK2: <__ThumbV7PILongThunk_elsewhere>:
54 // CHECK2-NEXT: 2800004: f240 0c20 movw r12, #32
55 // CHECK2-NEXT: 2800008: f2c0 1c80 movt r12, #384
56 // CHECK2-NEXT: 280000c: 44fc add r12, pc
57 // CHECK2-NEXT: 280000e: 4760 bx r12
58 // CHECK2: <__ThumbV7PILongThunk_preemptible>:
59 // CHECK2-NEXT: 2800010: f240 0c24 movw r12, #36
60 // CHECK2-NEXT: 2800014: f2c0 1c80 movt r12, #384
61 // CHECK2-NEXT: 2800018: 44fc add r12, pc
62 // CHECK2-NEXT: 280001a: 4760 bx r12
63 // CHECK2: <__ThumbV7PILongThunk_far_preemptible>:
64 // CHECK2-NEXT: 280001c: f240 0c28 movw r12, #40
65 // CHECK2-NEXT: 2800020: f2c0 1c80 movt r12, #384
66 // CHECK2-NEXT: 2800024: 44fc add r12, pc
67 // CHECK2-NEXT: 2800026: 4760 bx r12
68 // CHECK2: <__ThumbV7PILongThunk_far_nonpreemptible>:
69 // CHECK2-NEXT: 2800028: f64f 7ccd movw r12, #65485
70 // CHECK2-NEXT: 280002c: f2c0 1c7f movt r12, #383
71 // CHECK2-NEXT: 2800030: 44fc add r12, pc
72 // CHECK2-NEXT: 2800032: 4760 bx r12
74 .section .text.3, "ax", %progbits
75 .balign 0x2000000
76 far_preemptible:
77 far_nonpreemptible:
78 bl elsewhere
80 .section .text.4, "ax", %progbits
81 .balign 0x2000000
82 far_nonpreemptible_alias:
83 bl elsewhere
85 // CHECK3: <far_preemptible>:
86 // CHECK3: 4000000: f000 e816 blx 0x4000030
88 // CHECK4: Disassembly of section .plt:
89 // CHECK4-EMPTY:
90 // CHECK4-NEXT: <.plt>:
91 // CHECK4-NEXT: 4000010: e52de004 str lr, [sp, #-4]!
92 // CHECK4-NEXT: 4000014: e28fe600 add lr, pc, #0, #12
93 // CHECK4-NEXT: 4000018: e28eea20 add lr, lr, #32
94 // CHECK4-NEXT: 400001c: e5bef0a4 ldr pc, [lr, #164]!
95 // CHECK4-NEXT: 4000020: d4 d4 d4 d4 .word 0xd4d4d4d4
96 // CHECK4-NEXT: 4000024: d4 d4 d4 d4 .word 0xd4d4d4d4
97 // CHECK4-NEXT: 4000028: d4 d4 d4 d4 .word 0xd4d4d4d4
98 // CHECK4-NEXT: 400002c: d4 d4 d4 d4 .word 0xd4d4d4d4
99 // CHECK4-NEXT: 4000030: e28fc600 add r12, pc, #0, #12
100 // CHECK4-NEXT: 4000034: e28cca20 add r12, r12, #32
101 // CHECK4-NEXT: 4000038: e5bcf08c ldr pc, [r12, #140]!
102 // CHECK4-NEXT: 400003c: d4 d4 d4 d4 .word 0xd4d4d4d4
103 // CHECK4-NEXT: 4000040: e28fc600 add r12, pc, #0, #12
104 // CHECK4-NEXT: 4000044: e28cca20 add r12, r12, #32
105 // CHECK4-NEXT: 4000048: e5bcf080 ldr pc, [r12, #128]!
106 // CHECK4-NEXT: 400004c: d4 d4 d4 d4 .word 0xd4d4d4d4
107 // CHECK4-NEXT: 4000050: e28fc600 add r12, pc, #0, #12
108 // CHECK4-NEXT: 4000054: e28cca20 add r12, r12, #32
109 // CHECK4-NEXT: 4000058: e5bcf074 ldr pc, [r12, #116]!
110 // CHECK4-NEXT: 400005c: d4 d4 d4 d4 .word 0xd4d4d4d4