116 lines · plain
1// REQUIRES: aarch642// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o3// RUN: ld.lld --fix-cortex-a53-843419 -z separate-code %t.o -o %t24// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=0x210000 --stop-address=0x21000c | FileCheck --check-prefix=CHECK1 %s5// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=0x211000 --stop-address=0x211004 | FileCheck --check-prefix=CHECK2 %s6// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=0x211ff8 --stop-address=0x212008 | FileCheck --check-prefix=CHECK3 %s7// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=0x4213ff8 --stop-address=0x4214008 | FileCheck --check-prefix=CHECK4 %s8// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=0x6214008 --stop-address=0x6214018 | FileCheck --check-prefix=CHECK5 %s9// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=0x821100c --stop-address=0x8211010 | FileCheck --check-prefix=CHECK6 %s10// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=0x8211ffc --stop-address=0x8212014 | FileCheck --check-prefix=CHECK7 %s11// RUN: rm %t.o %t212// Test case for Cortex-A53 Erratum 843419 in an OutputSection exceeding13// the maximum branch range. Both range extension thunks and patches are14// required. 15 16// CHECK1: <__AArch64AbsLongThunk_need_thunk_after_patch>:17// CHECK1-NEXT: 210000: 58000050 ldr x16, 0x21000818// CHECK1-NEXT: 210004: d61f0200 br x1619// CHECK1-NEXT: 210008: 0c 10 21 08 .word 0x0821100c20 21 .section .text.01, "ax", %progbits22 .balign 409623 .globl _start24 .type _start, %function25_start:26 // Expect thunk on pass 227 bl need_thunk_after_patch28 .section .text.02, "ax", %progbits29 .space 4096 - 1230 31// CHECK2: <_start>:32// CHECK2-NEXT: 211000: 97fffc00 bl 0x21000033 34 // Expect patch on pass 135 .section .text.03, "ax", %progbits36 .globl t3_ff8_ldr37 .type t3_ff8_ldr, %function38t3_ff8_ldr:39 adrp x0, dat40 ldr x1, [x1, #0]41 ldr x0, [x0, :got_lo12:dat]42 ret43 44// CHECK3: <t3_ff8_ldr>:45// CHECK3-NEXT: 211ff8: f00400e0 adrp x0, 0x823000046// CHECK3-NEXT: 211ffc: f9400021 ldr x1, [x1]47// CHECK3-NEXT: 212000: 15800802 b 0x621400848// CHECK3-NEXT: 212004: d65f03c0 ret49 50 .section .text.04, "ax", %progbits51 .space 64 * 1024 * 102452 53 // Expect patch on pass 154 .section .text.05, "ax", %progbits55 .balign 409656 .space 4096 - 857 .globl t3_ff8_str58 .type t3_ff8_str, %function59t3_ff8_str:60 adrp x0, dat61 ldr x1, [x1, #0]62 str x0, [x0, :got_lo12:dat]63 ret64 65// CHECK4: <t3_ff8_str>:66// CHECK4-NEXT: 4213ff8: b00200e0 adrp x0, 0x823000067// CHECK4-NEXT: 4213ffc: f9400021 ldr x1, [x1]68// CHECK4-NEXT: 4214000: 14800004 b 0x621401069// CHECK4-NEXT: 4214004: d65f03c0 ret70 71 .section .text.06, "ax", %progbits72 .space 32 * 1024 * 102473 74// CHECK5: <__CortexA53843419_211000>:75// CHECK5-NEXT: 6214008: f9400000 ldr x0, [x0]76// CHECK5-NEXT: 621400c: 167ff7fe b 0x21200477// CHECK5: <__CortexA53843419_4213000>:78// CHECK5-NEXT: 6214010: f9000000 str x0, [x0]79// CHECK5-NEXT: 6214014: 177ffffc b 0x421400480 81 .section .text.07, "ax", %progbits82 .space (32 * 1024 * 1024) - 1230083 84 .section .text.08, "ax", %progbits85 .globl need_thunk_after_patch86 .type need_thunk_after_patch, %function87need_thunk_after_patch:88 ret89 90// CHECK6: <need_thunk_after_patch>:91// CHECK6-NEXT: 821100c: d65f03c0 ret92 93 // Will need a patch on pass 294 .section .text.09, "ax", %progbits95 .space 4096 - 2096 .globl t3_ffc_ldr97 .type t3_ffc_ldr, %function98t3_ffc_ldr:99 adrp x0, dat100 ldr x1, [x1, #0]101 ldr x0, [x0, :got_lo12:dat]102 ret103 104// CHECK7: <t3_ffc_ldr>:105// CHECK7-NEXT: 8211ffc: f00000e0 adrp x0, 0x8230000106// CHECK7-NEXT: 8212000: f9400021 ldr x1, [x1]107// CHECK7-NEXT: 8212004: 14000002 b 0x821200c108// CHECK7-NEXT: 8212008: d65f03c0 ret109// CHECK7: <__CortexA53843419_8212004>:110// CHECK7-NEXT: 821200c: f9400000 ldr x0, [x0]111// CHECK7-NEXT: 8212010: 17fffffe b 0x8212008112 113 .section .data114 .globl dat115dat: .quad 0116