2021-01-10 15:56:55 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -triple i386-linux-gnu -o - %s | FileCheck %s
|
2010-03-05 02:17:24 +08:00
|
|
|
|
|
|
|
// CHECK: declare extern_weak void @test1_f()
|
|
|
|
void test1_f(void);
|
|
|
|
static void test1_g(void) __attribute__((weakref("test1_f")));
|
|
|
|
void test1_h(void) {
|
|
|
|
test1_g();
|
|
|
|
}
|
|
|
|
|
2021-01-10 15:56:55 +08:00
|
|
|
// CHECK-LABEL: define dso_local void @test2_f()
|
2010-03-05 02:17:24 +08:00
|
|
|
void test2_f(void) {}
|
|
|
|
static void test2_g(void) __attribute__((weakref("test2_f")));
|
|
|
|
void test2_h(void) {
|
|
|
|
test2_g();
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: declare void @test3_f()
|
|
|
|
void test3_f(void);
|
|
|
|
static void test3_g(void) __attribute__((weakref("test3_f")));
|
|
|
|
void test3_foo(void) {
|
|
|
|
test3_f();
|
|
|
|
}
|
|
|
|
void test3_h(void) {
|
|
|
|
test3_g();
|
|
|
|
}
|
|
|
|
|
2021-01-10 15:56:55 +08:00
|
|
|
// CHECK-LABEL: define dso_local void @test4_f()
|
2010-03-05 02:17:24 +08:00
|
|
|
void test4_f(void);
|
|
|
|
static void test4_g(void) __attribute__((weakref("test4_f")));
|
|
|
|
void test4_h(void) {
|
|
|
|
test4_g();
|
|
|
|
}
|
|
|
|
void test4_f(void) {}
|
|
|
|
|
|
|
|
// CHECK: declare void @test5_f()
|
|
|
|
void test5_f(void);
|
|
|
|
static void test5_g(void) __attribute__((weakref("test5_f")));
|
|
|
|
void test5_h(void) {
|
|
|
|
test5_g();
|
|
|
|
}
|
|
|
|
void test5_foo(void) {
|
|
|
|
test5_f();
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: declare extern_weak void @test6_f()
|
|
|
|
void test6_f(void) __attribute__((weak));
|
|
|
|
static void test6_g(void) __attribute__((weakref("test6_f")));
|
|
|
|
void test6_h(void) {
|
|
|
|
test6_g();
|
|
|
|
}
|
|
|
|
void test6_foo(void) {
|
|
|
|
test6_f();
|
|
|
|
}
|
2010-03-05 05:26:03 +08:00
|
|
|
|
2012-10-17 01:45:27 +08:00
|
|
|
// CHECK: declare extern_weak void @test8_f()
|
|
|
|
static void test8_g(void) __attribute__((weakref("test8_f")));
|
|
|
|
void test8_h(void) {
|
|
|
|
if (test8_g)
|
|
|
|
test8_g();
|
|
|
|
}
|
2010-03-05 05:26:03 +08:00
|
|
|
// CHECK: declare extern_weak void @test7_f()
|
|
|
|
void test7_f(void);
|
|
|
|
static void test7_g(void) __attribute__((weakref("test7_f")));
|
|
|
|
static void *const test7_zed = (void *) &test7_g;
|
|
|
|
void* test7_h(void) {
|
|
|
|
return test7_zed;
|
|
|
|
}
|