This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
DTV_AT_TP _dl_determine_tlsoffset often doesn't use free gap
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: 29 Oct 2004 05:10:42 -0300
- Subject: DTV_AT_TP _dl_determine_tlsoffset often doesn't use free gap
- Organization: Red Hat Global Engineering Services Compiler Team
I've been staring at the DTV_AT_TP _dl_determine_tlsoffset code for a
while trying to make sense of it, but either I'm missing something or
there's an incorrect test in there. If I'm reading the current code
correctly, it will only use the gap if the blocksize is at least the
size of the gap, and also no bigger than the gap, so it will only use
the block if it fits exactly, without any need for additional
alignment. The patch below, untested so far, would fix it, such that
it would attempt to fix a block whenever it's smaller than the gap.
Am I missing anything?
2004-10-29 Alexandre Oliva <aoliva@redhat.com>
* sysdeps/generic/dl-tls.c (_dl_determine_tlsoffset): Use free
range even if it doesn't match exactly.
--- sysdeps/generic/dl-tls.c.~1.43.~ 2004-10-14 15:16:17.000000000 -0300
+++ sysdeps/generic/dl-tls.c 2004-10-29 04:53:26.500811239 -0300
@@ -217,7 +217,7 @@ _dl_determine_tlsoffset (void)
size_t off;
max_align = MAX (max_align, slotinfo[cnt].map->l_tls_align);
- if (slotinfo[cnt].map->l_tls_blocksize >= freetop - freebottom)
+ if (slotinfo[cnt].map->l_tls_blocksize <= freetop - freebottom)
{
off = roundup (freebottom, slotinfo[cnt].map->l_tls_align);
if (off - freebottom < firstbyte)
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}