[ASan] Add test for .preinit_array/.init_array/.fini_array sections.

llvm-svn: 247737
This commit is contained in:
Alexey Samsonov 2015-09-15 23:06:17 +00:00
parent a11f81973a
commit f23dee5408
1 changed files with 24 additions and 0 deletions

View File

@ -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