2 // RUN
: llvm-mc
-filetype
=obj
--arm-add-build-attributes
-triple
=armv7a-none-linux-gnueabi
%s
-o
%t
3 // RUN
: ld.lld
%t --no-merge-exidx-entries
-o
%t2
--gc-sections
4 // RUN
: llvm-objdump
-d
--triple
=armv7a-none-linux-gnueabi
--no-show-raw-insn
%t2 | FileCheck
%s
5 // RUN
: llvm-objdump
-s
--triple
=armv7a-none-linux-gnueabi
%t2 | FileCheck
--check-prefix
=CHECK-EXIDX
%s
7 /// Test the behavior of
.ARM.exidx sections under garbage collection
8 /// A .ARM.exidx section is live if it has a relocation to a live executable
10 /// A .ARM.exidx section may have a relocation to a .ARM.extab section, if the
11 /// .ARM.exidx is live then the .ARM.extab section is live
14 .section .text.func1, "ax",%progbits
23 .section .text.unusedfunc1, "ax",%progbits
31 /// Unwinding instructions for
.text2 too large for an inline entry ARM.exidx
32 /// entry.
A separate
.ARM.extab section is created to hold the unwind entries
33 /// The
.ARM.exidx table entry has a reference to the .ARM.extab section.
34 .section .text.func2, "ax",%progbits
39 .personality __gxx_personality_v0
44 /// An unused function with
a reference to
a .ARM.extab section. Both should
46 .section .text.unusedfunc2, "ax",%progbits
51 .personality __gxx_personality_v1
53 .section .text.unusedfunc2
56 /// Dummy implementation of personality routines to satisfy reference from
58 .section .text.__gcc_personality_v0, "ax", %progbits
59 .global __gxx_personality_v0
66 .section .text.__gcc_personality_v1, "ax", %progbits
67 .global __gxx_personality_v1
74 .section .text.__aeabi_unwind_cpp_pr0, "ax", %progbits
75 .global __aeabi_unwind_cpp_pr0
76 __aeabi_unwind_cpp_pr0
:
90 /// GC should have only removed unusedfunc1
and unusedfunc2 the personality
91 /// routines are kept alive by references from live
.ARM.exidx and .ARM.extab
93 // CHECK
: Disassembly of section
.text:
95 // CHECK-NEXT
: <_start
>:
96 // CHECK-NEXT
: 2010c
: bl 0x20118 <func1
>
97 // CHECK-NEXT
: 20110: bl 0x2011c <func2
>
98 // CHECK-NEXT
: 20114: bx
lr
100 // CHECK-NEXT
: 20118: bx
lr
102 // CHECK-NEXT
: 2011c
: bx
lr
103 // CHECK
: <__gxx_personality_v0
>:
104 // CHECK-NEXT
: 20120: bx
lr
105 // CHECK
: <__aeabi_unwind_cpp_pr0
>:
106 // CHECK-NEXT
: 20124: bx
lr
108 /// GC should have removed table entries for unusedfunc1
, unusedfunc2
109 /// and __gxx_personality_v1
110 // CHECK-
NOT: unusedfunc1
111 // CHECK-
NOT: unusedfunc2
112 // CHECK-
NOT: __gxx_personality_v1
114 /// CHECK-EXIDX
: Contents of section
.ARM.exidx:
115 /// 100d4
+ 1038 = 1110c
= _start
116 /// 100dc
+ 103c
= 11118 = func1
117 // CHECK-EXIDX-NEXT
: 100d4
38000100 01000000 3c000100
08849780
118 /// 100e4
+ 1038 = 1111c
= func2
(100e8
+ 1c
= 10104 = .ARM.extab)
119 /// 100ec
+ 1034 = 11120 = __gxx_personality_v0
120 // CHECK-EXIDX-NEXT
: 100e4
38000100 1c000000
34000100 01000000
121 /// 100f4 + 1030 = 11018 = __aeabi_unwind_cpp_pr0
122 /// 100fc
+ 102c
= 1101c
= __aeabi_unwind_cpp_pr0
+ sizeof
(__aeabi_unwind_cpp_pr0
)
123 // CHECK-EXIDX-NEXT
: 100f4 30000100 01000000 2c000100
01000000
124 // CHECK-EXIDX-NEXT
: Contents of section
.ARM.extab:
125 /// 10104 + 101c
= 11120 = __gxx_personality_v0
126 // CHECK-EXIDX-NEXT
: 10104 1c000100 b0b0b000