[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / arm-exidx-relocatable.s
blobb82ab2874c12a2c775f8e7f29bd9638cc9faa55b
1 // REQUIRES: arm
2 // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
3 // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %S/Inputs/arm-exidx-cantunwind.s -o %tcantunwind
4 // Check that relocatable link maintains SHF_LINK_ORDER
5 // RUN: ld.lld -r %t %tcantunwind -o %t4
6 // RUN: llvm-readobj -S %t4 | FileCheck %s
8 // Each assembler created .ARM.exidx section has the SHF_LINK_ORDER flag set
9 // with the sh_link containing the section index of the executable section
10 // containing the function it describes. To maintain this property in
11 // relocatable links we pass through the .ARM.exidx section, the section it
12 // it has a sh_link to, and the associated relocation sections uncombined.
14 .syntax unified
15 .section .text, "ax",%progbits
16 .globl _start
17 _start:
18 .fnstart
19 bx lr
20 .cantunwind
21 .fnend
23 .section .text.f1, "ax", %progbits
24 .globl f1
25 f1:
26 .fnstart
27 bx lr
28 .cantunwind
29 .fnend
31 .section .text.f2, "ax", %progbits
32 .globl f2
33 f2:
34 .fnstart
35 bx lr
36 .cantunwind
37 .fnend
38 .globl f3
39 f3:
40 .fnstart
41 bx lr
42 .cantunwind
43 .fnend
45 // CHECK: Index: 1
46 // CHECK-NEXT: Name: .text
48 // CHECK: Name: .ARM.exidx
49 // CHECK-NEXT: Type: SHT_ARM_EXIDX (0x70000001)
50 // CHECK-NEXT: Flags [ (0x82)
51 // CHECK-NEXT: SHF_ALLOC (0x2)
52 // CHECK-NEXT: SHF_LINK_ORDER (0x80)
53 // CHECK-NEXT: ]
54 // CHECK-NEXT: Address
55 // CHECK-NEXT: Offset:
56 // CHECK-NEXT: Size: 24
57 // CHECK-NEXT: Link: 1
60 // CHECK: Index: 4
61 // CHECK-NEXT: Name: .text.f1
63 // CHECK: Name: .ARM.exidx.text.f1
64 // CHECK-NEXT: Type: SHT_ARM_EXIDX (0x70000001)
65 // CHECK-NEXT: Flags [ (0x82)
66 // CHECK-NEXT: SHF_ALLOC (0x2)
67 // CHECK-NEXT: SHF_LINK_ORDER (0x80)
68 // CHECK-NEXT: ]
69 // CHECK-NEXT: Address
70 // CHECK-NEXT: Offset:
71 // CHECK-NEXT: Size: 8
72 // CHECK-NEXT: Link: 4
75 // CHECK: Index: 7
76 // CHECK-NEXT: Name: .text.f2
78 // CHECK: Name: .ARM.exidx.text.f2
79 // CHECK-NEXT: Type: SHT_ARM_EXIDX (0x70000001)
80 // CHECK-NEXT: Flags [ (0x82)
81 // CHECK-NEXT: SHF_ALLOC (0x2)
82 // CHECK-NEXT: SHF_LINK_ORDER (0x80)
83 // CHECK-NEXT: ]
84 // CHECK-NEXT: Address
85 // CHECK-NEXT: Offset:
86 // CHECK-NEXT: Size: 16
87 // CHECK-NEXT: Link: 7
90 // CHECK: Index: 10
91 // CHECK-NEXT: Name: .func1
93 // CHECK: Name: .ARM.exidx.func1
94 // CHECK-NEXT: Type: SHT_ARM_EXIDX (0x70000001)
95 // CHECK-NEXT: Flags [ (0x82)
96 // CHECK-NEXT: SHF_ALLOC (0x2)
97 // CHECK-NEXT: SHF_LINK_ORDER (0x80)
98 // CHECK-NEXT: ]
99 // CHECK-NEXT: Address
100 // CHECK-NEXT: Offset:
101 // CHECK-NEXT: Size: 8
102 // CHECK-NEXT: Link: 10
105 // CHECK: Index: 13
106 // CHECK-NEXT: Name: .func2
108 // CHECK: Name: .ARM.exidx.func2
109 // CHECK-NEXT: Type: SHT_ARM_EXIDX (0x70000001)
110 // CHECK-NEXT: Flags [ (0x82)
111 // CHECK-NEXT: SHF_ALLOC (0x2)
112 // CHECK-NEXT: SHF_LINK_ORDER (0x80)
113 // CHECK-NEXT: ]
114 // CHECK-NEXT: Address
115 // CHECK-NEXT: Offset:
116 // CHECK-NEXT: Size: 8
117 // CHECK-NEXT: Link: 13
120 // CHECK: Index: 16
121 // CHECK-NEXT: Name: .func3
123 // CHECK: Name: .ARM.exidx.func3
124 // CHECK-NEXT: Type: SHT_ARM_EXIDX (0x70000001)
125 // CHECK-NEXT: Flags [ (0x82)
126 // CHECK-NEXT: SHF_ALLOC (0x2)
127 // CHECK-NEXT: SHF_LINK_ORDER (0x80)
128 // CHECK-NEXT: ]
129 // CHECK-NEXT: Address
130 // CHECK-NEXT: Offset:
131 // CHECK-NEXT: Size: 8
132 // CHECK-NEXT: Link: 16