[compiler-rt] r247737 - [ASan] Add test for .preinit_array/.init_array/.fini_array sections.

Alexey Samsonov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 16:06:17 PDT 2015


Author: samsonov
Date: Tue Sep 15 18:06:17 2015
New Revision: 247737

URL: http://llvm.org/viewvc/llvm-project?rev=247737&view=rev
Log:
[ASan] Add test for .preinit_array/.init_array/.fini_array sections.

Added:
    compiler-rt/trunk/test/asan/TestCases/Linux/init_fini_sections.cc

Added: compiler-rt/trunk/test/asan/TestCases/Linux/init_fini_sections.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/init_fini_sections.cc?rev=247737&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/init_fini_sections.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/init_fini_sections.cc Tue Sep 15 18:06:17 2015
@@ -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




More information about the llvm-commits mailing list