blob: 99760635581d388533ded2db98f80480dc5cb0e3 [file] [log] [blame]
Rafael Espindola6a836702010-03-04 18:17:24 +00001// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o %t %s
2// RUN: FileCheck --input-file=%t %s
3
4// CHECK: @test1_f = extern_weak global i32
5extern int test1_f;
6static int test1_g __attribute__((weakref("test1_f")));
7int test1_h(void) {
8 return test1_g;
9}
10
11// CHECK: @test2_f = common global i32 0, align 4
12int test2_f;
13static int test2_g __attribute__((weakref("test2_f")));
14int test2_h(void) {
15 return test2_g;
16}
17
18// CHECK: @test3_f = external global i32
19extern int test3_f;
20static int test3_g __attribute__((weakref("test3_f")));
21int test3_foo(void) {
22 return test3_f;
23}
24int test3_h(void) {
25 return test3_g;
26}
27
28// CHECK: @test4_f = common global i32 0, align 4
29extern int test4_f;
30static int test4_g __attribute__((weakref("test4_f")));
31int test4_h(void) {
32 return test4_g;
33}
34int test4_f;
35
36// CHECK: @test5_f = external global i32
37extern int test5_f;
38static int test5_g __attribute__((weakref("test5_f")));
39int test5_h(void) {
40 return test5_g;
41}
42int test5_foo(void) {
43 return test5_f;
44}
45
46// CHECK: @test6_f = extern_weak global i32
47extern int test6_f __attribute__((weak));
48static int test6_g __attribute__((weakref("test6_f")));
49int test6_h(void) {
50 return test6_g;
51}
52int test6_foo(void) {
53 return test6_f;
54}