1 // RUN: %clang_cc1 -emit-llvm -o - -triple i386-linux-gnu %s | FileCheck %s
3 // This checks that the global won't be marked as common.
4 // (It shouldn't because it's being initialized).
8 // CHECK: @a ={{.*}} global i32 242
10 // This should get normal weak linkage.
11 int c
__attribute__((weak
))= 0;
12 // CHECK: @c = weak global i32 0
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;
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;
26 // PR6168 "too many undefs"
36 // CHECK: global %struct.ManyFields { i32 1, i32 2, i32 0, i8 0, i32 0, i32 0 }
37 struct ManyFields FewInits
= {1, 2};
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;
46 } l
= { { L
"foo" }, 1 };
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"};
52 unsigned long long x
= -1000;
53 // CHECK: @x ={{.*}} global i64 -1000
54 unsigned long long uint_max
= 4294967295u;
55 // CHECK: @uint_max ={{.*}} global i64 4294967295
58 // NOTE: tentative definitions are processed at the end of the translation unit.
60 // This shouldn't be emitted as common because it has an explicit section.
61 // CHECK: @b ={{.*}} global i32 0, section "foo"
62 int b
__attribute__((section("foo")));