1@ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
2@ RUN:   | llvm-readobj -S --sd --sr --symbols - | FileCheck %s
3
4@ Check the .group section for the function in comdat section.
5
6@ In C++, the instantiation of the template will come with linkonce (or
7@ linkonce_odr) linkage, so that the linker can remove the duplicated
8@ instantiation.  When the exception handling is enabled on those function,
9@ we have to group the corresponding .ARM.extab and .ARM.exidx with the
10@ text section together.
11@
12@ This test case will check the content of .group section.  The section index
13@ of the grouped sections should be recorded in .group section.
14
15	.syntax unified
16	.section	.TEST1,"axG",%progbits,func1,comdat
17	.weak	func1
18	.align	2
19	.type	func1,%function
20func1:
21	.fnstart
22	.save	{r4, lr}
23	push	{r4, lr}
24	.vsave	{d8, d9, d10, d11, d12}
25	vpush	{d8, d9, d10, d11, d12}
26	.pad	#24
27	sub	sp, sp, #24
28
29	add	sp, sp, #24
30	vpop	{d8, d9, d10, d11, d12}
31	pop	{r4, pc}
32
33	.globl	__gxx_personality_v0
34	.personality __gxx_personality_v0
35	.handlerdata
36	.fnend
37
38
39
40@-------------------------------------------------------------------------------
41@ Check the .group section
42@-------------------------------------------------------------------------------
43@ CHECK: Sections [
44@ CHECK:   Section {
45@ CHECK:     Index: 1
46@ CHECK:     Name: .group
47@ CHECK:     Type: SHT_GROUP (0x11)
48@ CHECK:     Flags [ (0x0)
49@ CHECK:     ]
50@ CHECK:     Size: 24
51@ CHECK:     SectionData (
52@-------------------------------------------------------------------------------
53@ These are the section indexes of .TEST1, .ARM.extab.TEST1, .ARM.exidx.TEST1,
54@ .rel.ARM.extab.TEST1, and .rel.ARM.exidx.TEST1.
55@-------------------------------------------------------------------------------
56@ CHECK-NEXT:     0000: 01000000 04000000 05000000 06000000
57@ CHECK-NEXT:     0010: 07000000 08000000
58@ CHECK-NEXT:     )
59@ CHECK:   }
60
61
62@-------------------------------------------------------------------------------
63@ Check the .TEST1 section
64@-------------------------------------------------------------------------------
65@ CHECK:   Section {
66@ CHECK:     Index: 4
67@ CHECK-NEXT:     Name: .TEST1
68@ CHECK:     Type: SHT_PROGBITS (0x1)
69@-------------------------------------------------------------------------------
70@ The flags should contain SHF_GROUP.
71@-------------------------------------------------------------------------------
72@ CHECK:     Flags [ (0x206)
73@ CHECK:       SHF_ALLOC (0x2)
74@ CHECK:       SHF_EXECINSTR (0x4)
75@ CHECK:       SHF_GROUP (0x200)
76@ CHECK:     ]
77@ CHECK:   }
78
79
80@-------------------------------------------------------------------------------
81@ Check the .ARM.extab.TEST1 section
82@-------------------------------------------------------------------------------
83@ CHECK:   Section {
84@ CHECK:     Index: 5
85@ CHECK-NEXT:     Name: .ARM.extab.TEST1
86@ CHECK:     Type: SHT_PROGBITS (0x1)
87@-------------------------------------------------------------------------------
88@ The flags should contain SHF_GROUP.
89@-------------------------------------------------------------------------------
90@ CHECK:     Flags [ (0x202)
91@ CHECK:       SHF_ALLOC (0x2)
92@ CHECK:       SHF_GROUP (0x200)
93@ CHECK:     ]
94@ CHECK:   }
95
96@ CHECK:   Section {
97@ CHECK:     Index: 6
98@ CHECK-NEXT:     Name: .rel.ARM.extab.TEST1
99@ CHECK: }
100
101@-------------------------------------------------------------------------------
102@ Check the .ARM.exidx.TEST1 section
103@-------------------------------------------------------------------------------
104@ CHECK:   Section {
105@ CHECK:     Index: 7
106@ CHECK-NEXT:     Name: .ARM.exidx.TEST1
107@ CHECK:     Type: SHT_ARM_EXIDX (0x70000001)
108@-------------------------------------------------------------------------------
109@ The flags should contain SHF_GROUP.
110@-------------------------------------------------------------------------------
111@ CHECK:     Flags [ (0x282)
112@ CHECK:       SHF_ALLOC (0x2)
113@ CHECK:       SHF_GROUP (0x200)
114@ CHECK:       SHF_LINK_ORDER (0x80)
115@ CHECK:     ]
116@ CHECK:     Link: 4
117@ CHECK:   }
118
119
120@ CHECK:   Section {
121@ CHECK:     Index: 8
122@ CHECK-NEXT:     Name: .rel.ARM.exidx.TEST1
123@ CHECK: }
124
125@ CHECK: ]
126
127@-------------------------------------------------------------------------------
128@ Check symbol func1.  It should be weak binding, and belong to .TEST1 section.
129@-------------------------------------------------------------------------------
130@ CHECK: Symbols [
131@ CHECK:   Symbol {
132@ CHECK:     Name: func1
133@ CHECK:     Binding: Weak (0x2)
134@ CHECK:     Type: Function (0x2)
135@ CHECK:     Section: .TEST1
136@ CHECK:   }
137@ CHECK: ]
138