1 // 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 5 extern int test1_f; 6 static int test1_g __attribute__((weakref("test1_f"))); test1_h(void)7int test1_h(void) { 8 return test1_g; 9 } 10 11 // CHECK: @test2_f = dso_local global i32 0, align 4 12 int test2_f; 13 static int test2_g __attribute__((weakref("test2_f"))); test2_h(void)14int test2_h(void) { 15 return test2_g; 16 } 17 18 // CHECK: @test3_f = external global i32 19 extern int test3_f; 20 static int test3_g __attribute__((weakref("test3_f"))); test3_foo(void)21int test3_foo(void) { 22 return test3_f; 23 } test3_h(void)24int test3_h(void) { 25 return test3_g; 26 } 27 28 // CHECK: @test4_f = dso_local global i32 0, align 4 29 extern int test4_f; 30 static int test4_g __attribute__((weakref("test4_f"))); test4_h(void)31int test4_h(void) { 32 return test4_g; 33 } 34 int test4_f; 35 36 // CHECK: @test5_f = external global i32 37 extern int test5_f; 38 static int test5_g __attribute__((weakref("test5_f"))); test5_h(void)39int test5_h(void) { 40 return test5_g; 41 } test5_foo(void)42int test5_foo(void) { 43 return test5_f; 44 } 45 46 // CHECK: @test6_f = extern_weak global i32 47 extern int test6_f __attribute__((weak)); 48 static int test6_g __attribute__((weakref("test6_f"))); test6_h(void)49int test6_h(void) { 50 return test6_g; 51 } test6_foo(void)52int test6_foo(void) { 53 return test6_f; 54 } 55