// 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 != NULL) { __cxa_atexit(__libc_fini,structors->fini_array,NULL); }
// This function is called from the executable's _start entry point // (see arch-$ARCH/bionic/crtbegin_dynamic.S), which is itself // called by the dynamic linker after it has loaded all shared // libraries the executable depends on. // // Note that the dynamic linker has also run all constructors in the // executable at this point. __noreturn void __libc_init(void* raw_args, void (*onexit)(void), int (*slingshot)(int, char**, char**), structors_array_tconst * const structors) {
KernelArgumentBlock args(raw_args);
// Several Linux ABIs don't pass the onexit pointer, and the ones that // do never use it. Therefore, we ignore it.
// 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); }