This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


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

GNU C Library master sources branch, master, updated. glibc-2.14-295-g8682f8b


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  8682f8b0e4bd3531e82d65332838421e76682956 (commit)
       via  037e9fe21c92216ef7032ea2796781ec27ca182a (commit)
      from  a7c8e6a1478de9f990b11e5e853318ccbe4330f2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8682f8b0e4bd3531e82d65332838421e76682956

commit 8682f8b0e4bd3531e82d65332838421e76682956
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Mon Sep 12 16:21:24 2011 -0400

    Optimize logb code for 64-bit machines

diff --git a/ChangeLog b/ChangeLog
index 40660b8..da35ca4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-12  Ulrich Drepper  <drepper@gmail.com>
+
+	* sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c: New file.
+
 2011-09-12  Andreas Schwab  <schwab@redhat.com>
 
 	* sysdeps/unix/sysv/linux/bits/socket.h (__cmsg_nxthdr): Cast to
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
new file mode 100644
index 0000000..7413504
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c
@@ -0,0 +1,44 @@
+/* Compute radix independent exponent.
+   Copyright (C) 2011 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@gmail.com>, 2011.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+double
+__logb (double x)
+{
+  int64_t ix;
+
+  EXTRACT_WORDS64 (ix, x);
+  ix &= UINT64_C(0x7fffffffffffffff);
+  if (ix == 0)
+    return -1.0 / fabs (x);
+  unsigned int ex = ix >> 52;
+  if (ex == 0x7ff)
+    return x * x;
+  return ex == 0 ? -1022.0 : (double) (ex - 1023);
+}
+weak_alias (__logb, logb)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__logb, __logbl)
+weak_alias (__logb, logbl)
+#endif

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=037e9fe21c92216ef7032ea2796781ec27ca182a

commit 037e9fe21c92216ef7032ea2796781ec27ca182a
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Mon Sep 12 16:20:40 2011 -0400

    Revert "Remove last use of USE___THREAD"
    
    This reverts commit de82006d43e198fd162807c9adc720c7ebd728a3.
    
    Conflicts:
    
    	ChangeLog

diff --git a/ChangeLog b/ChangeLog
index 8ec914f..40660b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,8 +5,6 @@
 	* sysdeps/unix/sysv/linux/sparc/bits/socket.h (__cmsg_nxthdr):
 	Likewise.
 
-	* elf/rtld.c: Remove use of USE___THREAD.
-
 2011-09-11  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* elf/Makefile (gen-ldd): Prepend $(..) to $(ldd-rewrite-script)
diff --git a/elf/rtld.c b/elf/rtld.c
index 0af9325..b3959a3 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -306,9 +306,21 @@ _dl_start_final (void *arg, struct dl_start_final_info *info)
   GL(dl_rtld_map).l_text_end = (ElfW(Addr)) _etext;
   /* Copy the TLS related data if necessary.  */
 #ifndef DONT_USE_BOOTSTRAP_MAP
-# if NO_TLS_OFFSET != 0
+# if USE___THREAD
+  assert (info->l.l_tls_modid != 0);
+  GL(dl_rtld_map).l_tls_blocksize = info->l.l_tls_blocksize;
+  GL(dl_rtld_map).l_tls_align = info->l.l_tls_align;
+  GL(dl_rtld_map).l_tls_firstbyte_offset = info->l.l_tls_firstbyte_offset;
+  GL(dl_rtld_map).l_tls_initimage_size = info->l.l_tls_initimage_size;
+  GL(dl_rtld_map).l_tls_initimage = info->l.l_tls_initimage;
+  GL(dl_rtld_map).l_tls_offset = info->l.l_tls_offset;
+  GL(dl_rtld_map).l_tls_modid = 1;
+# else
+#  if NO_TLS_OFFSET != 0
   GL(dl_rtld_map).l_tls_offset = NO_TLS_OFFSET;
