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