diff options
| author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-08-30 04:42:13 +0000 |
|---|---|---|
| committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-08-30 04:42:13 +0000 |
| commit | 863fb82e76eba16742cab87c085dd7b08639bcb9 (patch) | |
| tree | 77ed033cb655d830526ad188629d019bb950a471 /libc/misc/internals/__uClibc_main.c | |
| parent | 99ddd2cd7bcfabaafb1b0ed06b915d1bd30412a9 (diff) | |
| download | uClibc-alpine-863fb82e76eba16742cab87c085dd7b08639bcb9.tar.bz2 uClibc-alpine-863fb82e76eba16742cab87c085dd7b08639bcb9.tar.xz | |
Add in calls needed for TLS setup for statically linked applications. A call is made to '_dl_aux_init' which is defined in 'dl-support.c' to set up TLS variables before '__uClibc_init' gets called.
Diffstat (limited to 'libc/misc/internals/__uClibc_main.c')
| -rw-r--r-- | libc/misc/internals/__uClibc_main.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 6f74e39e8..5c1560d1b 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -42,6 +42,7 @@ extern void weak_function _locale_init(void); #endif #ifdef __UCLIBC_HAS_THREADS__ extern void weak_function __pthread_initialize_minimal(void); +extern void weak_function _dl_aux_init(ElfW(auxv_t) *); #endif @@ -175,10 +176,6 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, ElfW(auxv_t) auxvt[AT_EGID + 1]; #endif __libc_stack_end = stack_end; - /* We need to initialize uClibc. If we are dynamically linked this - * may have already been completed by the shared lib loader. We call - * __uClibc_init() regardless, to be sure the right thing happens. */ - __uClibc_init(); __rtld_fini = rtld_fini; @@ -207,6 +204,20 @@ __uClibc_main(int (*main)(int, char **, char **), int argc, aux_dat += 2; } +#ifdef __UCLIBC_HAS_THREADS__ + /* + * Before we can make any pthread calls, we have to do some + * some TLS setup. This call may do more in the future. + */ + if (likely(_dl_aux_init != NULL)) + _dl_aux_init(auxvt); +#endif + + /* We need to initialize uClibc. If we are dynamically linked this + * may have already been completed by the shared lib loader. We call + * __uClibc_init() regardless, to be sure the right thing happens. */ + __uClibc_init(); + /* Make certain getpagesize() gives the correct answer */ __pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; |
