2009-09-09 01:54:48 +02:00
|
|
|
; RUN: llc < %s -mtriple=i386-unknown-linux-gnu | FileCheck %s -check-prefix=LINUX
|
|
|
|
; RUN: llc < %s -mtriple=i386-apple-darwin9.7 | FileCheck %s -check-prefix=DARWIN
|
2010-04-13 02:36:43 +02:00
|
|
|
; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -fdata-sections | FileCheck %s -check-prefix=LINUX-SECTIONS
|
2009-07-25 19:57:37 +02:00
|
|
|
|
2009-07-26 02:51:36 +02:00
|
|
|
|
|
|
|
; int G1;
|
2009-07-25 19:57:37 +02:00
|
|
|
@G1 = common global i32 0
|
|
|
|
|
|
|
|
; LINUX: .type G1,@object
|
|
|
|
; LINUX: .comm G1,4,4
|
|
|
|
|
2009-07-26 02:51:36 +02:00
|
|
|
; DARWIN: .comm _G1,4,2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; const int G2 __attribute__((weak)) = 42;
|
2011-01-16 19:02:57 +01:00
|
|
|
@G2 = weak_odr unnamed_addr constant i32 42
|
2009-07-26 02:51:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
; TODO: linux drops this into .rodata, we drop it into ".gnu.linkonce.r.G2"
|
|
|
|
|
2010-08-30 20:12:35 +02:00
|
|
|
; DARWIN: .section __TEXT,__const_coal,coalesced
|
2009-07-26 02:51:36 +02:00
|
|
|
; DARWIN: _G2:
|
|
|
|
; DARWIN: .long 42
|
2009-07-26 03:24:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
; int * const G3 = &G1;
|
2011-01-16 19:02:57 +01:00
|
|
|
@G3 = unnamed_addr constant i32* @G1
|
2009-07-26 03:24:18 +02:00
|
|
|
|
2009-08-10 03:39:42 +02:00
|
|
|
; DARWIN: .section __DATA,__const
|
2009-07-26 03:24:18 +02:00
|
|
|
; DARWIN: .globl _G3
|
|
|
|
; DARWIN: _G3:
|
|
|
|
; DARWIN: .long _G1
|
|
|
|
|
2011-03-04 21:03:14 +01:00
|
|
|
; LINUX: .section .rodata,"a",@progbits
|
2010-04-13 02:36:43 +02:00
|
|
|
; LINUX: .globl G3
|
|
|
|
|
2011-03-04 21:03:14 +01:00
|
|
|
; LINUX-SECTIONS: .section .rodata.G3,"a",@progbits
|
2010-04-13 02:36:43 +02:00
|
|
|
; LINUX-SECTIONS: .globl G3
|
|
|
|
|
2009-07-26 03:24:18 +02:00
|
|
|
|
|
|
|
; _Complex long long const G4 = 34;
|
2011-01-16 19:02:57 +01:00
|
|
|
@G4 = unnamed_addr constant {i64,i64} { i64 34, i64 0 }
|
2009-07-26 03:24:18 +02:00
|
|
|
|
2011-07-20 01:14:32 +02:00
|
|
|
; DARWIN: .section __TEXT,__literal16,16byte_literals
|
2009-07-26 03:24:18 +02:00
|
|
|
; DARWIN: _G4:
|
2009-07-26 05:06:11 +02:00
|
|
|
; DARWIN: .long 34
|
|
|
|
|
|
|
|
|
|
|
|
; int G5 = 47;
|
|
|
|
@G5 = global i32 47
|
|
|
|
|
|
|
|
; LINUX: .data
|
|
|
|
; LINUX: .globl G5
|
|
|
|
; LINUX: G5:
|
|
|
|
; LINUX: .long 47
|
|
|
|
|
2009-08-10 03:39:42 +02:00
|
|
|
; DARWIN: .section __DATA,__data
|
2009-07-26 05:06:11 +02:00
|
|
|
; DARWIN: .globl _G5
|
|
|
|
; DARWIN: _G5:
|
|
|
|
; DARWIN: .long 47
|
|
|
|
|
2009-07-29 07:20:33 +02:00
|
|
|
|
|
|
|
; PR4584
|
|
|
|
@"foo bar" = linkonce global i32 42
|
|
|
|
|
|
|
|
; LINUX: .type foo_20_bar,@object
|
2011-03-04 21:03:14 +01:00
|
|
|
; LINUX: .section .data.foo_20_bar,"aGw",@progbits,foo_20_bar,comdat
|
2009-07-29 07:20:33 +02:00
|
|
|
; LINUX: .weak foo_20_bar
|
|
|
|
; LINUX: foo_20_bar:
|
|
|
|
|
|
|
|
; DARWIN: .section __DATA,__datacoal_nt,coalesced
|
|
|
|
; DARWIN: .globl "_foo bar"
|
|
|
|
; DARWIN: .weak_definition "_foo bar"
|
|
|
|
; DARWIN: "_foo bar":
|
2009-07-31 18:17:13 +02:00
|
|
|
|
|
|
|
; PR4650
|
2011-01-16 19:02:57 +01:00
|
|
|
@G6 = weak_odr unnamed_addr constant [1 x i8] c"\01"
|
2009-07-31 18:17:13 +02:00
|
|
|
|
|
|
|
; LINUX: .type G6,@object
|
2011-03-04 21:03:14 +01:00
|
|
|
; LINUX: .section .rodata.G6,"aG",@progbits,G6,comdat
|
2009-07-31 18:17:13 +02:00
|
|
|
; LINUX: .weak G6
|
2009-08-13 03:36:44 +02:00
|
|
|
; LINUX: G6:
|
2010-01-23 05:54:10 +01:00
|
|
|
; LINUX: .byte 1
|
2009-08-13 03:36:44 +02:00
|
|
|
; LINUX: .size G6, 1
|
2009-07-31 18:17:13 +02:00
|
|
|
|
2010-08-30 20:12:35 +02:00
|
|
|
; DARWIN: .section __TEXT,__const_coal,coalesced
|
2009-07-31 18:17:13 +02:00
|
|
|
; DARWIN: .globl _G6
|
|
|
|
; DARWIN: .weak_definition _G6
|
|
|
|
; DARWIN:_G6:
|
2010-01-23 05:54:10 +01:00
|
|
|
; DARWIN: .byte 1
|
2009-07-31 18:17:13 +02:00
|
|
|
|
2009-08-04 18:13:09 +02:00
|
|
|
|
2011-01-16 19:02:57 +01:00
|
|
|
@G7 = unnamed_addr constant [10 x i8] c"abcdefghi\00"
|
2009-08-04 18:13:09 +02:00
|
|
|
|
2009-08-10 03:39:42 +02:00
|
|
|
; DARWIN: __TEXT,__cstring,cstring_literals
|
2009-08-04 18:13:09 +02:00
|
|
|
; DARWIN: .globl _G7
|
|
|
|
; DARWIN: _G7:
|
|
|
|
; DARWIN: .asciz "abcdefghi"
|
|
|
|
|
2011-03-04 21:03:14 +01:00
|
|
|
; LINUX: .section .rodata.str1.1,"aMS",@progbits,1
|
2009-08-04 18:13:09 +02:00
|
|
|
; LINUX: .globl G7
|
|
|
|
; LINUX: G7:
|
|
|
|
; LINUX: .asciz "abcdefghi"
|
|
|
|
|
2011-03-04 21:03:14 +01:00
|
|
|
; LINUX-SECTIONS: .section .rodata.G7,"aMS",@progbits,1
|
2010-04-13 02:36:43 +02:00
|
|
|
; LINUX-SECTIONS: .globl G7
|
|
|
|
|
2009-08-04 18:13:09 +02:00
|
|
|
|
2011-01-16 19:02:57 +01:00
|
|
|
@G8 = unnamed_addr constant [4 x i16] [ i16 1, i16 2, i16 3, i16 0 ]
|
2009-08-04 18:13:09 +02:00
|
|
|
|
2010-03-05 23:28:45 +01:00
|
|
|
; DARWIN: .section __TEXT,__const
|
2009-08-04 18:13:09 +02:00
|
|
|
; DARWIN: .globl _G8
|
|
|
|
; DARWIN: _G8:
|
|
|
|
|
2011-03-04 21:03:14 +01:00
|
|
|
; LINUX: .section .rodata.str2.2,"aMS",@progbits,2
|
2009-08-04 18:13:09 +02:00
|
|
|
; LINUX: .globl G8
|
|
|
|
; LINUX:G8:
|
|
|
|
|
2011-01-16 19:02:57 +01:00
|
|
|
@G9 = unnamed_addr constant [4 x i32] [ i32 1, i32 2, i32 3, i32 0 ]
|
2009-08-04 18:13:09 +02:00
|
|
|
|
|
|
|
; DARWIN: .globl _G9
|
|
|
|
; DARWIN: _G9:
|
|
|
|
|
2011-03-04 21:03:14 +01:00
|
|
|
; LINUX: .section .rodata.str4.4,"aMS",@progbits,4
|
2009-08-04 18:13:09 +02:00
|
|
|
; LINUX: .globl G9
|
|
|
|
; LINUX:G9
|
|
|
|
|
|
|
|
|
2010-01-19 04:06:01 +01:00
|
|
|
@G10 = weak global [100 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=0]
|
|
|
|
|
|
|
|
|
|
|
|
; DARWIN: .section __DATA,__datacoal_nt,coalesced
|
|
|
|
; DARWIN: .globl _G10
|
|
|
|
; DARWIN: .weak_definition _G10
|
|
|
|
; DARWIN: .align 5
|
|
|
|
; DARWIN: _G10:
|
|
|
|
; DARWIN: .space 400
|
|
|
|
|
|
|
|
; LINUX: .bss
|
|
|
|
; LINUX: .weak G10
|
|
|
|
; LINUX: .align 32
|
|
|
|
; LINUX: G10:
|
|
|
|
; LINUX: .zero 400
|
2009-08-04 18:13:09 +02:00
|
|
|
|
2010-04-27 09:41:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
;; Zero sized objects should round up to 1 byte in zerofill directives.
|
|
|
|
; rdar://7886017
|
|
|
|
@G11 = global [0 x i32] zeroinitializer
|
|
|
|
@G12 = global {} zeroinitializer
|
|
|
|
@G13 = global { [0 x {}] } zeroinitializer
|
|
|
|
|
|
|
|
; DARWIN: .globl _G11
|
|
|
|
; DARWIN: .zerofill __DATA,__common,_G11,1,2
|
|
|
|
; DARWIN: .globl _G12
|
|
|
|
; DARWIN: .zerofill __DATA,__common,_G12,1,3
|
|
|
|
; DARWIN: .globl _G13
|
|
|
|
; DARWIN: .zerofill __DATA,__common,_G13,1,3
|