aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Linux/init_fini_sections.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Linux/init_fini_sections.cc')
-rw-r--r--test/asan/TestCases/Linux/init_fini_sections.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/asan/TestCases/Linux/init_fini_sections.cc b/test/asan/TestCases/Linux/init_fini_sections.cc
new file mode 100644
index 000000000000..c7234eeeac2c
--- /dev/null
+++ b/test/asan/TestCases/Linux/init_fini_sections.cc
@@ -0,0 +1,24 @@
+// RUN: %clangxx_asan %s -o %t && %run %t | FileCheck %s
+
+#include <stdio.h>
+
+static void foo() {
+ printf("foo\n");
+}
+
+int main() {
+ return 0;
+}
+
+__attribute__((section(".preinit_array")))
+void (*call_foo)(void) = &foo;
+
+__attribute__((section(".init_array")))
+void (*call_foo_2)(void) = &foo;
+
+__attribute__((section(".fini_array")))
+void (*call_foo_3)(void) = &foo;
+
+// CHECK: foo
+// CHECK: foo
+// CHECK: foo