1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc // RUN: grep '@g0_ext = extern_weak global i32' %t 4*f4a2713aSLionel Sambuc extern int g0_ext __attribute__((weak)); 5*f4a2713aSLionel Sambuc // RUN: grep 'declare extern_weak i32 @g1_ext()' %t 6*f4a2713aSLionel Sambuc extern int __attribute__((weak)) g1_ext (void); 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc // RUN: grep '@g0_common = weak global i32' %t 9*f4a2713aSLionel Sambuc int g0_common __attribute__((weak)); 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc // RUN: grep '@g0_def = weak global i32' %t 12*f4a2713aSLionel Sambuc int g0_def __attribute__((weak)) = 52; 13*f4a2713aSLionel Sambuc // RUN: grep 'define weak i32 @g1_def()' %t g1_def(void)14*f4a2713aSLionel Sambucint __attribute__((weak)) g1_def (void) { return 0; } 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc // Force _ext references f0()17*f4a2713aSLionel Sambucvoid f0() { 18*f4a2713aSLionel Sambuc int a = g0_ext; 19*f4a2713aSLionel Sambuc int b = g1_ext(); 20*f4a2713aSLionel Sambuc } 21*f4a2713aSLionel Sambuc 22