unify static and dynamic libc init/fini code paths
use weak definitions that the dynamic linker can override instead of
preprocessor conditionals on SHARED so that the same libc start and
exit code can be used for both static and dynamic linking.
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 5fbe2bb..ac755d9 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -1175,7 +1175,7 @@
p->kernel_mapped = 1;
}
-static void do_fini()
+void __libc_exit_fini()
{
struct dso *p;
size_t dyn[DYN_CNT];
@@ -1659,8 +1659,6 @@
debug.state = 0;
_dl_debug_state();
- __init_libc(envp, argv[0]);
- atexit(do_fini);
errno = 0;
CRTJMP((void *)aux[AT_ENTRY], argv-1);