From 8a30f00fe8ea30054c2df183d34ef3ad8a522cc5 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 23 Jul 2002 23:12:01 +0000 Subject: Update. 2002-07-23 Ulrich Drepper * sysdeps/generic/libc-tls.c: New file. * csu/Makefile (routines): Add libc-tls. (static-only-routines): Add libc-tls. * elf/dl-support.c (_dl_phdr): New variable. (_dl_phnum): New variable. (_dl_aux_init): Initialize _dl_phdr and _dl_phnum from aux vector. * sysdeps/generic/libc-start.c (__libc_start_main): Reorganize code for !SHARED. First look through auxiliary vector. If TLS always call __pthread_initialize_minimal. * sysdeps/generic/dl-tls.c (_dl_allocate_tls): Make sure size argument in mmap call is never zero. --- sysdeps/generic/libc-start.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'sysdeps/generic/libc-start.c') diff --git a/sysdeps/generic/libc-start.c b/sysdeps/generic/libc-start.c index 4d1748614e..600136dae5 100644 --- a/sysdeps/generic/libc-start.c +++ b/sysdeps/generic/libc-start.c @@ -77,10 +77,23 @@ BP_SYM (__libc_start_main) (int (*main) (int, char **, char **), __libc_stack_end = stack_end; #ifndef SHARED +# ifdef HAVE_AUX_VECTOR + /* First process the auxiliary vector since we need to find the + program header to locate an eventually present PT_TLS entry. */ + for (auxvec = (void *__unbounded *__unbounded) ubp_ev; + *auxvec != NULL; ++auxvec); + ++auxvec; + _dl_aux_init ((ElfW(auxv_t) *) auxvec); +# endif + /* Initialize the thread library at least a bit since the libgcc functions are using thread functions if these are available and - we need to setup errno. */ + we need to setup errno. If there is no thread library and we + handle TLS the function is defined in the libc to initialized the + TLS handling. */ +# ifndef TLS if (__pthread_initialize_minimal) +# endif __pthread_initialize_minimal (); /* Some security at this point. Prevent starting a SUID binary where @@ -89,13 +102,6 @@ BP_SYM (__libc_start_main) (int (*main) (int, char **, char **), loader did the work already. */ if (__builtin_expect (__libc_enable_secure, 0)) __libc_check_standard_fds (); - -# ifdef HAVE_AUX_VECTOR - for (auxvec = (void *__unbounded *__unbounded) ubp_ev; - *auxvec != NULL; ++auxvec); - ++auxvec; - _dl_aux_init ((ElfW(auxv_t) *) auxvec); -# endif #endif /* Register the destructor of the dynamic linker if there is any. */ -- cgit v1.2.3