[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / arm-thunk-linkerscript-dotexpr.s
blob20d65a72bce036b00a490101538f756ec25b6fb7
1 // REQUIRES: arm
2 // RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
3 // RUN: echo "SECTIONS { \
4 // RUN: . = SIZEOF_HEADERS; \
5 // RUN: .text_low : { *(.text_low) *(.text_low2) . = . + 0x2000000 ; *(.text_high) *(.text_high2) } \
6 // RUN: } " > %t.script
7 // RUN: ld.lld --no-rosegment --script %t.script %t -o %t2
8 // RUN: llvm-objdump -d %t2 --start-address=0x94 --stop-address=0xbc | FileCheck --check-prefix=CHECK1 %s
9 // RUN: llvm-objdump -d %t2 --start-address=0x20000bc --stop-address=0x20000de | FileCheck --check-prefix=CHECK2 %s
10 // Test that range extension thunks can handle location expressions within
11 // a Section Description
12 .syntax unified
13 .section .text_low, "ax", %progbits
14 .thumb
15 .globl _start
16 _start: bx lr
17 .globl low_target
18 .type low_target, %function
19 low_target:
20 bl high_target
21 bl high_target2
23 .section .text_low2, "ax", %progbits
24 .thumb
25 .globl low_target2
26 .type low_target2, %function
27 low_target2:
28 bl high_target
29 bl high_target2
30 // CHECK1: Disassembly of section .text_low:
31 // CHECK1-EMPTY:
32 // CHECK1-NEXT: <_start>:
33 // CHECK1-NEXT: 94: 70 47 bx lr
34 // CHECK1: <low_target>:
35 // CHECK1-NEXT: 96: 00 f0 03 f8 bl 0xa0 <__Thumbv7ABSLongThunk_high_target>
36 // CHECK1-NEXT: 9a: 00 f0 06 f8 bl 0xaa <__Thumbv7ABSLongThunk_high_target2>
37 // CHECK1: <__Thumbv7ABSLongThunk_high_target>:
38 // CHECK1-NEXT: a0: 40 f2 bd 0c movw r12, #189
39 // CHECK1-NEXT: a4: c0 f2 00 2c movt r12, #512
40 // CHECK1-NEXT: a8: 60 47 bx r12
41 // CHECK1: <__Thumbv7ABSLongThunk_high_target2>:
42 // CHECK1-NEXT: aa: 40 f2 d9 0c movw r12, #217
43 // CHECK1-NEXT: ae: c0 f2 00 2c movt r12, #512
44 // CHECK1-NEXT: b2: 60 47 bx r12
45 // CHECK1: <low_target2>:
46 // CHECK1-NEXT: b4: ff f7 f4 ff bl 0xa0 <__Thumbv7ABSLongThunk_high_target>
47 // CHECK1-NEXT: b8: ff f7 f7 ff bl 0xaa <__Thumbv7ABSLongThunk_high_target2>
49 .section .text_high, "ax", %progbits
50 .thumb
51 .globl high_target
52 .type high_target, %function
53 high_target:
54 bl low_target
55 bl low_target2
57 .section .text_high2, "ax", %progbits
58 .thumb
59 .globl high_target2
60 .type high_target2, %function
61 high_target2:
62 bl low_target
63 bl low_target2
65 // CHECK2: <high_target>:
66 // CHECK2-NEXT: 20000bc: 00 f0 02 f8 bl 0x20000c4 <__Thumbv7ABSLongThunk_low_target>
67 // CHECK2-NEXT: 20000c0: 00 f0 05 f8 bl 0x20000ce <__Thumbv7ABSLongThunk_low_target2>
68 // CHECK2: <__Thumbv7ABSLongThunk_low_target>:
69 // CHECK2-NEXT: 20000c4: 40 f2 97 0c movw r12, #151
70 // CHECK2-NEXT: 20000c8: c0 f2 00 0c movt r12, #0
71 // CHECK2-NEXT: 20000cc: 60 47 bx r12
72 // CHECK2: <__Thumbv7ABSLongThunk_low_target2>:
73 // CHECK2-NEXT: 20000ce: 40 f2 b5 0c movw r12, #181
74 // CHECK2-NEXT: 20000d2: c0 f2 00 0c movt r12, #0
75 // CHECK2-NEXT: 20000d6: 60 47 bx r12
76 // CHECK2: <high_target2>:
77 // CHECK2-NEXT: 20000d8: ff f7 f4 ff bl 0x20000c4 <__Thumbv7ABSLongThunk_low_target>
78 // CHECK2-NEXT: 20000dc: ff f7 f7 ff bl 0x20000ce <__Thumbv7ABSLongThunk_low_target2>