1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -o - -triple i386-linux-gnu %s | FileCheck %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc // This checks that the global won't be marked as common. 4*f4a2713aSLionel Sambuc // (It shouldn't because it's being initialized). 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc int a; 7*f4a2713aSLionel Sambuc int a = 242; 8*f4a2713aSLionel Sambuc // CHECK: @a = global i32 242 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc // This should get normal weak linkage. 11*f4a2713aSLionel Sambuc int c __attribute__((weak))= 0; 12*f4a2713aSLionel Sambuc // CHECK: @c = weak global i32 0 13*f4a2713aSLionel Sambuc 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc // Since this is marked const, it should get weak_odr linkage, since all 16*f4a2713aSLionel Sambuc // definitions have to be the same. 17*f4a2713aSLionel Sambuc // CHECK: @d = weak_odr constant i32 0 18*f4a2713aSLionel Sambuc const int d __attribute__((weak))= 0; 19*f4a2713aSLionel Sambuc 20*f4a2713aSLionel Sambuc // PR6168 "too many undefs" 21*f4a2713aSLionel Sambuc struct ManyFields { 22*f4a2713aSLionel Sambuc int a; 23*f4a2713aSLionel Sambuc int b; 24*f4a2713aSLionel Sambuc int c; 25*f4a2713aSLionel Sambuc char d; 26*f4a2713aSLionel Sambuc int e; 27*f4a2713aSLionel Sambuc int f; 28*f4a2713aSLionel Sambuc }; 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc // CHECK: global %struct.ManyFields { i32 1, i32 2, i32 0, i8 0, i32 0, i32 0 } 31*f4a2713aSLionel Sambuc struct ManyFields FewInits = {1, 2}; 32*f4a2713aSLionel Sambuc 33*f4a2713aSLionel Sambuc 34*f4a2713aSLionel Sambuc // PR6766 35*f4a2713aSLionel Sambuc // CHECK: @l = global %struct.K { [6 x i32] [i32 102, i32 111, i32 111, i32 0, i32 0, i32 0], i32 1 } 36*f4a2713aSLionel Sambuc typedef __WCHAR_TYPE__ wchar_t; 37*f4a2713aSLionel Sambuc struct K { 38*f4a2713aSLionel Sambuc wchar_t L[6]; 39*f4a2713aSLionel Sambuc int M; 40*f4a2713aSLionel Sambuc } l = { { L"foo" }, 1 }; 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambuc // CHECK: @yuv_types = global [4 x [6 x i8]] {{\[}}[6 x i8] c"4:0:0\00", [6 x i8] c"4:2:0\00", [6 x i8] c"4:2:2\00", [6 x i8] c"4:4:4\00"] 44*f4a2713aSLionel Sambuc char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"}; 45*f4a2713aSLionel Sambuc 46*f4a2713aSLionel Sambuc 47*f4a2713aSLionel Sambuc // NOTE: tentative definitions are processed at the end of the translation unit. 48*f4a2713aSLionel Sambuc 49*f4a2713aSLionel Sambuc // This shouldn't be emitted as common because it has an explicit section. 50*f4a2713aSLionel Sambuc // rdar://7119244 51*f4a2713aSLionel Sambuc // CHECK: @b = global i32 0, section "foo" 52*f4a2713aSLionel Sambuc int b __attribute__((section("foo"))); 53