1;RUN: llc -mtriple=armv7-eabi %s -o - | FileCheck %s
2;Test that global variables and functions are assigned to correct sections.
3
4target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
5target triple = "armv7-arm-none-eabi"
6
7@a = global i32 0, align 4 #0
8@b = global i32 1, align 4 #0
9@c = global [4 x i32] zeroinitializer, align 4 #0
10@d = global [5 x i16] zeroinitializer, align 2 #0
11@e = global [6 x i16] [i16 0, i16 0, i16 1, i16 0, i16 0, i16 0], align 2 #0
12@f = constant i32 2, align 4 #0
13@h = global i32 0, align 4 #1
14@i = global i32 0, align 4 #2
15@j = constant i32 4, align 4 #2
16@k = global i32 0, align 4 #2
17@_ZZ3gooE7lstat_h = internal global i32 0, align 4 #2
18@_ZL1g = internal global [2 x i32] zeroinitializer, align 4 #0
19@l = global i32 5, align 4 #3
20@m = constant i32 6, align 4 #3
21@n = global i32 0, align 4
22@o = global i32 6, align 4
23@p = constant i32 7, align 4
24
25; Function Attrs: noinline nounwind
26define i32 @foo() #4 {
27entry:
28  %0 = load i32, i32* @b, align 4
29  ret i32 %0
30}
31
32; Function Attrs: noinline
33define i32 @goo() #5 {
34entry:
35  %call = call i32 @zoo(i32* getelementptr inbounds ([2 x i32], [2 x i32]* @_ZL1g, i32 0, i32 0), i32* @_ZZ3gooE7lstat_h)
36  ret i32 %call
37}
38
39declare i32 @zoo(i32*, i32*) #6
40
41; Function Attrs: noinline nounwind
42define i32 @hoo() #7 {
43entry:
44  %0 = load i32, i32* @b, align 4
45  ret i32 %0
46}
47
48attributes #0 = { "bss-section"="my_bss.1" "data-section"="my_data.1" "rodata-section"="my_rodata.1" }
49attributes #1 = { "data-section"="my_data.1" "rodata-section"="my_rodata.1" }
50attributes #2 = { "bss-section"="my_bss.2" "rodata-section"="my_rodata.1" }
51attributes #3 = { "bss-section"="my_bss.2" "data-section"="my_data.2" "rodata-section"="my_rodata.2" }
52attributes #4 = { noinline nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="preserve-sign,preserve-sign" "disable-tail-calls"="false" "implicit-section-name"="my_text.1" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="true" "no-jump-tables"="false" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a9" "target-features"="+dsp,+fp16,+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" }
53attributes #5 = { noinline "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="preserve-sign,preserve-sign" "disable-tail-calls"="false" "implicit-section-name"="my_text.2" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="true" "no-jump-tables"="false" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a9" "target-features"="+dsp,+fp16,+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" }
54attributes #6 = { "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="preserve-sign,preserve-sign" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a9" "target-features"="+dsp,+fp16,+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" }
55attributes #7 = { noinline nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "denormal-fp-math"="preserve-sign,preserve-sign" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="true" "no-jump-tables"="false" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a9" "target-features"="+dsp,+fp16,+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" }
56
57!llvm.module.flags = !{!0, !1, !2, !3}
58
59!0 = !{i32 1, !"wchar_size", i32 4}
60!1 = !{i32 1, !"static_rwdata", i32 1}
61!2 = !{i32 1, !"enumsize_buildattr", i32 2}
62!3 = !{i32 1, !"armlib_unavailable", i32 0}
63
64;CHECK: 	.section	my_text.1,"ax",%progbits
65;CHECK: 	.type	foo,%function
66;CHECK: foo:
67
68;CHECK: 	.section	my_text.2,"ax",%progbits
69;CHECK: 	.type	goo,%function
70;CHECK: goo:
71
72;CHECK: 	.text
73;CHECK: 	.type	hoo,%function
74;CHECK: hoo:
75
76;CHECK: 	.type	a,%object
77;CHECK: 	.section	my_bss.1,"aw",%nobits
78;CHECK: a:
79
80;CHECK: 	.type	b,%object
81;CHECK: 	.section	my_data.1,"aw",%progbits
82;CHECK: b:
83
84;CHECK: 	.type	c,%object
85;CHECK: 	.section	my_bss.1,"aw",%nobits
86;CHECK: c:
87
88;CHECK: 	.type	d,%object
89;CHECK: d:
90
91;CHECK: 	.type	e,%object
92;CHECK: 	.section	my_data.1,"aw",%progbits
93;CHECK: e:
94
95;CHECK: 	.type	f,%object
96;CHECK: 	.section	my_rodata.1,"a",%progbits
97;CHECK: f:
98
99;CHECK: 	.type	h,%object
100;CHECK: 	.bss
101;CHECK: h:
102
103;CHECK: 	.type	i,%object
104;CHECK: 	.section	my_bss.2,"aw",%nobits
105;CHECK: i:
106
107;CHECK: 	.type	j,%object
108;CHECK: 	.section	my_rodata.1,"a",%progbits
109;CHECK: j:
110
111;CHECK: 	.type	k,%object
112;CHECK: 	.section	my_bss.2,"aw",%nobits
113;CHECK: k:
114
115;CHECK: 	.type	_ZZ3gooE7lstat_h,%object @ @_ZZ3gooE7lstat_h
116;CHECK: _ZZ3gooE7lstat_h:
117
118;CHECK: 	.type	_ZL1g,%object
119;CHECK: 	.section	my_bss.1,"aw",%nobits
120;CHECK: _ZL1g:
121
122;CHECK: 	.type	l,%object
123;CHECK: 	.section	my_data.2,"aw",%progbits
124;CHECK: l:
125
126;CHECK: 	.type	m,%object
127;CHECK: 	.section	my_rodata.2,"a",%progbits
128;CHECK: m:
129
130;CHECK: 	.type	n,%object
131;CHECK: 	.bss
132;CHECK: n:
133
134;CHECK: 	.type	o,%object
135;CHECK: 	.data
136;CHECK: o:
137
138;CHECK: 	.type	p,%object
139;CHECK: 	.section	.rodata,"a",%progbits
140;CHECK: p:
141