1 // RUN: %clang_scudo %s -o %t
4 // Verifies that calling malloc in a preinit_array function succeeds, and that
5 // the resulting pointer can be freed at program termination.
7 // On some Android versions, calling mmap() from a preinit function segfaults.
8 // It looks like __mmap2.S ends up calling a NULL function pointer.
9 // UNSUPPORTED: android
15 static void *global_p
= NULL
;
28 int main(int argc
, char **argv
) {
36 __attribute__((section(".preinit_array"), used
)) void (*__local_preinit
)(void) = __init
;
37 __attribute__((section(".fini_array"), used
)) void (*__local_fini
)(void) = __fini
;