This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/19826] invalid pointer returned from __tls_get_addr with static linking
- From: "aoliva at sourceware dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 20 Sep 2016 16:48:57 +0000
- Subject: [Bug libc/19826] invalid pointer returned from __tls_get_addr with static linking
- Auto-submitted: auto-generated
- References: <bug-19826-131@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19826
--- Comment #12 from Alexandre Oliva <aoliva at sourceware dot org> ---
Given all the information I got so far, it looks like this will fix it:
diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 17567ad..60f4c1d 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -538,6 +538,10 @@ _dl_allocate_tls_init (void *result)
# error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
#endif
+ /* Set up the DTV entry. The simplified __tls_get_addr that
+ some platforms use in static programs requires it. */
+ dtv[map->l_tls_modid].pointer.val = dest;
+
/* Copy the initialization image and clear the BSS part. */
memset (__mempcpy (dest, map->l_tls_initimage,
map->l_tls_initimage_size), '\0',
--
You are receiving this mail because:
You are on the CC list for the bug.