[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / aarch64-cortex-a53-843419-thunk.s
blob290fc712e07079b27020327f6b0aace19060d6f3
1 // REQUIRES: aarch64
2 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %s -o %t.o
3 // RUN: echo "SECTIONS { \
4 // RUN: .text1 0x10000 : { *(.text.01) *(.text.02) *(.text.03) } \
5 // RUN: .text2 0x8010000 : { *(.text.04) } } " > %t.script
6 // RUN: ld.lld --script %t.script -fix-cortex-a53-843419 -verbose %t.o -o %t2 \
7 // RUN: 2>&1 | FileCheck -check-prefix=CHECK-PRINT %s
8 // RUN: llvm-objdump --no-show-raw-insn --triple=aarch64-linux-gnu -d %t2 | FileCheck %s
10 /// %t2 is 128 Megabytes, so delete it early.
11 // RUN: rm %t2
13 /// Test cases for Cortex-A53 Erratum 843419 that involve interactions with
14 /// range extension thunks. Both erratum fixes and range extension thunks need
15 /// precise address information and after creation alter address information.
18 .section .text.01, "ax", %progbits
19 .balign 4096
20 .globl _start
21 .type _start, %function
22 _start:
23 bl far_away
24 /// Thunk to far_away, size 16-bytes goes here.
26 .section .text.02, "ax", %progbits
27 .space 4096 - 28
29 /// Erratum sequence will only line up at address 0 modulo 0xffc when
30 /// Thunk is inserted.
31 .section .text.03, "ax", %progbits
32 .globl t3_ff8_ldr
33 .type t3_ff8_ldr, %function
34 t3_ff8_ldr:
35 adrp x0, dat
36 ldr x1, [x1, #0]
37 ldr x0, [x0, :got_lo12:dat]
38 ret
40 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 10FF8 in unpatched output.
41 // CHECK: 0000000000010ff8 <t3_ff8_ldr>:
42 // CHECK-NEXT: adrp x0, 0x8010000
43 // CHECK-NEXT: ldr x1, [x1]
44 // CHECK-NEXT: b 0x11008
45 // CHECK-NEXT: ret
46 // CHECK: 0000000000011008 <__CortexA53843419_11000>:
47 // CHECK-NEXT: ldr x0, [x0, #8]
48 // CHECK-NEXT: b 0x11004
49 .section .text.04, "ax", %progbits
50 .globl far_away
51 .type far_away, function
52 far_away:
53 ret
55 .section .data
56 .globl dat
57 dat: .quad 0