[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / arm-thumb-adr.s
blob70f7619816ebd9d0ca13d58c83725daa35e28562
1 // REQUIRES: arm
2 // RUN: llvm-mc --triple=thumbv6m-none-eabi --arm-add-build-attributes -filetype=obj -o %t.o %s
3 // RUN: ld.lld %t.o -o %t
4 // RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
6 /// Test R_ARM_THM_PC8 as used in the adr pseudo instruction. Only positive
7 /// 4-byte aligned offsets are permitted.
8 .section .text.01, "ax", %progbits
9 .balign 4
10 .global _start
11 .thumb_func
12 _start:
13 /// adr r0, target1
14 .inst.n 0xa0ff
15 .reloc 0, R_ARM_THM_PC8, target1
16 /// adr r1, target2
17 .inst.n 0xa1ff
18 .reloc 2, R_ARM_THM_PC8, target2
19 .section .text.02, "ax", %progbits
20 .balign 4
21 .global target1
22 .type target1, %function
23 target1:
24 nop
25 bx lr
26 .section .text.03, "ax", %progbits
27 .balign 4
28 .space 1016
29 .type target2, %function
30 target2:
31 nop
32 bx lr
34 // CHECK: 000200b4 <_start>:
35 // CHECK-NEXT: 200b4: adr r0, #0
36 // CHECK-NEXT: 200b6: adr r1, #1020
38 // CHECK: 000200b8 <target1>:
39 // CHECK-NEXT: 200b8: nop
40 // CHECK-NEXT: 200ba: bx lr
42 // CHECK: 000204b4 <target2>:
43 // CHECK-NEXT: 204b4: nop
44 // CHECK-NEXT: 204b6: bx lr