1@ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
2@ RUN:   | llvm-readobj -s -sd -sr > %t
3@ RUN: FileCheck %s < %t
4@ RUN: FileCheck --check-prefix=RELOC %s < %t
5
6@ Check the compact pr0 model
7
8	.syntax unified
9
10	.section	.TEST1
11	.globl	func1
12	.align	2
13	.type	func1,%function
14func1:
15	.fnstart
16	.save	{r11, lr}
17	push	{r11, lr}
18	.setfp	r11, sp
19	mov	r11, sp
20	pop	{r11, lr}
21	mov	pc, lr
22	.fnend
23
24	.section	.TEST2
25	.globl	func2
26	.align	2
27	.type	func2,%function
28func2:
29	.fnstart
30	.save	{r11, lr}
31	push	{r11, lr}
32	pop	{r11, pc}
33	.fnend
34
35
36
37@-------------------------------------------------------------------------------
38@ Check .TEST1 section
39@-------------------------------------------------------------------------------
40@ CHECK: Sections [
41@ CHECK:   Section {
42@ CHECK:     Name: .TEST1
43@ CHECK:     SectionData (
44@ CHECK:       0000: 00482DE9 0DB0A0E1 0048BDE8 0EF0A0E1  |.H-......H......|
45@ CHECK:     )
46@ CHECK:   }
47
48
49@-------------------------------------------------------------------------------
50@ Check .ARM.exidx.TEST1 section
51@-------------------------------------------------------------------------------
52@ CHECK:   Section {
53@ CHECK:     Name: .ARM.exidx.TEST1
54@-------------------------------------------------------------------------------
55@ 0x80   = Compact model 0, personality routine: __aeabi_unwind_cpp_pr0
56@ 0x9B   = $sp can be found in $r11
57@ 0x8480 = pop {r11, r14}
58@-------------------------------------------------------------------------------
59@ CHECK:     SectionData (
60@ CHECK:       0000: 00000000 80849B80                    |........|
61@ CHECK:     )
62@ CHECK:   }
63@-------------------------------------------------------------------------------
64@ The first word should be relocated to .TEST1 section.  Besides, there is
65@ another relocation entry for __aeabi_unwind_cpp_pr0, so that the linker
66@ will keep __aeabi_unwind_cpp_pr0.
67@-------------------------------------------------------------------------------
68@ RELOC:   Section {
69@ RELOC:     Name: .rel.ARM.exidx.TEST1
70@ RELOC:     Relocations [
71@ RELOC:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
72@ RELOC:       0x0 R_ARM_PREL31 .TEST1 0x0
73@ RELOC:     ]
74@ RELOC:   }
75
76
77@-------------------------------------------------------------------------------
78@ Check .TEST2 section
79@-------------------------------------------------------------------------------
80@ CHECK:   Section {
81@ CHECK:     Name: .TEST2
82@ CHECK:     SectionData (
83@ CHECK:       0000: 00482DE9 0088BDE8                    |.H-.....|
84@ CHECK:     )
85@ CHECK:   }
86@-------------------------------------------------------------------------------
87@ Check .ARM.exidx.TEST1 section
88@-------------------------------------------------------------------------------
89@ CHECK:   Section {
90@ CHECK:     Name: .ARM.exidx.TEST2
91@-------------------------------------------------------------------------------
92@ 0x80   = Compact model 0, personality routine: __aeabi_unwind_cpp_pr0
93@ 0x8480 = pop {r11, r14}
94@ 0xB0   = finish
95@-------------------------------------------------------------------------------
96@ CHECK:     SectionData (
97@ CHECK:       0000: 00000000 B0808480                    |........|
98@ CHECK:     )
99@ CHECK:   }
100@-------------------------------------------------------------------------------
101@ The first word should be relocated to .TEST2 section.  Besides, there is
102@ another relocation entry for __aeabi_unwind_cpp_pr0, so that the linker
103@ will keep __aeabi_unwind_cpp_pr0.
104@-------------------------------------------------------------------------------
105@ RELOC:   Section {
106@ RELOC:     Name: .rel.ARM.exidx.TEST2
107@ RELOC:     Relocations [
108@ RELOC:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
109@ RELOC:       0x0 R_ARM_PREL31 .TEST2 0x0
110@ RELOC:     ]
111@ RELOC:   }
112