xref: /llvm-project/llvm/test/CodeGen/ARM/clang-section.ll (revision 5d6d8dcd292e0a107b11d378932eee9c2f9ccfc7)
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
25declare i32 @zoo(ptr, ptr) #6
26
27; Function Attrs: noinline nounwind
28define i32 @hoo() #7 {
29entry:
30  %0 = load i32, ptr @b, align 4
31  ret i32 %0
32}
33
34attributes #0 = { "bss-section"="my_bss.1" "data-section"="my_data.1" "rodata-section"="my_rodata.1" }
35attributes #1 = { "data-section"="my_data.1" "rodata-section"="my_rodata.1" }
36attributes #2 = { "bss-section"="my_bss.2" "rodata-section"="my_rodata.1" }
37attributes #3 = { "bss-section"="my_bss.2" "data-section"="my_data.2" "rodata-section"="my_rodata.2" }
38attributes #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" }
39attributes #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" }
40
41!llvm.module.flags = !{!0, !1, !2, !3}
42
43!0 = !{i32 1, !"wchar_size", i32 4}
44!1 = !{i32 1, !"static_rwdata", i32 1}
45!2 = !{i32 1, !"enumsize_buildattr", i32 2}
46!3 = !{i32 1, !"armlib_unavailable", i32 0}
47
48;CHECK: 	.text
49;CHECK: 	.type	hoo,%function
50;CHECK: hoo:
51
52;CHECK: 	.type	a,%object
53;CHECK: 	.section	my_bss.1,"aw",%nobits
54;CHECK: a:
55
56;CHECK: 	.type	b,%object
57;CHECK: 	.section	my_data.1,"aw",%progbits
58;CHECK: b:
59
60;CHECK: 	.type	c,%object
61;CHECK: 	.section	my_bss.1,"aw",%nobits
62;CHECK: c:
63
64;CHECK: 	.type	d,%object
65;CHECK: d:
66
67;CHECK: 	.type	e,%object
68;CHECK: 	.section	my_data.1,"aw",%progbits
69;CHECK: e:
70
71;CHECK: 	.type	f,%object
72;CHECK: 	.section	my_rodata.1,"a",%progbits
73;CHECK: f:
74
75;CHECK: 	.type	h,%object
76;CHECK: 	.bss
77;CHECK: h:
78
79;CHECK: 	.type	i,%object
80;CHECK: 	.section	my_bss.2,"aw",%nobits
81;CHECK: i:
82
83;CHECK: 	.type	j,%object
84;CHECK: 	.section	my_rodata.1,"a",%progbits
85;CHECK: j:
86
87;CHECK: 	.type	k,%object
88;CHECK: 	.section	my_bss.2,"aw",%nobits
89;CHECK: k:
90
91;CHECK: 	.type	_ZZ3gooE7lstat_h,%object @ @_ZZ3gooE7lstat_h
92;CHECK: _ZZ3gooE7lstat_h:
93
94;CHECK: 	.type	_ZL1g,%object
95;CHECK: 	.section	my_bss.1,"aw",%nobits
96;CHECK: _ZL1g:
97
98;CHECK: 	.type	l,%object
99;CHECK: 	.section	my_data.2,"aw",%progbits
100;CHECK: l:
101
102;CHECK: 	.type	m,%object
103;CHECK: 	.section	my_rodata.2,"a",%progbits
104;CHECK: m:
105
106;CHECK: 	.type	n,%object
107;CHECK: 	.bss
108;CHECK: n:
109
110;CHECK: 	.type	o,%object
111;CHECK: 	.data
112;CHECK: o:
113
114;CHECK: 	.type	p,%object
115;CHECK: 	.section	.rodata,"a",%progbits
116;CHECK: p:
117