This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

DTV_AT_TP _dl_determine_tlsoffset often doesn't use free gap


I posted this to libc-alpha a month ago, and it didn't get any
reaction so far, even after a ping.  I'm beginning to wonder if
patches are not supposed to be posted there, but here.  Let's try...


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}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]