summaryrefslogtreecommitdiffstats
path: root/libc/private/bionic_tls.h
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-07-17 17:55:01 +0200
committerDavid 'Digit' Turner <digit@google.com>2009-07-17 17:55:01 +0200
commitef0bd1857041ffde069cf52138aaf22c1af7130e (patch)
treec61b6ca4b286821ff473533183eba42e7da234a3 /libc/private/bionic_tls.h
parent348065586a2e6154d6cff36afa6e00af6bbc5918 (diff)
downloadbionic-ef0bd1857041ffde069cf52138aaf22c1af7130e.tar.gz
bionic-ef0bd1857041ffde069cf52138aaf22c1af7130e.tar.bz2
bionic-ef0bd1857041ffde069cf52138aaf22c1af7130e.zip
Pass the elfdata pointer in a slot of the temporary TLS area.
This is needed to properly initialize the C runtime when libc.so is loaded by the dynamic linker. Move the temporary TLS setup before the first system call, just in case something really horrible happens, we won't crash when trying to write an error code in 'errno' Remove the broken TLS_SLOT_THREAD_ID setup. First, this slot should normally receive the address of a pthread_internal_t, not a kernel thread identifier. Second, it is never used by the linker anyway. Also remove an obsolete comment.
Diffstat (limited to 'libc/private/bionic_tls.h')
-rw-r--r--libc/private/bionic_tls.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index da343441f..82c8cd909 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -60,6 +60,13 @@ __BEGIN_DECLS
#define TLS_SLOT_OPENGL_API 3
#define TLS_SLOT_OPENGL 4
+/* this slot is only used to pass information from the dynamic linker to
+ * libc.so when the C library is loaded in to memory. The C runtime init
+ * function will then clear it. Since its use is extremely temporary,
+ * we reuse an existing location.
+ */
+#define TLS_SLOT_BIONIC_PREINIT (TLS_SLOT_ERRNO+1)
+
/* small technical note: it is not possible to call pthread_setspecific
* on keys that are <= TLS_SLOT_MAX_WELL_KNOWN, which is why it is set to
* TLS_SLOT_ERRNO.