xref: /aosp_15_r20/external/llvm/test/MC/ARM/eh-directive-section-multiple-func.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker@ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
2*9880d681SAndroid Build Coastguard Worker@ RUN:   | llvm-readobj -s -sd -sr -t > %t
3*9880d681SAndroid Build Coastguard Worker@ RUN: FileCheck %s < %t
4*9880d681SAndroid Build Coastguard Worker@ RUN: FileCheck --check-prefix=RELOC %s < %t
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker@ Check whether the section is switched back properly.
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker@ The assembler should switch the section back to the corresponding section
9*9880d681SAndroid Build Coastguard Worker@ after it have emitted the exception handling indices and tables.  In this
10*9880d681SAndroid Build Coastguard Worker@ test case, we are checking whether the section is correct when .section
11*9880d681SAndroid Build Coastguard Worker@ directives is used.
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker@ In this example, func1 and func2 should be defined in .TEST1 section.
14*9880d681SAndroid Build Coastguard Worker@ It is incorrect if the func2 is in .text, .ARM.extab.TEST1, or
15*9880d681SAndroid Build Coastguard Worker@ .ARM.exidx.TEST1 sections.
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker	.syntax	unified
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker	.section	.TEST1
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker	.globl	func1
22*9880d681SAndroid Build Coastguard Worker	.align	2
23*9880d681SAndroid Build Coastguard Worker	.type	func1,%function
24*9880d681SAndroid Build Coastguard Worker	.fnstart
25*9880d681SAndroid Build Coastguard Workerfunc1:
26*9880d681SAndroid Build Coastguard Worker	bx	lr
27*9880d681SAndroid Build Coastguard Worker	.personality	__gxx_personality_v0
28*9880d681SAndroid Build Coastguard Worker	.handlerdata
29*9880d681SAndroid Build Coastguard Worker	.fnend
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker	.globl	func2
32*9880d681SAndroid Build Coastguard Worker	.align	2
33*9880d681SAndroid Build Coastguard Worker	.type	func2,%function
34*9880d681SAndroid Build Coastguard Worker	.fnstart
35*9880d681SAndroid Build Coastguard Workerfunc2:
36*9880d681SAndroid Build Coastguard Worker	bx	lr
37*9880d681SAndroid Build Coastguard Worker	.personality	__gxx_personality_v0
38*9880d681SAndroid Build Coastguard Worker	.handlerdata
39*9880d681SAndroid Build Coastguard Worker	.fnend
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
43*9880d681SAndroid Build Coastguard Worker@ Check the .text section.  This should be empty.
44*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
45*9880d681SAndroid Build Coastguard Worker@ CHECK: Sections [
46*9880d681SAndroid Build Coastguard Worker@ CHECK:   Section {
47*9880d681SAndroid Build Coastguard Worker@ CHECK:     Name: .text
48*9880d681SAndroid Build Coastguard Worker@ CHECK:     SectionData (
49*9880d681SAndroid Build Coastguard Worker@ CHECK:     )
50*9880d681SAndroid Build Coastguard Worker@ CHECK:   }
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
54*9880d681SAndroid Build Coastguard Worker@ Check the .TEST1 section.  There should be two "bx lr" instructions.
55*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
56*9880d681SAndroid Build Coastguard Worker@ CHECK:   Section {
57*9880d681SAndroid Build Coastguard Worker@ CHECK:     Index: 3
58*9880d681SAndroid Build Coastguard Worker@ CHECK-NEXT:     Name: .TEST1
59*9880d681SAndroid Build Coastguard Worker@ CHECK:     SectionData (
60*9880d681SAndroid Build Coastguard Worker@ CHECK:       0000: 1EFF2FE1 1EFF2FE1                    |../.../.|
61*9880d681SAndroid Build Coastguard Worker@ CHECK:     )
62*9880d681SAndroid Build Coastguard Worker@ CHECK:   }
63*9880d681SAndroid Build Coastguard Worker
64*9880d681SAndroid Build Coastguard Worker
65*9880d681SAndroid Build Coastguard Worker
66*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
67*9880d681SAndroid Build Coastguard Worker@ Check the .ARM.extab.TEST1 section.
68*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
69*9880d681SAndroid Build Coastguard Worker@ CHECK:   Section {
70*9880d681SAndroid Build Coastguard Worker@ CHECK:     Name: .ARM.extab.TEST1
71*9880d681SAndroid Build Coastguard Worker@ CHECK:     SectionData (
72*9880d681SAndroid Build Coastguard Worker@ CHECK:       0000: 00000000 B0B0B000 00000000 B0B0B000  |................|
73*9880d681SAndroid Build Coastguard Worker@ CHECK:     )
74*9880d681SAndroid Build Coastguard Worker@ CHECK:   }
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Worker@ RELOC:   Section {
77*9880d681SAndroid Build Coastguard Worker@ RELOC:     Name: .rel.ARM.extab.TEST1
78*9880d681SAndroid Build Coastguard Worker@ RELOC:     Relocations [
79*9880d681SAndroid Build Coastguard Worker@ RELOC:       0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
80*9880d681SAndroid Build Coastguard Worker@ RELOC:       0x8 R_ARM_PREL31 __gxx_personality_v0 0x0
81*9880d681SAndroid Build Coastguard Worker@ RELOC:     ]
82*9880d681SAndroid Build Coastguard Worker@ RELOC:   }
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Worker
85*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
86*9880d681SAndroid Build Coastguard Worker@ Check the .ARM.exidx.TEST1 section.
87*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
88*9880d681SAndroid Build Coastguard Worker@ CHECK:   Section {
89*9880d681SAndroid Build Coastguard Worker@ CHECK:     Name: .ARM.exidx.TEST1
90*9880d681SAndroid Build Coastguard Worker@ CHECK:     Link: 3
91*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
92*9880d681SAndroid Build Coastguard Worker@ The first word should be the offset to .TEST1.
93*9880d681SAndroid Build Coastguard Worker@ The second word should be the offset to .ARM.extab.TEST1
94*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
95*9880d681SAndroid Build Coastguard Worker@ CHECK:     SectionData (
96*9880d681SAndroid Build Coastguard Worker@ CHECK:       0000: 00000000 00000000 04000000 08000000  |................|
97*9880d681SAndroid Build Coastguard Worker@ CHECK:     )
98*9880d681SAndroid Build Coastguard Worker@ CHECK:   }
99*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
100*9880d681SAndroid Build Coastguard Worker@ The first word of each entry should be relocated to .TEST1 section.
101*9880d681SAndroid Build Coastguard Worker@ The second word of each entry should be relocated to
102*9880d681SAndroid Build Coastguard Worker@ .ARM.extab.TESET1 section.
103*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
104*9880d681SAndroid Build Coastguard Worker
105*9880d681SAndroid Build Coastguard Worker@ RELOC:   Section {
106*9880d681SAndroid Build Coastguard Worker@ RELOC:     Name: .rel.ARM.exidx.TEST1
107*9880d681SAndroid Build Coastguard Worker@ RELOC:     Relocations [
108*9880d681SAndroid Build Coastguard Worker@ RELOC:       0x0 R_ARM_PREL31 .TEST1 0x0
109*9880d681SAndroid Build Coastguard Worker@ RELOC:       0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0
110*9880d681SAndroid Build Coastguard Worker@ RELOC:       0x8 R_ARM_PREL31 .TEST1 0x0
111*9880d681SAndroid Build Coastguard Worker@ RELOC:       0xC R_ARM_PREL31 .ARM.extab.TEST1 0x0
112*9880d681SAndroid Build Coastguard Worker@ RELOC:     ]
113*9880d681SAndroid Build Coastguard Worker@ RELOC:   }
114*9880d681SAndroid Build Coastguard Worker
115*9880d681SAndroid Build Coastguard Worker
116*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
117*9880d681SAndroid Build Coastguard Worker@ Check the symbols "func1" and "func2".  They should belong to .TEST1 section.
118*9880d681SAndroid Build Coastguard Worker@-------------------------------------------------------------------------------
119*9880d681SAndroid Build Coastguard Worker@ CHECK: Symbols [
120*9880d681SAndroid Build Coastguard Worker@ CHECK:   Symbol {
121*9880d681SAndroid Build Coastguard Worker@ CHECK:     Name: func1
122*9880d681SAndroid Build Coastguard Worker@ CHECK:     Value: 0x0
123*9880d681SAndroid Build Coastguard Worker@ CHECK:     Size: 0
124*9880d681SAndroid Build Coastguard Worker@ CHECK:     Binding: Global (0x1)
125*9880d681SAndroid Build Coastguard Worker@ CHECK:     Type: Function (0x2)
126*9880d681SAndroid Build Coastguard Worker@ CHECK:     Other: 0
127*9880d681SAndroid Build Coastguard Worker@ CHECK:     Section: .TEST1
128*9880d681SAndroid Build Coastguard Worker@ CHECK:   }
129*9880d681SAndroid Build Coastguard Worker@ CHECK:   Symbol {
130*9880d681SAndroid Build Coastguard Worker@ CHECK:     Name: func2
131*9880d681SAndroid Build Coastguard Worker@ CHECK:     Value: 0x4
132*9880d681SAndroid Build Coastguard Worker@ CHECK:     Size: 0
133*9880d681SAndroid Build Coastguard Worker@ CHECK:     Binding: Global (0x1)
134*9880d681SAndroid Build Coastguard Worker@ CHECK:     Type: Function (0x2)
135*9880d681SAndroid Build Coastguard Worker@ CHECK:     Other: 0
136*9880d681SAndroid Build Coastguard Worker@ CHECK:     Section: .TEST1
137*9880d681SAndroid Build Coastguard Worker@ CHECK:   }
138*9880d681SAndroid Build Coastguard Worker@ CHECK: ]
139