+#  endif
 # endif
+
 #endif
 
 #if HP_TIMING_AVAIL
@@ -390,6 +402,9 @@ _dl_start (void *arg)
        ++cnt)
     bootstrap_map.l_info[cnt] = 0;
 # endif
+# if USE___THREAD
+  bootstrap_map.l_tls_modid = 0;
+# endif
 #endif
 
   /* Figure out the run-time load address of the dynamic linker itself.  */
@@ -403,6 +418,123 @@ _dl_start (void *arg)
   bootstrap_map.l_tls_offset = NO_TLS_OFFSET;
 #endif
 
+  /* Get the dynamic linker's own program header.  First we need the ELF
+     file header.  The `_begin' symbol created by the linker script points
+     to it.  When we have something like GOTOFF relocs, we can use a plain
+     reference to find the runtime address.  Without that, we have to rely
+     on the `l_addr' value, which is not the value we want when prelinked.  */
+#if USE___THREAD
+  dtv_t initdtv[3];
+  ElfW(Ehdr) *ehdr
+# ifdef DONT_USE_BOOTSTRAP_MAP
+    = (ElfW(Ehdr) *) &_begin;
+# else
+#  error This will not work with prelink.
+    = (ElfW(Ehdr) *) bootstrap_map.l_addr;
+# endif
+  ElfW(Phdr) *phdr = (ElfW(Phdr) *) ((void *) ehdr + ehdr->e_phoff);
+  size_t cnt = ehdr->e_phnum;	/* PT_TLS is usually the last phdr.  */
+  while (cnt-- > 0)
+    if (phdr[cnt].p_type == PT_TLS)
+      {
+	void *tlsblock;
+	size_t max_align = MAX (TLS_INIT_TCB_ALIGN, phdr[cnt].p_align);
+	char *p;
+
+	bootstrap_map.l_tls_blocksize = phdr[cnt].p_memsz;
+	bootstrap_map.l_tls_align = phdr[cnt].p_align;
+	if (phdr[cnt].p_align == 0)
+	  bootstrap_map.l_tls_firstbyte_offset = 0;
+	else
+	  bootstrap_map.l_tls_firstbyte_offset = (phdr[cnt].p_vaddr
+						  & (phdr[cnt].p_align - 1));
+	assert (bootstrap_map.l_tls_blocksize != 0);
+	bootstrap_map.l_tls_initimage_size = phdr[cnt].p_filesz;
+	bootstrap_map.l_tls_initimage = (void *) (bootstrap_map.l_addr
+						  + phdr[cnt].p_vaddr);
+
+	/* We can now allocate the initial TLS block.  This can happen
+	   on the stack.  We'll get the final memory later when we
+	   know all about the various objects loaded at startup
+	   time.  */
+# if TLS_TCB_AT_TP
+	tlsblock = alloca (roundup (bootstrap_map.l_tls_blocksize,
+				    TLS_INIT_TCB_ALIGN)
+			   + TLS_INIT_TCB_SIZE
+			   + max_align);
+# elif TLS_DTV_AT_TP
+	tlsblock = alloca (roundup (TLS_INIT_TCB_SIZE,
+				    bootstrap_map.l_tls_align)
+			   + bootstrap_map.l_tls_blocksize
+			   + max_align);
+# else
+	/* In case a model with a different layout for the TCB and DTV
+	   is defined add another #elif here and in the following #ifs.  */
+#  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+# endif
+	/* Align the TLS block.  */
+	tlsblock = (void *) (((uintptr_t) tlsblock + max_align - 1)
+			     & ~(max_align - 1));
+
+	/* Initialize the dtv.  [0] is the length, [1] the generation
+	   counter.  */
+	initdtv[0].counter = 1;
+	initdtv[1].counter = 0;
+
+	/* Initialize the TLS block.  */
+# if TLS_TCB_AT_TP
+	initdtv[2].pointer = tlsblock;
+# elif TLS_DTV_AT_TP
+	bootstrap_map.l_tls_offset = roundup (TLS_INIT_TCB_SIZE,
+					      bootstrap_map.l_tls_align);
+	initdtv[2].pointer = (char *) tlsblock + bootstrap_map.l_tls_offset;
+# else
+#  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+# endif
+	p = __mempcpy (initdtv[2].pointer, bootstrap_map.l_tls_initimage,
+		       bootstrap_map.l_tls_initimage_size);
+# ifdef HAVE_BUILTIN_MEMSET
+	__builtin_memset (p, '\0', (bootstrap_map.l_tls_blocksize
+				    - bootstrap_map.l_tls_initimage_size));
+# else
+	{
+	  size_t remaining = (bootstrap_map.l_tls_blocksize
+			      - bootstrap_map.l_tls_initimage_size);
+	  while (remaining-- > 0)
+	    *p++ = '\0';
+	}
+# endif
+
+	/* Install the pointer to the dtv.  */
+
+	/* Initialize the thread pointer.  */
+# if TLS_TCB_AT_TP
+	bootstrap_map.l_tls_offset
+	  = roundup (bootstrap_map.l_tls_blocksize, TLS_INIT_TCB_ALIGN);
+
+	INSTALL_DTV ((char *) tlsblock + bootstrap_map.l_tls_offset,
+		     initdtv);
+
+	const char *lossage = TLS_INIT_TP ((char *) tlsblock
+					   + bootstrap_map.l_tls_offset, 0);
+# elif TLS_DTV_AT_TP
+	INSTALL_DTV (tlsblock, initdtv);
+	const char *lossage = TLS_INIT_TP (tlsblock, 0);
+# else
+#  error "Either TLS_TCB_AT_TP or TLS_DTV_AT_TP must be defined"
+# endif
+	if (__builtin_expect (lossage != NULL, 0))
+	  _dl_fatal_printf ("cannot set up thread-local storage: %s\n",
+			    lossage);
+
+	/* So far this is module number one.  */
+	bootstrap_map.l_tls_modid = 1;
+
+	/* There can only be one PT_TLS entry.  */
+	break;
+      }
+#endif	/* USE___THREAD */
+
 #ifdef ELF_MACHINE_BEFORE_RTLD_RELOC
   ELF_MACHINE_BEFORE_RTLD_RELOC (bootstrap_map.l_info);
 #endif
