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
7 @G1 = common global i32 0
9 ; LINUX: .type G1,@object
12 ; DARWIN: .comm _G1,4,2
17 ; const int G2 __attribute__((weak)) = 42;
18 @G2 = weak_odr constant i32 42
21 ; TODO: linux drops this into .rodata, we drop it into ".gnu.linkonce.r.G2"
23 ; DARWIN: .section __TEXT,__const_coal,coalesced
28 ; int * const G3 = &G1;
29 @G3 = constant i32* @G1
31 ; DARWIN: .section __DATA,__const
36 ; LINUX: .section .rodata,"a",@progbits
39 ; LINUX-SECTIONS: .section .rodata.G3,"a",@progbits
40 ; LINUX-SECTIONS: .globl G3
43 ; _Complex long long const G4 = 34;
44 @G4 = constant {i64,i64} { i64 34, i64 0 }
46 ; DARWIN: .section __TEXT,__const
59 ; DARWIN: .section __DATA,__data
66 @"foo bar" = linkonce global i32 42
68 ; LINUX: .type foo_20_bar,@object
69 ; LINUX:.section .gnu.linkonce.d.foo_20_bar,"aw",@progbits
70 ; LINUX: .weak foo_20_bar
73 ; DARWIN: .section __DATA,__datacoal_nt,coalesced
74 ; DARWIN: .globl "_foo bar"
75 ; DARWIN: .weak_definition "_foo bar"
79 @G6 = weak_odr constant [1 x i8] c"\01"
81 ; LINUX: .type G6,@object
82 ; LINUX: .section .gnu.linkonce.r.G6,"a",@progbits
88 ; DARWIN: .section __TEXT,__const_coal,coalesced
90 ; DARWIN: .weak_definition _G6
95 @G7 = constant [10 x i8] c"abcdefghi\00"
97 ; DARWIN: __TEXT,__cstring,cstring_literals
100 ; DARWIN: .asciz "abcdefghi"
102 ; LINUX: .section .rodata.str1.1,"aMS",@progbits,1
105 ; LINUX: .asciz "abcdefghi"
107 ; LINUX-SECTIONS: .section .rodata.G7,"aMS",@progbits,1
108 ; LINUX-SECTIONS: .globl G7
111 @G8 = constant [4 x i16] [ i16 1, i16 2, i16 3, i16 0 ]
113 ; DARWIN: .section __TEXT,__const
117 ; LINUX: .section .rodata.str2.2,"aMS",@progbits,2
121 @G9 = constant [4 x i32] [ i32 1, i32 2, i32 3, i32 0 ]
126 ; LINUX: .section .rodata.str4.4,"aMS",@progbits,4
131 @G10 = weak global [100 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=0]
134 ; DARWIN: .section __DATA,__datacoal_nt,coalesced
135 ; DARWIN: .globl _G10
136 ; DARWIN: .weak_definition _G10
149 ;; Zero sized objects should round up to 1 byte in zerofill directives.
151 @G11 = global [0 x i32] zeroinitializer
152 @G12 = global {} zeroinitializer
153 @G13 = global { [0 x {}] } zeroinitializer
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