summaryrefslogtreecommitdiff
path: root/test/cfi
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-11-11 21:39:35 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-11-11 21:39:35 +0000
commit53f1eb4f7c2c066de917da1bf563140ccd6cc9c0 (patch)
tree48b9a63060a59ba812d055cb98e6709f8927ce40 /test/cfi
parenta0d4283d453dfde7b8e6c90090332ffda88b5e0a (diff)
[cfi] Test case for weak symbol handling.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286637 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/cfi')
-rw-r--r--test/cfi/icall/weak.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/cfi/icall/weak.c b/test/cfi/icall/weak.c
new file mode 100644
index 000000000..8acf41eb9
--- /dev/null
+++ b/test/cfi/icall/weak.c
@@ -0,0 +1,14 @@
+// Test that weak symbols stay weak.
+// RUN: %clang_cfi -lm -o %t1 %s && %t1
+
+__attribute__((weak)) void does_not_exist(void);
+
+__attribute__((noinline))
+void foo(void (*p)(void)) {
+ p();
+}
+
+int main(int argc, char **argv) {
+ if (does_not_exist)
+ foo(does_not_exist);
+}