diff options
Diffstat (limited to 'libc/bionic/libc_init_static.c')
-rw-r--r-- | libc/bionic/libc_init_static.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/bionic/libc_init_static.c b/libc/bionic/libc_init_static.c index d097b6b..3634c7b 100644 --- a/libc/bionic/libc_init_static.c +++ b/libc/bionic/libc_init_static.c @@ -85,5 +85,12 @@ __noreturn void __libc_init(uintptr_t *elfdata, argv = (char**)(elfdata + 1); envp = argv + argc + 1; + /* The executable may have its own destructors listed in its .fini_array + * so we need to ensure that these are called when the program exits + * normally. + */ + if (structors->fini_array) + __cxa_atexit(__libc_fini,structors->fini_array,NULL); + exit(slingshot(argc, argv, envp)); } |