• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=i386-unknown-linux-gnu | FileCheck %s -check-prefix=LINUX
2; RUN: llc < %s -mtriple=i386-apple-darwin9.7 | FileCheck %s -check-prefix=DARWIN
3; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -fdata-sections | FileCheck %s -check-prefix=LINUX-SECTIONS
4
5
6; int G1;
7@G1 = common global i32 0
8
9; LINUX: .type   G1,@object
10; LINUX: .comm  G1,4,4
11
12; DARWIN: .comm	_G1,4,2
13
14
15
16
17; const int G2 __attribute__((weak)) = 42;
18@G2 = weak_odr unnamed_addr constant i32 42
19
20
21; TODO: linux drops this into .rodata, we drop it into ".gnu.linkonce.r.G2"
22
23; DARWIN: .section __TEXT,__const_coal,coalesced
24; DARWIN: _G2:
25; DARWIN:    .long 42
26
27
28; int * const G3 = &G1;
29@G3 = unnamed_addr constant i32* @G1
30
31; DARWIN: .section        __DATA,__const
32; DARWIN: .globl _G3
33; DARWIN: _G3:
34; DARWIN:     .long _G1
35
36; LINUX:   .section        .rodata,"a",@progbits
37; LINUX:   .globl  G3
38
39; LINUX-SECTIONS: .section        .rodata.G3,"a",@progbits
40; LINUX-SECTIONS: .globl  G3
41
42
43; _Complex long long const G4 = 34;
44@G4 = unnamed_addr constant {i64,i64} { i64 34, i64 0 }
45
46; DARWIN: .section        __TEXT,__literal16,16byte_literals
47; DARWIN: _G4:
48; DARWIN:     .long 34
49
50
51; int G5 = 47;
52@G5 = global i32 47
53
54; LINUX: .data
55; LINUX: .globl G5
56; LINUX: G5:
57; LINUX:    .long 47
58
59; DARWIN: .section        __DATA,__data
60; DARWIN: .globl _G5
61; DARWIN: _G5:
62; DARWIN:    .long 47
63
64
65; PR4584
66@"foo bar" = linkonce global i32 42
67
68; LINUX: .type	foo_20_bar,@object
69; LINUX: .section .data.foo_20_bar,"aGw",@progbits,foo_20_bar,comdat
70; LINUX: .weak	foo_20_bar
71; LINUX: foo_20_bar:
72
73; DARWIN: .section		__DATA,__datacoal_nt,coalesced
74; DARWIN: .globl	"_foo bar"
75; DARWIN:	.weak_definition "_foo bar"
76; DARWIN: "_foo bar":
77
78; PR4650
79@G6 = weak_odr unnamed_addr constant [1 x i8] c"\01"
80
81; LINUX:   .type	G6,@object
82; LINUX:   .section	.rodata.G6,"aG",@progbits,G6,comdat
83; LINUX:   .weak	G6
84; LINUX: G6:
85; LINUX:   .byte	1
86; LINUX:   .size	G6, 1
87
88; DARWIN:  .section __TEXT,__const_coal,coalesced
89; DARWIN:  .globl _G6
90; DARWIN:  .weak_definition _G6
91; DARWIN:_G6:
92; DARWIN:  .byte 1
93
94
95@G7 = unnamed_addr constant [10 x i8] c"abcdefghi\00"
96
97; DARWIN:	__TEXT,__cstring,cstring_literals
98; DARWIN:	.globl _G7
99; DARWIN: _G7:
100; DARWIN:	.asciz	"abcdefghi"
101
102; LINUX:	.section	.rodata.str1.1,"aMS",@progbits,1
103; LINUX:	.globl G7
104; LINUX: G7:
105; LINUX:	.asciz	"abcdefghi"
106
107; LINUX-SECTIONS: .section        .rodata.G7,"aMS",@progbits,1
108; LINUX-SECTIONS:	.globl G7
109
110
111@G8 = unnamed_addr constant [4 x i16] [ i16 1, i16 2, i16 3, i16 0 ]
112
113; DARWIN:	.section	__TEXT,__const
114; DARWIN:	.globl _G8
115; DARWIN: _G8:
116
117; LINUX:	.section	.rodata.str2.2,"aMS",@progbits,2
118; LINUX:	.globl G8
119; LINUX:G8:
120
121@G9 = unnamed_addr constant [4 x i32] [ i32 1, i32 2, i32 3, i32 0 ]
122
123; DARWIN:	.globl _G9
124; DARWIN: _G9:
125
126; LINUX:	.section	.rodata.str4.4,"aMS",@progbits,4
127; LINUX:	.globl G9
128; LINUX:G9
129
130
131@G10 = weak global [100 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=0]
132
133
134; DARWIN: 	.section	__DATA,__datacoal_nt,coalesced
135; DARWIN: .globl _G10
136; DARWIN:	.weak_definition _G10
137; DARWIN:	.align	5
138; DARWIN: _G10:
139; DARWIN:	.space	400
140
141; LINUX:	.bss
142; LINUX:	.weak	G10
143; LINUX:	.align	32
144; LINUX: G10:
145; LINUX:	.zero	400
146
147
148
149;; Zero sized objects should round up to 1 byte in zerofill directives.
150; rdar://7886017
151@G11 = global [0 x i32] zeroinitializer
152@G12 = global {} zeroinitializer
153@G13 = global { [0 x {}] } zeroinitializer
154
155; DARWIN: .globl _G11
156; DARWIN: .zerofill __DATA,__common,_G11,1,2
157; DARWIN: .globl _G12
158; DARWIN: .zerofill __DATA,__common,_G12,1,3
159; DARWIN: .globl _G13
160; DARWIN: .zerofill __DATA,__common,_G13,1,3
161