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