1@ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
2@ RUN:   | llvm-readobj -s -sd -sr -t | 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:     SectionData (
51@-------------------------------------------------------------------------------
52@ The second, third, and fourth word should correspond to the section index
53@ of .TEST1, .ARM.extab.TEST1, and .ARM.exidx.TEST1.
54@-------------------------------------------------------------------------------
55@ CHECK:       0000: 01000000 05000000 06000000 08000000  |................|
56@ CHECK:     )
57@ CHECK:   }
58
59
60@-------------------------------------------------------------------------------
61@ Check the .TEST1 section
62@-------------------------------------------------------------------------------
63@ CHECK:   Section {
64@ CHECK:     Index: 5
65@ CHECK:     Name: .TEST1
66@ CHECK:     Type: SHT_PROGBITS (0x1)
67@-------------------------------------------------------------------------------
68@ The flags should contain SHF_GROUP.
69@-------------------------------------------------------------------------------
70@ CHECK:     Flags [ (0x206)
71@ CHECK:       SHF_ALLOC (0x2)
72@ CHECK:       SHF_EXECINSTR (0x4)
73@ CHECK:       SHF_GROUP (0x200)
74@ CHECK:     ]
75@ CHECK:   }
76
77
78@-------------------------------------------------------------------------------
79@ Check the .ARM.extab.TEST1 section
80@-------------------------------------------------------------------------------
81@ CHECK:   Section {
82@ CHECK:     Index: 6
83@ CHECK:     Name: .ARM.extab.TEST1
84@ CHECK:     Type: SHT_PROGBITS (0x1)
85@-------------------------------------------------------------------------------
86@ The flags should contain SHF_GROUP.
87@-------------------------------------------------------------------------------
88@ CHECK:     Flags [ (0x202)
89@ CHECK:       SHF_ALLOC (0x2)
90@ CHECK:       SHF_GROUP (0x200)
91@ CHECK:     ]
92@ CHECK:   }
93
94
95@-------------------------------------------------------------------------------
96@ Check the .ARM.exidx.TEST1 section
97@-------------------------------------------------------------------------------
98@ CHECK:   Section {
99@ CHECK:     Index: 8
100@ CHECK:     Name: .ARM.exidx.TEST1
101@ CHECK:     Type: SHT_ARM_EXIDX (0x70000001)
102@-------------------------------------------------------------------------------
103@ The flags should contain SHF_GROUP.
104@-------------------------------------------------------------------------------
105@ CHECK:     Flags [ (0x282)
106@ CHECK:       SHF_ALLOC (0x2)
107@ CHECK:       SHF_GROUP (0x200)
108@ CHECK:       SHF_LINK_ORDER (0x80)
109@ CHECK:     ]
110@ CHECK:     Link: 5
111@ CHECK:   }
112@ CHECK: ]
113
114
115
116@-------------------------------------------------------------------------------
117@ Check symbol func1.  It should be weak binding, and belong to .TEST1 section.
118@-------------------------------------------------------------------------------
119@ CHECK: Symbols [
120@ CHECK:   Symbol {
121@ CHECK:     Name: func1
122@ CHECK:     Binding: Weak (0x2)
123@ CHECK:     Type: Function (0x2)
124@ CHECK:     Section: .TEST1 (0x5)
125@ CHECK:   }
126@ CHECK: ]
127