[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r1219 - in /fsf/trunk/libc: ./ csu/ nptl/ nptl/sysdeps/pthread/ nptl/sysdeps/pthread/bits/ nptl/sysdeps/unix/sysv/linux/ npt...



Author: eglibc
Date: Thu Jan 18 00:01:40 2007
New Revision: 1219

Log:
Import glibc-mainline for 2007-01-18

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/csu/libc-start.c
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/forward.c
    fsf/trunk/libc/nptl/sysdeps/pthread/bits/libc-lock.h
    fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h
    fsf/trunk/libc/nptl/sysdeps/pthread/setxid.h
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/s390/jmp-unwind.c
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
    fsf/trunk/libc/nscd/nscd_getserv_r.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/fatal-prepare.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/getdents.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Jan 18 00:01:40 2007
@@ -1,3 +1,32 @@
+2007-01-12  Steven Munroe  <sjmunroe@xxxxxxxxxx>
+	    Joe Kerian  <jkerian@xxxxxxxxxxxxx>
+
+	[BZ #2749]
+	* sysdeps/ieee754/ldbl-128ibm/s_copysignl.c: Include
+	<math_ldbl_opt.h>.  Remove weak_alias.  Use long_double_symbol macro.
+	(__copysignl): Use signbit() for comparison.
+	* sysdeps/ieee754/ldbl-128ibm/s_fabsl.c (__fabsl): Correct parms for
+	SET_LDOUBLE_WORDS64.
+
+	[BZ #2423, #2749]
+	* sysdeps/ieee754/ldbl-128ibm/s_ceill.c: Don't include <fenv_libc.h>.
+	(__ceill): Remove calls to fegetround(), fesetround().
+	* sysdeps/ieee754/ldbl-128ibm/s_floorl.c: Likewise.
+	* sysdeps/ieee754/ldbl-128ibm/s_roundl.c: Likewise.
+	* sysdeps/ieee754/ldbl-128ibm/s_truncl.c: Likewise.
+
+2007-01-17  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* nscd/nscd_getserv_r.c (nscd_getserv_r): Fix pastos.
+
+	* sysdeps/unix/sysv/linux/getdents.c (offsetof): Remove.
+
+2007-01-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/fatal-prepare.h: Use PTHFCT_CALL to
+	demangle pointer.
+	* csu/libc-start.c: Likewise.
+
 2007-01-16  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* sysdeps/posix/system.c: Remove NO_WAITPID support, it cannot

Modified: fsf/trunk/libc/csu/libc-start.c
==============================================================================
--- fsf/trunk/libc/csu/libc-start.c (original)
+++ fsf/trunk/libc/csu/libc-start.c Thu Jan 18 00:01:40 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -225,7 +225,7 @@
     {
       /* Remove the thread-local data.  */
 # ifdef SHARED
-      __libc_pthread_functions.ptr__nptl_deallocate_tsd ();
+      PTHFCT_CALL (ptr__nptl_deallocate_tsd, ());
 # else
       extern void __nptl_deallocate_tsd (void) __attribute ((weak));
       __nptl_deallocate_tsd ();
@@ -235,7 +235,8 @@
 	 terminate the entire process.  */
       result = 0;
 # ifdef SHARED
-      unsigned int *const ptr = __libc_pthread_functions.ptr_nthreads;
+      unsigned int *ptr = __libc_pthread_functions.ptr_nthreads;
+      PTR_DEMANGLE (ptr);
 # else
       extern unsigned int __nptl_nthreads __attribute ((weak));
       unsigned int *const ptr = &__nptl_nthreads;

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Thu Jan 18 00:01:40 2007
@@ -1,3 +1,19 @@
+2007-01-17  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+	(__lll_timedwait_tid): Add unwind info.
+
+	* sysdeps/unix/sysv/linux/libc_pthread_init.c: Don't just copy the
+	function table, mangle the pointers.
+	* sysdeps/pthread/pthread-functions.h: Define PTHFCT_CALL.
+	* forward.c: Use PTHFCT_CALL and __libc_pthread_functions_init.
+	* sysdeps/pthread/bits/libc-lock.h: When using __libc_pthread_functions
+	demangle pointers before use.
+	* sysdeps/unix/sysv/linux/s390/jmp-unwind.c: Use PTHFCT_CALL to
+	demangle pointer.
+	* sysdeps/unix/sysv/linux/jmp-unwind.c: Likewise.
+	* sysdeps/pthread/setxid.h: Likewise.
+
 2007-01-12  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* tst-rwlock7.c: Show some more information in case of correct

Modified: fsf/trunk/libc/nptl/forward.c
==============================================================================
--- fsf/trunk/libc/nptl/forward.c (original)
+++ fsf/trunk/libc/nptl/forward.c Thu Jan 18 00:01:40 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -29,16 +29,17 @@
 
 /* Pointers to the libc functions.  */
 struct pthread_functions __libc_pthread_functions attribute_hidden;
+int __libc_pthread_functions_init attribute_hidden;
 
 
 #define FORWARD2(name, rettype, decl, params, defaction) \
 rettype									      \
 name decl								      \
 {									      \
-  if (__libc_pthread_functions.ptr_##name == NULL)			      \
+  if (!__libc_pthread_functions_init)					      \
     defaction;								      \
 									      \
-  return __libc_pthread_functions.ptr_##name params;			      \
+  return PTHFCT_CALL (ptr_##name, params);				      \
 }
 
 #define FORWARD(name, decl, params, defretval) \

Modified: fsf/trunk/libc/nptl/sysdeps/pthread/bits/libc-lock.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/bits/libc-lock.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/bits/libc-lock.h Thu Jan 18 00:01:40 2007
@@ -1,5 +1,5 @@
 /* libc-internal interface for mutex locks.  NPTL version.
-   Copyright (C) 1996-2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2003, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -150,13 +150,17 @@
 
 /* Call thread functions through the function pointer table.  */
 #if defined SHARED && !defined NOT_IN_libc
-# define PTF(NAME) __libc_pthread_functions.ptr_##NAME
+# define PTFAVAIL(NAME) __libc_pthread_functions_init
 # define __libc_ptf_call(FUNC, ARGS, ELSE) \
-  (PTF(FUNC) != NULL ? PTF(FUNC) ARGS : ELSE)
-#else
-# define PTF(NAME) NAME
+  (__libc_pthread_functions_init ? PTHFCT_CALL (ptr_##FUNC, ARGS) : ELSE)
+# define __libc_ptf_call_always(FUNC, ARGS) \
+  PTHFCT_CALL (ptr_##FUNC, ARGS)
+#else
+# define PTFAVAIL(NAME) (NAME != NULL)
 # define __libc_ptf_call(FUNC, ARGS, ELSE) \
   __libc_maybe_call (FUNC, ARGS, ELSE)
+# define __libc_ptf_call_always(FUNC, ARGS) \
+  FUNC ARGS
 #endif
 
 
@@ -353,8 +357,9 @@
 /* Call handler iff the first call.  */
 #define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \
   do {									      \
-    if (PTF(__pthread_once) != NULL)					      \
-      PTF(__pthread_once) (&(ONCE_CONTROL), INIT_FUNCTION);		      \
+    if (PTFAVAIL (__pthread_once))					      \
+      __libc_ptf_call_always (__pthread_once, (&(ONCE_CONTROL),		      \
+					       INIT_FUNCTION));		      \
     else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) {			      \
       INIT_FUNCTION ();							      \
       (ONCE_CONTROL) |= 2;						      \
@@ -380,9 +385,10 @@
   { struct _pthread_cleanup_buffer _buffer;				      \
     int _avail;								      \
     if (DOIT) {								      \
-      _avail = PTF(_pthread_cleanup_push_defer) != NULL;		      \
+      _avail = PTFAVAIL (_pthread_cleanup_push_defer);			      \
       if (_avail) {							      \
-	PTF(_pthread_cleanup_push_defer) (&_buffer, FCT, ARG);		      \
+	__libc_ptf_call_always (_pthread_cleanup_push_defer, (&_buffer, FCT,  \
+							      ARG));	      \
       } else {								      \
 	_buffer.__routine = (FCT);					      \
 	_buffer.__arg = (ARG);						      \
@@ -394,7 +400,7 @@
 /* End critical region with cleanup.  */
 #define __libc_cleanup_region_end(DOIT) \
     if (_avail) {							      \
-      PTF(_pthread_cleanup_pop_restore) (&_buffer, DOIT);		      \
+      __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\
     } else if (DOIT)							      \
       _buffer.__routine (_buffer.__arg);				      \
   }
@@ -402,7 +408,7 @@
 /* Sometimes we have to exit the block in the middle.  */
 #define __libc_cleanup_end(DOIT) \
     if (_avail) {							      \
-      PTF(_pthread_cleanup_pop_restore) (&_buffer, DOIT);		      \
+      __libc_ptf_call_always (_pthread_cleanup_pop_restore, (&_buffer, DOIT));\
     } else if (DOIT)							      \
       _buffer.__routine (_buffer.__arg)
 

Modified: fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/pthread-functions.h Thu Jan 18 00:01:40 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2003.
 
@@ -23,6 +23,7 @@
 #include <pthread.h>
 #include <setjmp.h>
 #include <internaltypes.h>
+#include <sysdep.h>
 
 struct xid_command;
 
@@ -100,5 +101,12 @@
 
 /* Variable in libc.so.  */
 extern struct pthread_functions __libc_pthread_functions attribute_hidden;
+extern int __libc_pthread_functions_init attribute_hidden;
+
+#define PTHFCT_CALL(fct, params) \
+  ({ __typeof (__libc_pthread_functions.fct) __p;			      \
+     __p = __libc_pthread_functions.fct;				      \
+     PTR_DEMANGLE (__p);						      \
+     __p params; })
 
 #endif	/* pthread-functions.h */

Modified: fsf/trunk/libc/nptl/sysdeps/pthread/setxid.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/pthread/setxid.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/pthread/setxid.h Thu Jan 18 00:01:40 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -33,13 +33,12 @@
 # define INLINE_SETXID_SYSCALL(name, nr, args...) \
   ({									\
     int __result;							\
-    if (__builtin_expect (__libc_pthread_functions.ptr__nptl_setxid	\
-			  != NULL, 0))					\
+    if (__builtin_expect (__libc_pthread_functions_init, 0))		\
       {									\
 	struct xid_command __cmd;					\
 	__cmd.syscall_no = __NR_##name;					\
 	__SETXID_##nr (__cmd, args);					\
-	__result = __libc_pthread_functions.ptr__nptl_setxid (&__cmd);	\
+	__result = PTHFCT_CALL (ptr__nptl_setxid, (&__cmd));		\
 	}								\
     else								\
       __result = INLINE_SYSCALL (name, nr, args);			\

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/jmp-unwind.c Thu Jan 18 00:01:40 2007
@@ -1,5 +1,5 @@
 /* Clean up stack frames unwound by longjmp.  Linux version.
-   Copyright (C) 1995, 1997, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997, 2002, 2003, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -29,11 +29,11 @@
 _longjmp_unwind (jmp_buf env, int val)
 {
 #ifdef SHARED
-# define fptr __libc_pthread_functions.ptr___pthread_cleanup_upto
+  if (__libc_pthread_functions_init)
+    PTHFCT_CALL (ptr___pthread_cleanup_upto, (env->__jmpbuf,
+					      CURRENT_STACK_FRAME));
 #else
-# define fptr __pthread_cleanup_upto
+  if (__pthread_cleanup_upto != NULL)
+    __pthread_cleanup_upto (env->__jmpbuf, CURRENT_STACK_FRAME);
 #endif
-
-  if (fptr != NULL)
-    fptr (env->__jmpbuf, CURRENT_STACK_FRAME);
 }

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c Thu Jan 18 00:01:40 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <pthreadP.h>
 #include <bits/libc-lock.h>
+#include <sysdep.h>
 
 
 #ifdef TLS_MULTIPLE_THREADS_IN_TCB
@@ -46,11 +47,29 @@
   __register_atfork (NULL, NULL, reclaim, NULL);
 
 #ifdef SHARED
-  /* We copy the content of the variable pointed to by the FUNCTIONS
-     parameter to one in libc.so since this means access to the array
-     can be done with one memory access instead of two.  */
-  memcpy (&__libc_pthread_functions, functions,
-	  sizeof (__libc_pthread_functions));
+  /* Copy the function pointers into an array in libc.  This enables
+     access with just one memory reference but moreso, it prevents
+     hijacking the function pointers with just one pointer change.  We
+     "encrypt" the function pointers since we cannot write-protect the
+     array easily enough.  */
+  union ptrhack
+  {
+    struct pthread_functions pf;
+    void *parr[1];
+  } const *src;
+  union ptrhack *dest;
+# define NPTRS (sizeof (struct pthread_functions) / sizeof (void *))
+
+  src = (const void *) functions;
+  dest = (void *) &__libc_pthread_functions;
+
+  for (size_t cnt = 0; cnt < NPTRS; ++cnt)
+    {
+      void *p = src->parr[cnt];
+      PTR_MANGLE (p);
+      dest->parr[cnt] = p;
+    }
+  __libc_pthread_functions_init = 1;
 #endif
 
 #ifndef TLS_MULTIPLE_THREADS_IN_TCB
@@ -61,7 +80,7 @@
 #ifdef SHARED
 libc_freeres_fn (freeres_libptread)
 {
-  if (__libc_pthread_functions.ptr_freeres != NULL)
-    __libc_pthread_functions.ptr_freeres ();
+  if (__libc_pthread_functions_init)
+    PTHFCT_CALL (ptr_freeres, ());
 }
 #endif

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/s390/jmp-unwind.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/s390/jmp-unwind.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/s390/jmp-unwind.c Thu Jan 18 00:01:40 2007
@@ -1,5 +1,5 @@
 /* Clean up stack frames unwound by longjmp.  Linux/s390 version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,14 +28,13 @@
 void
 _longjmp_unwind (jmp_buf env, int val)
 {
-#ifdef SHARED
-# define fptr __libc_pthread_functions.ptr___pthread_cleanup_upto
-#else
-# define fptr __pthread_cleanup_upto
-#endif
-
   unsigned char local_var;
 
-  if (fptr != NULL)
-    fptr (env->__jmpbuf, &local_var);
+#ifdef SHARED
+  if (__libc_pthread_functions_init)
+    PTHFCT_CALL (ptr___pthread_cleanup_upto, (env->__jmpbuf, &local_var));
+#else
+  if (__pthread_cleanup_upto != NULL)
+    __pthread_cleanup_upto (env->__jmpbuf, &local_var);
+#endif
 }

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S Thu Jan 18 00:01:40 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -269,13 +269,19 @@
 	.hidden	__lll_timedwait_tid
 	.align	16
 __lll_timedwait_tid:
+	cfi_startproc
 	pushq	%r12
+	cfi_adjust_cfa_offset(8)
 	pushq	%r13
+	cfi_adjust_cfa_offset(8)
+	cfi_offset(%r12, -16)
+	cfi_offset(%r13, -24)
 
 	movq	%rdi, %r12
 	movq	%rsi, %r13
 
 	subq	$16, %rsp
+	cfi_adjust_cfa_offset(16)
 
 	/* Get current time.  */
 2:	movq	%rsp, %rdi
@@ -319,14 +325,21 @@
 4:	xorl	%eax, %eax
 
 8:	addq	$16, %rsp
+	cfi_adjust_cfa_offset(-16)
 	popq	%r13
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r13)
 	popq	%r12
-	retq
-
+	cfi_adjust_cfa_offset(-8)
+	cfi_restore(%r12)
+	retq
+
+	cfi_adjust_cfa_offset(32)
 1:	cmpq	$-ETIMEDOUT, %rax
 	jne	2b
 
 6:	movl	$ETIMEDOUT, %eax
 	jmp	8b
+	cfi_endproc
 	.size	__lll_timedwait_tid,.-__lll_timedwait_tid
 #endif

Modified: fsf/trunk/libc/nscd/nscd_getserv_r.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd_getserv_r.c (original)
+++ fsf/trunk/libc/nscd/nscd_getserv_r.c Thu Jan 18 00:01:40 2007
@@ -123,10 +123,10 @@
 	  if (((uintptr_t) aliases_len & (__alignof__ (*aliases_len) - 1))
 	      != 0)
 	    {
-	      uint32_t *tmp = alloca (hst_resp->h_aliases_cnt
+	      uint32_t *tmp = alloca (serv_resp->s_aliases_cnt
 				      * sizeof (uint32_t));
 	      aliases_len = memcpy (tmp, aliases_len,
-				    hst_resp->h_aliases_cnt
+				    serv_resp->s_aliases_cnt
 				    * sizeof (uint32_t));
 	    }
 #endif

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_ceill.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_ceill.c Thu Jan 18 00:01:40 2007
@@ -1,6 +1,6 @@
 /* Ceil (round to +inf) long double floating-point values.
    IBM extended format long double version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
    02111-1307 USA.  */
 
 #include <math.h>
-#include <fenv_libc.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
@@ -44,11 +43,9 @@
 					     __builtin_inf ()), 1))
     {
       double orig_xh;
-      int save_round = fegetround ();
 
       /* Long double arithmetic, including the canonicalisation below,
 	 only works in round-to-nearest mode.  */
-      fesetround (FE_TONEAREST);
 
       /* Convert the high double to integer.  */
       orig_xh = xh;
@@ -81,8 +78,6 @@
       /* Ensure we return -0 rather than +0 when appropriate.  */
       if (orig_xh < 0.0)
 	xh = -__builtin_fabs (xh);
-
-      fesetround (save_round);
     }
 
   return ldbl_pack (xh, xl);

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c Thu Jan 18 00:01:40 2007
@@ -25,6 +25,7 @@
 
 #include "math.h"
 #include "math_private.h"
+#include <math_ldbl_opt.h>
 
 #ifdef __STDC__
 	long double __copysignl(long double x, long double y)
@@ -33,13 +34,13 @@
 	long double x,y;
 #endif
 {
-  if (y < 0.0)
-    {
-      if (x >= 0.0)
-	x = -x;
-    }
-  else if (x < 0.0)
+  if (signbit (x) != signbit (y))
     x = -x;
   return x;
 }
-weak_alias (__copysignl, copysignl)
+
+#ifdef IS_IN_libm
+long_double_symbol (libm, __copysignl, copysignl);
+#else
+long_double_symbol (libc, __copysignl, copysignl);
+#endif

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c Thu Jan 18 00:01:40 2007
@@ -37,7 +37,7 @@
 	GET_LDOUBLE_WORDS64(hx,lx,x);
 	lx = lx ^ ( hx & 0x8000000000000000LL );
 	hx = hx & 0x7fffffffffffffffLL;
-	SET_LDOUBLE_WORDS64(hx,lx,x);
-        return x;
+	SET_LDOUBLE_WORDS64(x,hx,lx);
+	return x;
 }
 long_double_symbol (libm, __fabsl, fabsl);

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_floorl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_floorl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_floorl.c Thu Jan 18 00:01:40 2007
@@ -1,6 +1,6 @@
 /* Round to int long double floating-point values.
    IBM extended format long double version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -19,7 +19,6 @@
    02111-1307 USA.  */
 
 #include <math.h>
-#include <fenv_libc.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
@@ -43,11 +42,8 @@
 			&& __builtin_isless (__builtin_fabs (xh),
 					     __builtin_inf ()), 1))
     {
-      int save_round = fegetround ();
-
       /* Long double arithmetic, including the canonicalisation below,
 	 only works in round-to-nearest mode.  */
-      fesetround (FE_TONEAREST);
 
       /* Convert the high double to integer.  */
       hi = ldbl_nearbyint (xh);
@@ -75,8 +71,6 @@
       xh = hi;
       xl = lo;
       ldbl_canonicalize (&xh, &xl);
-
-      fesetround (save_round);
     }
 
   return ldbl_pack (xh, xl);

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_roundl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_roundl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_roundl.c Thu Jan 18 00:01:40 2007
@@ -1,6 +1,6 @@
 /* Round to int long double floating-point values.
    IBM extended format long double version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,7 +22,6 @@
    when it's coded in C.  */
 
 #include <math.h>
-#include <fenv_libc.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
@@ -47,11 +46,9 @@
 					     __builtin_inf ()), 1))
     {
       double orig_xh;
-      int save_round = fegetround ();
 
       /* Long double arithmetic, including the canonicalisation below,
 	 only works in round-to-nearest mode.  */
-      fesetround (FE_TONEAREST);
 
       /* Convert the high double to integer.  */
       orig_xh = xh;
@@ -88,8 +85,6 @@
       xh = hi;
       xl = lo;
       ldbl_canonicalize (&xh, &xl);
-
-      fesetround (save_round);
     }
 
   return ldbl_pack (xh, xl);

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_truncl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_truncl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/s_truncl.c Thu Jan 18 00:01:40 2007
@@ -1,6 +1,6 @@
 /* Truncate (toward zero) long double floating-point values.
    IBM extended format long double version.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,7 +22,6 @@
    when it's coded in C.  */
 
 #include <math.h>
-#include <fenv_libc.h>
 #include <math_ldbl_opt.h>
 #include <float.h>
 #include <ieee754.h>
@@ -47,11 +46,9 @@
 					     __builtin_inf ()), 1))
     {
       double orig_xh;
-      int save_round = fegetround ();
 
       /* Long double arithmetic, including the canonicalisation below,
 	 only works in round-to-nearest mode.  */
-      fesetround (FE_TONEAREST);
 
       /* Convert the high double to integer.  */
       orig_xh = xh;
@@ -92,8 +89,6 @@
       /* Ensure we return -0 rather than +0 when appropriate.  */
       if (orig_xh < 0.0)
 	xh = -__builtin_fabs (xh);
-
-      fesetround (save_round);
     }
 
   return ldbl_pack (xh, xl);

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/fatal-prepare.h
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/fatal-prepare.h (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/fatal-prepare.h Thu Jan 18 00:01:40 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,10 +24,9 @@
 # include <pthread-functions.h>
 # define FATAL_PREPARE \
   {									      \
-    int (*fp) (int, int *);						      \
-    fp = __libc_pthread_functions.ptr_pthread_setcancelstate;		      \
-    if (fp != NULL)							      \
-      fp (PTHREAD_CANCEL_DISABLE, NULL);				      \
+    if (__libc_pthread_functions_init)					      \
+      PTHFCT_CALL (ptr_pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE,	      \
+						NULL));			      \
   }
 #else
 # pragma weak pthread_setcancelstate

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/getdents.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/getdents.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/getdents.c Thu Jan 18 00:01:40 2007
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993, 1995-2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995-2003, 2004, 2006, 2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -49,8 +50,6 @@
 #ifndef have_no_getdents64_defined
 # define __have_no_getdents64 0
 #endif
-
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 
 /* For Linux we need a special version of this file since the
    definition of `struct dirent' is not the same for the kernel and