11 /* __toread.c, __towrite.c, and atexit.c override these */
12 weak_alias(dummy, __funcs_on_exit);
13 weak_alias(dummy, __flush_on_exit);
14 weak_alias(dummy, __seek_on_exit);
17 weak_alias(dummy, _fini);
18 extern void (*const __fini_array_start)() __attribute__((weak));
19 extern void (*const __fini_array_end)() __attribute__((weak));
22 _Noreturn void exit(int code)
26 /* If more than one thread calls exit, hang until _Exit ends it all */
27 while (a_swap(&lock, 1)) __syscall(SYS_pause);
32 uintptr_t a = (uintptr_t)&__fini_array_end;
33 for (; a>(uintptr_t)&__fini_array_start; a-=sizeof(void(*)()))
34 (*(void (**)())(a-sizeof(void(*)())))();