diff options
author | Evgeniy Stepanov <eugenis@google.com> | 2012-03-22 18:01:53 +0400 |
---|---|---|
committer | Evgeniy Stepanov <eugenis@google.com> | 2012-04-13 00:08:11 +0400 |
commit | 1a78fbb5c8228e4aea2a516818828b76044310f2 (patch) | |
tree | 4de785711dbfa8923d721f9180473328b6228a5c /libc/private | |
parent | d5099016f70b5acbfeb969787687099df703a4f4 (diff) | |
download | bionic-1a78fbb5c8228e4aea2a516818828b76044310f2.zip bionic-1a78fbb5c8228e4aea2a516818828b76044310f2.tar.gz bionic-1a78fbb5c8228e4aea2a516818828b76044310f2.tar.bz2 |
Initialize TLS before any application code is run.
Since e19d702b8e33, dlsym and friends use recursive mutexes that
require the current thread id, which is not available before the libc
constructor. This prevents us from using dlsym() in .preinit_array.
This change moves TLS initialization from libc constructor to the earliest
possible point - immediately after linker itself is relocated. As a result,
pthread_internal_t for the initial thread is available from the start.
As a bonus, values stored in TLS in .preinit_array are not lost when libc is
initialized.
Change-Id: Iee5a710ee000173bff63e924adeb4a4c600c1e2d
Diffstat (limited to 'libc/private')
-rw-r--r-- | libc/private/bionic_tls.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h index 008fd2f..af19554 100644 --- a/libc/private/bionic_tls.h +++ b/libc/private/bionic_tls.h @@ -134,6 +134,9 @@ extern void* __get_tls( void ); /* return the stack base and size, used by our malloc debugger */ extern void* __get_stack_base(int *p_stack_size); +/* Initialize the TLS. */ +extern void __libc_init_tls(unsigned** elfdata); + __END_DECLS #endif /* _SYS_TLS_H */ |