summaryrefslogtreecommitdiff
path: root/libc/misc/internals/__uClibc_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/internals/__uClibc_main.c')
-rw-r--r--libc/misc/internals/__uClibc_main.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index f33ecf79f..9e194983f 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -72,6 +72,11 @@ uintptr_t __guard attribute_relro;
# endif
# endif
+/*
+ * Needed to initialize _dl_phdr when statically linked
+ */
+
+void internal_function _dl_aux_init (ElfW(auxv_t) *av);
#endif /* !SHARED */
/*
@@ -114,9 +119,8 @@ weak_alias (program_invocation_name, __progname_full)
#endif
/*
- * Declare the __environ global variable and create a strong alias environ.
- * Note: Apparently we must initialize __environ to ensure that the strong
- * environ symbol is also included.
+ * Declare the __environ global variable and create a weak alias environ.
+ * This must be initialized; we cannot have a weak alias into bss.
*/
char **__environ = 0;
weak_alias(__environ, environ)
@@ -310,6 +314,12 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc,
}
aux_dat += 2;
}
+#ifndef SHARED
+ /* Get the program headers (_dl_phdr) from the aux vector
+ It will be used into __libc_setup_tls. */
+
+ _dl_aux_init (auxvt);
+#endif
#endif
/* We need to initialize uClibc. If we are dynamically linked this