2009-12-15 23:14:24 +03:00
|
|
|
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
|
2009-02-21 03:24:10 +03:00
|
|
|
|
2009-11-08 04:45:36 +03:00
|
|
|
// RUN: grep '@g0_ext = extern_weak global i32' %t
|
2009-02-21 03:24:10 +03:00
|
|
|
extern int g0_ext __attribute__((weak));
|
2009-11-08 04:45:36 +03:00
|
|
|
// RUN: grep 'declare extern_weak i32 @g1_ext()' %t
|
2009-02-21 03:24:10 +03:00
|
|
|
extern int __attribute__((weak)) g1_ext (void);
|
|
|
|
|
2009-11-08 04:45:36 +03:00
|
|
|
// RUN: grep '@g0_common = weak global i32' %t
|
2009-02-21 03:24:10 +03:00
|
|
|
int g0_common __attribute__((weak));
|
|
|
|
|
2009-11-08 04:45:36 +03:00
|
|
|
// RUN: grep '@g0_def = weak global i32' %t
|
2009-02-21 03:24:10 +03:00
|
|
|
int g0_def __attribute__((weak)) = 52;
|
2009-11-08 04:45:36 +03:00
|
|
|
// RUN: grep 'define weak i32 @g1_def()' %t
|
2009-07-22 00:52:43 +04:00
|
|
|
int __attribute__((weak)) g1_def (void) { return 0; }
|
2009-02-21 03:24:10 +03:00
|
|
|
|
|
|
|
// Force _ext references
|
|
|
|
void f0() {
|
|
|
|
int a = g0_ext;
|
|
|
|
int b = g1_ext();
|
|
|
|
}
|
|
|
|
|