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