summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/env/__libc_start_main.c5
-rw-r--r--src/ldso/dynlink.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/src/env/__libc_start_main.c b/src/env/__libc_start_main.c
index ee10b0de..04a454e8 100644
--- a/src/env/__libc_start_main.c
+++ b/src/env/__libc_start_main.c
@@ -3,6 +3,7 @@
void __init_tls(size_t *);
void __init_security(size_t *);
+void __init_ldso_ctors(void);
#define AUX_CNT 38
@@ -37,6 +38,10 @@ int __libc_start_main(
/* Execute constructors (static) linked into the application */
if (init) init(argc, argv, envp);
+#ifdef SHARED
+ __init_ldso_ctors();
+#endif
+
/* Pass control to to application */
exit(main(argc, argv, envp));
return 0;
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index c436b88f..d564b8f2 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -999,13 +999,16 @@ void *__dynlink(int argc, char **argv)
if (ssp_used) __init_ssp((void *)aux[AT_RANDOM]);
- atexit(do_fini);
- do_init_fini(tail);
-
errno = 0;
return (void *)aux[AT_ENTRY];
}
+void __init_ldso_ctors(void)
+{
+ atexit(do_fini);
+ do_init_fini(tail);
+}
+
void *dlopen(const char *file, int mode)
{
struct dso *volatile p, *orig_tail, *next;