@@ -647,7 +779,7 @@ cannot allocate TLS data structures for initial thread");
 
   /* And finally install it for the main thread.  If ld.so itself uses
      TLS we know the thread pointer was initialized earlier.  */
-  const char *lossage = TLS_INIT_TP (tcbp, 0);
+  const char *lossage = TLS_INIT_TP (tcbp, USE___THREAD);
   if (__builtin_expect (lossage != NULL, 0))
     _dl_fatal_printf ("cannot set up thread-local storage: %s\n", lossage);
   tls_init_tp_called = true;
@@ -2178,7 +2310,7 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
      TLS we know the thread pointer was initialized earlier.  */
   if (! tls_init_tp_called)
     {
-      const char *lossage = TLS_INIT_TP (tcbp, 0);
+      const char *lossage = TLS_INIT_TP (tcbp, USE___THREAD);
       if (__builtin_expect (lossage != NULL, 0))
 	_dl_fatal_printf ("cannot set up thread-local storage: %s\n",
 			  lossage);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |    6 +-
 elf/rtld.c                                         |  138 +++++++++++++++++++-
 .../ieee754/dbl-64/wordsize-64/s_logb.c            |   29 +++-
 3 files changed, 161 insertions(+), 12 deletions(-)
 copy iconvdata/cp770.c => sysdeps/ieee754/dbl-64/wordsize-64/s_logb.c (66%)


hooks/post-receive
-- 
GNU C Library master sources


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