63 lines · c
1// RUN: %clang_cc1 -emit-llvm -o - -triple i386-linux-gnu %s | FileCheck %s2 3// This checks that the global won't be marked as common. 4// (It shouldn't because it's being initialized).5 6int a;7int a = 242;8// CHECK: @a ={{.*}} global i32 2429 10// This should get normal weak linkage.11int c __attribute__((weak))= 0;12// CHECK: @c = weak global i32 013 14// Even though is marked const, it should get still get "weak"15// linkage, not "weak_odr" as the weak attribute makes it possible16// 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 019const int d __attribute__((weak))= 0;20 21// However, "selectany" is similar to "weak", but isn't interposable22// by a strong definition, and should appear as weak_odr.23// CHECK: @e = weak_odr constant i32 1724const int e __attribute__((selectany)) = 17;25 26// PR6168 "too many undefs"27struct ManyFields {28 int a;29 int b;30 int c;31 char d;32 int e;33 int f;34};35 36// CHECK: global { i32, i32, i32, i8, [3 x i8], i32, i32 } { i32 1, i32 2, i32 0, i8 0, [3 x i8] zeroinitializer, i32 0, i32 0 }37struct ManyFields FewInits = {1, 2};38 39 40// PR676641// CHECK: @l ={{.*}} global %struct.K { [6 x i32] [i32 102, i32 111, i32 111, i32 0, i32 0, i32 0], i32 1 }42typedef __WCHAR_TYPE__ wchar_t;43struct 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"]50char yuv_types[4][6]= {"4:0:0","4:2:0","4:2:2","4:4:4"};51 52unsigned long long x = -1000;53// CHECK: @x ={{.*}} global i64 -100054unsigned long long uint_max = 4294967295u;55// CHECK: @uint_max ={{.*}} global i64 429496729556 57 58// NOTE: tentative definitions are processed at the end of the translation unit.59 60// This shouldn't be emitted as common because it has an explicit section.61// CHECK: @b ={{.*}} global i32 0, section "foo"62int b __attribute__((section("foo")));63