From 827c5f1b826b916a533c082e558fc7c6fc38de6d Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Tue, 18 Nov 2008 12:48:13 +0000 Subject: Move _dl_iterate_phdr into libc.so.0 and libc.a (as glibc does). Currently we have an implementation in ld.so and libdl.a. Signed-off-by: Carmelo Amoroso --- libc/misc/internals/__uClibc_main.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'libc/misc/internals/__uClibc_main.c') 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 -- cgit v1.2.3