150
|
1 // REQUIRES: aarch64
|
|
2 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %s -o %t.o
|
|
3 // RUN: ld.lld --fix-cortex-a53-843419 -z separate-code %t.o -o %t2
|
173
|
4 // RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=2162688 --stop-address=2162700 | FileCheck --check-prefix=CHECK1 %s
|
|
5 // RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=2166784 --stop-address=2166788 | FileCheck --check-prefix=CHECK2 %s
|
|
6 // RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=2170872 --stop-address=2170888 | FileCheck --check-prefix=CHECK3 %s
|
|
7 // RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=69287928 --stop-address=69287944 | FileCheck --check-prefix=CHECK4 %s
|
|
8 // RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=102842376 --stop-address=102842392 | FileCheck --check-prefix=CHECK5 %s
|
|
9 // RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=136384524 --stop-address=136384528 | FileCheck --check-prefix=CHECK6 %s
|
|
10 // RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=136388604 --stop-address=136388628 | FileCheck --check-prefix=CHECK7 %s
|
150
|
11 // Test case for Cortex-A53 Erratum 843419 in an OutputSection exceeding
|
|
12 // the maximum branch range. Both range extension thunks and patches are
|
|
13 // required.
|
|
14
|
173
|
15 // CHECK1: <__AArch64AbsLongThunk_need_thunk_after_patch>:
|
|
16 // CHECK1-NEXT: 210000: 50 00 00 58 ldr x16, 0x210008
|
150
|
17 // CHECK1-NEXT: 210004: 00 02 1f d6 br x16
|
173
|
18 // CHECK1: <$d>:
|
150
|
19 // CHECK1-NEXT: 210008: 0c 10 21 08 .word 0x0821100c
|
173
|
20
|
150
|
21 .section .text.01, "ax", %progbits
|
|
22 .balign 4096
|
|
23 .globl _start
|
|
24 .type _start, %function
|
|
25 _start:
|
|
26 // Expect thunk on pass 2
|
|
27 bl need_thunk_after_patch
|
|
28 .section .text.02, "ax", %progbits
|
|
29 .space 4096 - 12
|
|
30
|
173
|
31 // CHECK2: <_start>:
|
|
32 // CHECK2-NEXT: 211000: 00 fc ff 97 bl 0x210000
|
150
|
33
|
|
34 // Expect patch on pass 1
|
|
35 .section .text.03, "ax", %progbits
|
|
36 .globl t3_ff8_ldr
|
|
37 .type t3_ff8_ldr, %function
|
|
38 t3_ff8_ldr:
|
|
39 adrp x0, dat
|
|
40 ldr x1, [x1, #0]
|
|
41 ldr x0, [x0, :got_lo12:dat]
|
|
42 ret
|
|
43
|
173
|
44 // CHECK3: <t3_ff8_ldr>:
|
150
|
45 // CHECK3-NEXT: 211ff8: e0 00 04 f0 adrp x0, #134344704
|
|
46 // CHECK3-NEXT: 211ffc: 21 00 40 f9 ldr x1, [x1]
|
173
|
47 // CHECK3-NEXT: 212000: 02 08 80 15 b 0x6214008
|
150
|
48 // CHECK3-NEXT: 212004: c0 03 5f d6 ret
|
|
49
|
|
50 .section .text.04, "ax", %progbits
|
|
51 .space 64 * 1024 * 1024
|
|
52
|
|
53 // Expect patch on pass 1
|
|
54 .section .text.05, "ax", %progbits
|
|
55 .balign 4096
|
|
56 .space 4096 - 8
|
|
57 .globl t3_ff8_str
|
|
58 .type t3_ff8_str, %function
|
|
59 t3_ff8_str:
|
|
60 adrp x0, dat
|
|
61 ldr x1, [x1, #0]
|
|
62 str x0, [x0, :got_lo12:dat]
|
|
63 ret
|
|
64
|
173
|
65 // CHECK4: <t3_ff8_str>:
|
150
|
66 // CHECK4-NEXT: 4213ff8: e0 00 02 b0 adrp x0, #67227648
|
|
67 // CHECK4-NEXT: 4213ffc: 21 00 40 f9 ldr x1, [x1]
|
173
|
68 // CHECK4-NEXT: 4214000: 04 00 80 14 b 0x6214010
|
150
|
69 // CHECK4-NEXT: 4214004: c0 03 5f d6 ret
|
|
70
|
|
71 .section .text.06, "ax", %progbits
|
|
72 .space 32 * 1024 * 1024
|
|
73
|
173
|
74 // CHECK5: <__CortexA53843419_211000>:
|
150
|
75 // CHECK5-NEXT: 6214008: 00 00 40 f9 ldr x0, [x0]
|
173
|
76 // CHECK5-NEXT: 621400c: fe f7 7f 16 b 0x212004
|
|
77 // CHECK5: <__CortexA53843419_4213000>:
|
150
|
78 // CHECK5-NEXT: 6214010: 00 00 00 f9 str x0, [x0]
|
173
|
79 // CHECK5-NEXT: 6214014: fc ff 7f 17 b 0x4214004
|
150
|
80
|
|
81 .section .text.07, "ax", %progbits
|
|
82 .space (32 * 1024 * 1024) - 12300
|
|
83
|
|
84 .section .text.08, "ax", %progbits
|
|
85 .globl need_thunk_after_patch
|
|
86 .type need_thunk_after_patch, %function
|
|
87 need_thunk_after_patch:
|
|
88 ret
|
|
89
|
173
|
90 // CHECK6: <need_thunk_after_patch>:
|
150
|
91 // CHECK6-NEXT: 821100c: c0 03 5f d6 ret
|
|
92
|
|
93 // Will need a patch on pass 2
|
|
94 .section .text.09, "ax", %progbits
|
|
95 .space 4096 - 20
|
|
96 .globl t3_ffc_ldr
|
|
97 .type t3_ffc_ldr, %function
|
|
98 t3_ffc_ldr:
|
|
99 adrp x0, dat
|
|
100 ldr x1, [x1, #0]
|
|
101 ldr x0, [x0, :got_lo12:dat]
|
|
102 ret
|
|
103
|
173
|
104 // CHECK7: <t3_ffc_ldr>:
|
150
|
105 // CHECK7-NEXT: 8211ffc: e0 00 00 f0 adrp x0, #126976
|
|
106 // CHECK7-NEXT: 8212000: 21 00 40 f9 ldr x1, [x1]
|
173
|
107 // CHECK7-NEXT: 8212004: 02 00 00 14 b 0x821200c
|
150
|
108 // CHECK7-NEXT: 8212008: c0 03 5f d6 ret
|
173
|
109 // CHECK7: <__CortexA53843419_8212004>:
|
150
|
110 // CHECK7-NEXT: 821200c: 00 00 40 f9 ldr x0, [x0]
|
173
|
111 // CHECK7-NEXT: 8212010: fe ff ff 17 b 0x8212008
|
150
|
112
|
|
113 .section .data
|
|
114 .globl dat
|
|
115 dat: .quad 0
|