1 // RUN: %clang_cc1 -emit-llvm -o - -triple i386-linux-gnu %s | FileCheck %s 2 3 // This checks that the global won't be marked as common. 4 // (It shouldn't because it's being initialized). 5 6 int a; 7 int a = 242; 8 // CHECK: @a ={{.*}} global i32 242 9 10 // This should get normal weak linkage. 11 int c __attribute__((weak))= 0; 12 // CHECK: @c = weak global i32 0 13 14 // Even though is marked const, it should get still get "weak" 15 // linkage, not "weak_odr" as the weak attribute makes it possible 16 // that there is a strong definition that changes the value linktime, 17 // so the value must not be considered constant. 18 // CHECK: @d = weak constant i32 0 19 const int d __attribute__((weak))= 0; 20 21 // However, "selectany" is similar to "weak", but isn't interposable 22 // by a strong definition, and should appear as weak_odr. 23 // CHECK: @e = weak_odr constant i32 17 24 const int e __attribute__((selectany)) = 17; 25 26 // PR6168 "too many undefs" 27 struct ManyFields { 28 int a; 29 int b; 30 int c; 31 char d; 32 int e; 33 int f; 34 }; 35 36 // CHECK: global %struct.ManyFields { i32 1, i32 2, i32 0, i8 0, i32 0, i32 0 } 37 struct ManyFields FewInits = {1, 2}; 38 39 40 // PR6766 41 // CHECK: @l ={{.*}} global %struct.K { [6 x i32] [i32 102, i32 111, i32 111, i32 0, i32 0, i32 0], i32 1 } 42 typedef __WCHAR_TYPE__ wchar_t; 43 struct K { 44 wchar_t L[6]; 45 int M; 46 } l = { { L"foo" }, 1 }; 47 48 49 // 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"] 50 char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"}; 51 52 53 // NOTE: tentative definitions are processed at the end of the translation unit. 54 55 // This shouldn't be emitted as common because it has an explicit section. 56 // rdar://7119244 57 // CHECK: @b ={{.*}} global i32 0, section "foo" 58 int b __attribute__((section("foo"))); 59