summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2010-01-04 14:49:08 +0100
committerAndreas Schwab <schwab@redhat.com>2010-01-04 14:49:08 +0100
commit16a7541439c5ae36181e7f454b5a81f8c25aecf4 (patch)
treefca6aa176c1479ed6c3b792692473675b5ab4613
parent600f9723fc372c37adfa171aae8e1f62cb5d5bba (diff)
parentc10f8866e5b673b6f41dcb14c8ea319f5e545b1a (diff)
downloadglibc-16a7541439c5ae36181e7f454b5a81f8c25aecf4.tar.gz
glibc-16a7541439c5ae36181e7f454b5a81f8c25aecf4.tar.xz
glibc-16a7541439c5ae36181e7f454b5a81f8c25aecf4.zip
Merge remote branch 'origin/master' into fedora/master
-rw-r--r--ChangeLog56
-rw-r--r--bits/poll.h6
-rwxr-xr-xconfigure49
-rw-r--r--configure.in35
-rw-r--r--elf/dl-lookup.c7
-rw-r--r--elf/dl-object.c8
-rw-r--r--hurd/hurdioctl.c24
-rw-r--r--include/link.h8
-rw-r--r--include/stdlib.h6
-rw-r--r--nptl/ChangeLog11
-rw-r--r--nptl/pthread_rwlock_init.c17
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c8
-rw-r--r--stdlib/Makefile3
-rw-r--r--stdlib/tst-makecontext3.c217
-rw-r--r--stdlib/tst-setcontext.c2
-rw-r--r--sysdeps/mach/hurd/getcwd.c4
-rw-r--r--sysdeps/s390/s390-32/dl-machine.h5
-rw-r--r--sysdeps/s390/s390-64/dl-machine.h2
-rw-r--r--sysdeps/unix/sysv/linux/bits/poll.h4
-rw-r--r--sysdeps/unix/sysv/linux/futimens.c5
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/poll.h4
22 files changed, 413 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog
index e65c3587c5..5efb4b83d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,59 @@
+2009-12-15  Maciej W. Rozycki  <macro@codesourcery.com>
+
+	[BZ #11115]
+	* stdlib/tst-makecontext3.c: New file.
+	* stdlib/Makefile (tests): Add new test.
+
+	* stdlib/tst-setcontext.c (check_called): Fix a typo.
+
+2009-12-17  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* configure.in: Enable multi-arch by default if the assembler
+	supports gnu_indirect_function symbol type and the architecture
+	supports it.
+
+2009-12-23  Ulrich Drepper  <drepper@redhat.com>
+
+	* include/stdlib.h: Exclude some includes and prototypes if _ISOMAC
+	is defined.
+
+2009-12-22  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* hurd/hurdioctl.c (_hurd_locked_install_cttyid): Set newctty to
+	MACH_PORT_NULL when id != cttyid.
+
+2009-12-20  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/mach/hurd/getcwd.c (cleanup): Do not call
+	__mach_port_deallocate on rootdevid.
+
+2009-12-17  Martin Schwidefsky  <schwidefsky@de.ibm.com>
+
+	* sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela): Handle
+	R_390_PC32DBL. Remove unneeded R_390_PLT16DBL.
+	* sysdeps/s390/s390-32/dl-machine.h (elf_machine_rela): Remove
+	unneeded R_390_PLT16DBL and R_390_PLT32DBL.
+
+2009-12-21  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #10992]
+	* sysdeps/unix/sysv/linux/futimens.c: Handle AT_FDCWD.
+	Patch by Eric Blake <ebb9@byu.net>.
+
+2009-12-15  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #11093]
+	* bits/poll.h: Define POLLRDNORM, POLLRDBAND, POLLWRNORM, and
+	POLLWRBAND also for POSIX 2008.
+	* sysdeps/unix/sysv/linux/bits/poll.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/bits/poll.h: Likewise.
+
+	* include/link.h (struct link_map): Move l_used into its own word.
+	* elf/dl-lookup.c (_dl_lookup_symbol_x): Only update l_used when it is
+	still zero.
+	* elf/dl-object.c (_dl_new_object): Set dl_used if we know it is
+	never really used.
+
 2009-12-13  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* sysdeps/i386/i686/multiarch/strcspn.S Include <init-arch.h>
diff --git a/bits/poll.h b/bits/poll.h
index 022a06cc1b..0ee9b00583 100644
--- a/bits/poll.h
+++ b/bits/poll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2000, 2001, 2009 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
@@ -27,8 +27,8 @@
 #define POLLPRI		02              /* There is urgent data to read.  */
 #define POLLOUT		04              /* Writing now will not block.  */
 
-#ifdef __USE_XOPEN
-/* These values are defined in XPG4.2.  */
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
+/* These values are defined in XPG4.2 and later.  */
 # define POLLRDNORM	POLLIN		/* Normal data may be read.  */
 # define POLLRDBAND	POLLPRI		/* Priority data may be read.  */
 # define POLLWRNORM	POLLOUT		/* Writing now will not block.  */
diff --git a/configure b/configure
index ce76653821..49ac30db46 100755
--- a/configure
+++ b/configure
@@ -724,12 +724,12 @@ INSTALL_PROGRAM
 sysdeps_add_ons
 sysnames
 submachine
+multi_arch
 base_machine
 add_on_subdirs
 add_ons
 libc_cv_nss_crypt
 experimental_malloc
-multi_arch
 all_warnings
 force_install
 bindnow
@@ -3801,18 +3801,13 @@ fi
 if test "${enable_multi_arch+set}" = set; then
   enableval=$enable_multi_arch; multi_arch=$enableval
 else
-  multi_arch=no
+  multi_arch=default
 fi
 
-if test x"$multi_arch" = xyes; then
-  cat >>confdefs.h <<\_ACEOF
-#define USE_MULTIARCH 1
-_ACEOF
-
+if test x"$multi_arch" != xno; then
   multi_arch_d=/multiarch
 fi
 
-
 # Check whether --enable-experimental-malloc was given.
 if test "${enable_experimental_malloc+set}" = set; then
   enableval=$enable_experimental_malloc; experimental_malloc=$enableval
@@ -4359,6 +4354,44 @@ for b in $base ''; do
   done
 done
 
+# If the assembler supports gnu_indirect_function symbol type and the
+# architecture supports multi-arch, we enable multi-arch by default.
+if test "$multi_arch" = default; then
+{ $as_echo "$as_me:$LINENO: checking for assembler gnu_indirect_function symbol type support" >&5
+$as_echo_n "checking for assembler gnu_indirect_function symbol type support... " >&6; }
+if test "${libc_cv_asm_gnu_indirect_function+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.s <<EOF
+.type foo,%gnu_indirect_function
+EOF
+if ${CC-cc} -c $ASFLAGS conftest.s 1>&5 2>&5;
+then
+  libc_cv_asm_gnu_indirect_function=yes
+else
+  libc_cv_asm_gnu_indirect_function=no
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:$LINENO: result: $libc_cv_asm_gnu_indirect_function" >&5
+$as_echo "$libc_cv_asm_gnu_indirect_function" >&6; }
+  multi_arch=no
+  if test "$libc_cv_asm_gnu_indirect_function" = yes; then
+    case $sysnames_add_ons$sysnames in
+    *"$multi_arch_d"*)
+       multi_arch=yes
+      ;;
+    esac
+  fi
+fi
+if test x"$multi_arch" = xyes; then
+  cat >>confdefs.h <<\_ACEOF
+#define USE_MULTIARCH 1
+_ACEOF
+
+fi
+
+
 if test -z "$os_used" && test "$os" != none; then
   { { $as_echo "$as_me:$LINENO: error: Operating system $os is not supported." >&5
 $as_echo "$as_me: error: Operating system $os is not supported." >&2;}
diff --git a/configure.in b/configure.in
index 182c683e50..8e506026b8 100644
--- a/configure.in
+++ b/configure.in
@@ -272,12 +272,10 @@ AC_ARG_ENABLE([multi-arch],
 	      AC_HELP_STRING([--enable-multi-arch],
 			     [enable single DSO with optimizations for multiple architectures]),
 	      [multi_arch=$enableval],
-	      [multi_arch=no])
-if test x"$multi_arch" = xyes; then
-  AC_DEFINE(USE_MULTIARCH)
+	      [multi_arch=default])
+if test x"$multi_arch" != xno; then
   multi_arch_d=/multiarch
 fi
-AC_SUBST(multi_arch)
 
 AC_ARG_ENABLE([experimental-malloc],
 	      AC_HELP_STRING([--enable-experimental-malloc],
@@ -722,6 +720,35 @@ for b in $base ''; do
   done
 done
 
+# If the assembler supports gnu_indirect_function symbol type and the
+# architecture supports multi-arch, we enable multi-arch by default.
+if test "$multi_arch" = default; then
+AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
+               libc_cv_asm_gnu_indirect_function, [dnl
+cat > conftest.s <<EOF
+.type foo,%gnu_indirect_function
+EOF
+if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
+then
+  libc_cv_asm_gnu_indirect_function=yes
+else
+  libc_cv_asm_gnu_indirect_function=no
+fi
+rm -f conftest*])
+  multi_arch=no
+  if test "$libc_cv_asm_gnu_indirect_function" = yes; then
+    case $sysnames_add_ons$sysnames in
+    *"$multi_arch_d"*)
+       multi_arch=yes
+      ;;
+    esac
+  fi
+fi
+if test x"$multi_arch" = xyes; then
+  AC_DEFINE(USE_MULTIARCH)
+fi
+AC_SUBST(multi_arch)
+
 if test -z "$os_used" && test "$os" != none; then
   AC_MSG_ERROR(Operating system $os is not supported.)
 fi
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index c1a1366d6f..763ec16fa4 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -777,7 +777,7 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
   if (__builtin_expect (protected != 0, 0))
     {
       /* It is very tricky.  We need to figure out what value to
-         return for the protected symbol.  */
+	 return for the protected symbol.  */
       if (type_class == ELF_RTYPE_CLASS_PLT)
 	{
 	  if (current_value.s != NULL && current_value.m != undef_map)
@@ -822,7 +822,8 @@ _dl_lookup_symbol_x (const char *undef_name, struct link_map *undef_map,
 				  version, type_class, flags, skip_map);
 
   /* The object is used.  */
-  current_value.m->l_used = 1;
+  if (__builtin_expect (current_value.m->l_used == 0, 0))
+    current_value.m->l_used = 1;
 
   if (__builtin_expect (GLRO(dl_debug_mask)
 			& (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0))
@@ -844,7 +845,7 @@ _dl_setup_hash (struct link_map *map)
   Elf_Symndx nchain;
 
   if (__builtin_expect (map->l_info[DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM
-  				    + DT_THISPROCNUM + DT_VERSIONTAGNUM
+				    + DT_THISPROCNUM + DT_VERSIONTAGNUM
 				    + DT_EXTRANUM + DT_VALNUM] != NULL, 1))
     {
       Elf32_Word *hash32
diff --git a/elf/dl-object.c b/elf/dl-object.c
index be4ea38f9f..788e2c07b9 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -1,5 +1,5 @@
 /* Storage management for the chain of loaded shared objects.
-   Copyright (C) 1995-2002,2004,2006,2007,2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-2002,2004,2006-2008,2009 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
@@ -67,6 +67,10 @@ _dl_new_object (char *realname, const char *libname, int type,
 
   new->l_name = realname;
   new->l_type = type;
+  /* If we set the bit now since we know it is never used we avoid
+     dirtying the cache line later.  */
+  if ((GLRO(dl_debug_mask) & DL_DEBUG_UNUSED) == 0)
+    new->l_used = 1;
   new->l_loader = loader;
 #if NO_TLS_OFFSET != 0
   new->l_tls_offset = NO_TLS_OFFSET;
@@ -174,7 +178,7 @@ _dl_new_object (char *realname, const char *libname, int type,
 	  if (result == NULL)
 	    {
 	      /* We were not able to determine the current directory.
-	         Note that free(origin) is OK if origin == NULL.  */
+		 Note that free(origin) is OK if origin == NULL.  */
 	      free (origin);
 	      origin = (char *) -1;
 	      goto out;
diff --git a/hurd/hurdioctl.c b/hurd/hurdioctl.c
index 96d910ba1a..7c689841ca 100644
--- a/hurd/hurdioctl.c
+++ b/hurd/hurdioctl.c
@@ -1,5 +1,6 @@
 /* ioctl commands which must be done in the C library.
-   Copyright (C) 1994,95,96,97,99,2001,02 Free Software Foundation, Inc.
+   Copyright (C) 1994,95,96,97,99,2001,2002,2009
+	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
@@ -169,33 +170,28 @@ _hurd_locked_install_cttyid (mach_port_t cttyid)
   for (i = 0; i < _hurd_dtablesize; ++i)
     {
       struct hurd_fd *const d = _hurd_dtable[i];
-      mach_port_t newctty;
+      mach_port_t newctty = MACH_PORT_NULL;
 
       if (d == NULL)
 	/* Nothing to do for an unused descriptor cell.  */
 	continue;
 
-      if (cttyid == MACH_PORT_NULL)
-	/* We now have no controlling tty at all.  */
-	newctty = MACH_PORT_NULL;
-      else
+      if (cttyid != MACH_PORT_NULL)
+	/* We do have some controlling tty.  */
 	HURD_PORT_USE (&d->port,
 		       ({ mach_port_t id;
 			  /* Get the io object's cttyid port.  */
 			  if (! __term_getctty (port, &id))
 			    {
-			      if (id == cttyid && /* Is it ours?  */
+			      if (id == cttyid /* Is it ours?  */
 				  /* Get the ctty io port.  */
-				  __term_open_ctty (port,
-						    _hurd_pid, _hurd_pgrp,
-						    &newctty))
+				  && __term_open_ctty (port,
+						       _hurd_pid, _hurd_pgrp,
+						       &newctty))
 				/* XXX it is our ctty but the call failed? */
 				newctty = MACH_PORT_NULL;
-			      __mach_port_deallocate
-				(__mach_task_self (), (mach_port_t) id);
+			      __mach_port_deallocate (__mach_task_self (), id);
 			    }
-			  else
-			    newctty = MACH_PORT_NULL;
 			  0;
 			}));
 
diff --git a/include/link.h b/include/link.h
index 4b9978ad61..26c67438f0 100644
--- a/include/link.h
+++ b/include/link.h
@@ -1,6 +1,6 @@
 /* Data structure for communication from the run-time dynamic linker for
    loaded ELF shared objects.
-   Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1995-2006, 2007, 2009 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
@@ -180,7 +180,6 @@ struct link_map
     unsigned int l_need_tls_init:1; /* Nonzero if GL(dl_init_static_tls)
 				       should be called on this link map
 				       when relocation finishes.  */
-    unsigned int l_used:1;	/* Nonzero if the DSO is used.  */
     unsigned int l_auditing:1;	/* Nonzero if the DSO is used in auditing.  */
     unsigned int l_audit_any_plt:1; /* Nonzero if at least one audit module
 				       is interested in the PLT interception.*/
@@ -239,12 +238,15 @@ struct link_map
     struct link_map **l_initfini;
 
     /* List of the dependencies introduced through symbol binding.  */
-    unsigned int l_reldepsmax;
     struct link_map_reldeps
       {
 	unsigned int act;
 	struct link_map *list[];
       } *l_reldeps;
+    unsigned int l_reldepsmax;
+
+    /* Nonzero if the DSO is used.  */
+    unsigned int l_used;
 
     /* Various flag words.  */
     ElfW(Word) l_feature_1;
diff --git a/include/stdlib.h b/include/stdlib.h
index f540bece9c..b4799d7d04 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -9,7 +9,9 @@
 
 /* Now define the internal interfaces.  */
 #ifndef __Need_M_And_C
-# include <sys/stat.h>
+# ifndef _ISOMAC
+#  include <sys/stat.h>
+# endif
 
 __BEGIN_DECLS
 
@@ -78,8 +80,10 @@ extern int __clearenv (void);
 extern char *__canonicalize_file_name (__const char *__name);
 extern char *__realpath (__const char *__name, char *__resolved);
 extern int __ptsname_r (int __fd, char *__buf, size_t __buflen);
+# ifndef _ISOMAC
 extern int __ptsname_internal (int fd, char *buf, size_t buflen,
 			       struct stat64 *stp);
+# endif
 extern int __getpt (void);
 extern int __posix_openpt (int __oflag);
 
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index b0ba4b4f43..b79834a32c 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,14 @@
+2009-12-18  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c (_init): Don't
+	call __gmon_start__.
+	* sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c (_init): Likewise.
+
+2009-12-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* pthread_rwlock_init.c (__pthread_rwlock_init): Simplify code by
+	using memset.
+
 2009-12-01  Dinakar Guniguntala  <dino@in.ibm.com>
 
 	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.h: Define
diff --git a/nptl/pthread_rwlock_init.c b/nptl/pthread_rwlock_init.c
index 27f25ac2ab..c0aa194107 100644
--- a/nptl/pthread_rwlock_init.c
+++ b/nptl/pthread_rwlock_init.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -37,13 +37,7 @@ __pthread_rwlock_init (rwlock, attr)
 
   iattr = ((const struct pthread_rwlockattr *) attr) ?: &default_attr;
 
-  rwlock->__data.__lock = 0;
-  rwlock->__data.__nr_readers = 0;
-  rwlock->__data.__readers_wakeup = 0;
-  rwlock->__data.__writer_wakeup = 0;
-  rwlock->__data.__nr_readers_queued = 0;
-  rwlock->__data.__nr_writers_queued = 0;
-  rwlock->__data.__writer = 0;
+  memset (rwlock, '\0', sizeof (*rwlock));
 
   rwlock->__data.__flags
     = iattr->lockkind == PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP;
@@ -56,8 +50,8 @@ __pthread_rwlock_init (rwlock, attr)
      0x80 in case private futexes are available and zero otherwise.
      This leads to the following table:
 
-                 |     pshared     |     result
-                 | shared  private | shared  private |
+		 |     pshared     |     result
+		 | shared  private | shared  private |
      ------------+-----------------+-----------------+
      !avail 0    |     0       0   |     0       0   |
       avail 0x80 |  0x80       0   |     0    0x80   |
@@ -74,9 +68,6 @@ __pthread_rwlock_init (rwlock, attr)
 					      header.private_futex));
 #endif
 
-  rwlock->__data.__pad1 = 0;
-  rwlock->__data.__pad2 = 0;
-
   return 0;
 }
 strong_alias (__pthread_rwlock_init, pthread_rwlock_init)
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c b/nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c
index 40d4d50c32..eb09b4aaa9 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c
+++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-32/pt-initfini.c
@@ -1,5 +1,5 @@
 /* Special .init and .fini section support for S/390.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it
@@ -67,8 +67,6 @@ _init:\n\
 .LT1_0:\n\
 .LC13:\n\
 	.long	__pthread_initialize_minimal_internal-.LT1_0\n\
-.LC14:\n\
-	.long	__gmon_start__@GOT\n\
 .LC15:\n\
 	.long	_GLOBAL_OFFSET_TABLE_-.LT1_0\n\
 .LTN1_0:\n\
@@ -80,12 +78,6 @@ _init:\n\
 	L     1,.LC13-.LT1_0(13)\n\
 	LA    1,0(1,13)\n\
 	BASR  14,1\n\
-	L     1,.LC14-.LT1_0(13)\n\
-	L     1,0(1,12)\n\
-	LTR   1,1\n\
-	JE    .L22\n\
-	BASR  14,1\n\
-.L22:\n\
 #APP\n\
 	.align 4,0x07\n\
 	END_INIT\n\
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c
index a102d07d6c..34951f6fbb 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c
+++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/pt-initfini.c
@@ -1,5 +1,5 @@
 /* Special .init and .fini section support for 64 bit S/390.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it
@@ -68,12 +68,6 @@ _init:\n\
 	STG	1,0(15)\n\
 	LARL	12,_GLOBAL_OFFSET_TABLE_\n\
 	BRASL	14,__pthread_initialize_minimal_internal\n\
-	LARL	1,__gmon_start__@GOTENT\n\
-	LG	1,0(1)\n\
-	LTGR	1,1\n\
-	JE	.L22\n\
-	BASR	14,1\n\
-.L22:\n\
 #APP\n\
 	.align 4,0x07\n\
 	END_INIT\n\
diff --git a/stdlib/Makefile b/stdlib/Makefile
index d361dd8ffa..bb0661af3b 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -70,7 +70,8 @@ tests		:= tst-strtol tst-strtod testmb testrand testsort testdiv   \
 		   test-a64l tst-qsort tst-system testmb2 bug-strtod2	    \
 		   tst-atof1 tst-atof2 tst-strtod2 tst-strtod3 tst-rand48-2 \
 		   tst-makecontext tst-strtod4 tst-strtod5 tst-qsort2	    \
-		   tst-makecontext2 tst-strtod6 tst-unsetenv1
+		   tst-makecontext2 tst-strtod6 tst-unsetenv1		    \
+		   tst-makecontext3
 
 include ../Makeconfig
 
diff --git a/stdlib/tst-makecontext3.c b/stdlib/tst-makecontext3.c
new file mode 100644
index 0000000000..f127c6a579
--- /dev/null
+++ b/stdlib/tst-makecontext3.c
@@ -0,0 +1,217 @@
+/* Copyright (C) 2001,2002,2004,2006,2009 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
+   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, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ucontext.h>
+#include <unistd.h>
+
+static ucontext_t ctx[3];
+
+static int was_in_f1;
+static int was_in_f2;
+
+static char st2[32768];
+
+static volatile int flag;
+
+static void
+f1 (int a00, int a01, int a02, int a03, int a04, int a05, int a06, int a07,
+    int a08, int a09, int a10, int a11, int a12, int a13, int a14, int a15,
+    int a16, int a17, int a18, int a19, int a20, int a21, int a22, int a23,
+    int a24, int a25, int a26, int a27, int a28, int a29, int a30, int a31,
+    int a32)
+{
+  printf ("start f1(a00=%08x,a01=%08x,a02=%08x,a03=%08x,\n"
+	  "         a04=%08x,a05=%08x,a06=%08x,a07=%08x,\n"
+	  "         a08=%08x,a09=%08x,a10=%08x,a11=%08x,\n"
+	  "         a12=%08x,a13=%08x,a14=%08x,a15=%08x,\n"
+	  "         a16=%08x,a17=%08x,a18=%08x,a19=%08x,\n"
+	  "         a20=%08x,a21=%08x,a22=%08x,a23=%08x,\n"
+	  "         a24=%08x,a25=%08x,a26=%08x,a27=%08x,\n"
+	  "         a28=%08x,a29=%08x,a30=%08x,a31=%08x,\n"
+	  "         a32=%08x) [%d]\n",
+	  a00, a01, a02, a03, a04, a05, a06, a07,
+	  a08, a09, a10, a11, a12, a13, a14, a15,
+	  a16, a17, a18, a19, a20, a21, a22, a23,
+	  a24, a25, a26, a27, a28, a29, a30, a31,
+	  a32, flag);
+
+  if (a00 != (0x00000001 << flag) || a01 != (0x00000004 << flag)
+      || a02 != (0x00000012 << flag) || a03 != (0x00000048 << flag)
+      || a04 != (0x00000123 << flag) || a05 != (0x0000048d << flag)
+      || a06 != (0x00001234 << flag) || a07 != (0x000048d1 << flag)
+      || a08 != (0x00012345 << flag) || a09 != (0x00048d15 << flag)
+      || a10 != (0x00123456 << flag) || a11 != (0x0048d159 << flag)
+      || a12 != (0x01234567 << flag) || a13 != (0x048d159e << flag)
+      || a14 != (0x12345678 << flag) || a15 != (0x48d159e2 << flag)
+      || a16 != (0x23456789 << flag) || a17 != (0x8d159e26 << flag)
+      || a18 != (0x3456789a << flag) || a19 != (0xd159e26a << flag)
+      || a20 != (0x456789ab << flag) || a21 != (0x159e26af << flag)
+      || a22 != (0x56789abc << flag) || a23 != (0x59e26af3 << flag)
+      || a24 != (0x6789abcd << flag) || a25 != (0x9e26af37 << flag)
+      || a26 != (0x789abcde << flag) || a27 != (0xe26af37b << flag)
+      || a28 != (0x89abcdef << flag) || a29 != (0x26af37bc << flag)
+      || a30 != (0x9abcdef0 << flag) || a31 != (0x6af37bc3 << flag)
+      || a32 != (0xabcdef0f << flag))
+    {
+      puts ("arg mismatch");
+      exit (-1);
+    }
+
+  if (flag && swapcontext (&ctx[1], &ctx[2]) != 0)
+    {
+      printf ("%s: swapcontext: %m\n", __FUNCTION__);
+      exit (1);
+    }
+  printf ("finish f1 [%d]\n", flag);
+  flag++;
+  was_in_f1++;
+}
+
+static void
+f2 (void)
+{
+  puts ("start f2");
+  if (swapcontext (&ctx[2], &ctx[1]) != 0)
+    {
+      printf ("%s: swapcontext: %m\n", __FUNCTION__);
+      exit (1);
+    }
+  puts ("finish f2");
+  was_in_f2 = 1;
+}
+
+volatile int global;
+
+
+static int back_in_main;
+
+
+static void
+check_called (void)
+{
+  if (back_in_main == 0)
+    {
+      puts ("program did not reach main again");
+      _exit (1);
+    }
+}
+
+
+int
+main (void)
+{
+  atexit (check_called);
+
+  char st1[32768];
+
+  puts ("making contexts");
+  if (getcontext (&ctx[0]) != 0)
+    {
+      if (errno == ENOSYS)
+	{
+	  back_in_main = 1;
+	  exit (0);
+	}
+
+      printf ("%s: getcontext: %m\n", __FUNCTION__);
+      exit (1);
+    }
+
+  ctx[1] = ctx[0];
+  ctx[1].uc_stack.ss_sp = st1;
+  ctx[1].uc_stack.ss_size = sizeof st1;
+  ctx[1].uc_link = &ctx[0];
+  {
+    ucontext_t tempctx = ctx[1];
+    makecontext (&ctx[1], (void (*) (void)) f1, 33,
+		 0x00000001 << flag, 0x00000004 << flag,
+		 0x00000012 << flag, 0x00000048 << flag,
+		 0x00000123 << flag, 0x0000048d << flag,
+		 0x00001234 << flag, 0x000048d1 << flag,
+		 0x00012345 << flag, 0x00048d15 << flag,
+		 0x00123456 << flag, 0x0048d159 << flag,
+		 0x01234567 << flag, 0x048d159e << flag,
+		 0x12345678 << flag, 0x48d159e2 << flag,
+		 0x23456789 << flag, 0x8d159e26 << flag,
+		 0x3456789a << flag, 0xd159e26a << flag,
+		 0x456789ab << flag, 0x159e26af << flag,
+		 0x56789abc << flag, 0x59e26af3 << flag,
+		 0x6789abcd << flag, 0x9e26af37 << flag,
+		 0x789abcde << flag, 0xe26af37b << flag,
+		 0x89abcdef << flag, 0x26af37bc << flag,
+		 0x9abcdef0 << flag, 0x6af37bc3 << flag,
+		 0xabcdef0f << flag);
+
+    /* Without this check, a stub makecontext can make us spin forever.  */
+    if (memcmp (&tempctx, &ctx[1], sizeof ctx[1]) == 0)
+      {
+	puts ("makecontext was a no-op, presuming not implemented");
+	return 0;
+      }
+  }
+
+  /* Play some tricks with this context.  */
+  if (++global == 1)
+    if (setcontext (&ctx[1]) != 0)
+      {
+	printf ("%s: setcontext: %m\n", __FUNCTION__);
+	exit (1);
+      }
+  if (global != 2)
+    {
+      printf ("%s: 'global' not incremented twice\n", __FUNCTION__);
+      exit (1);
+    }
+
+  if (getcontext (&ctx[2]) != 0)
+    {
+      printf ("%s: second getcontext: %m\n", __FUNCTION__);
+      exit (1);
+    }
+  ctx[2].uc_stack.ss_sp = st2;
+  ctx[2].uc_stack.ss_size = sizeof st2;
+  ctx[2].uc_link = &ctx[1];
+  makecontext (&ctx[2], f2, 0);
+
+  puts ("swapping contexts");
+  if (swapcontext (&ctx[0], &ctx[2]) != 0)
+    {
+      printf ("%s: swapcontext: %m\n", __FUNCTION__);
+      exit (1);
+    }
+  puts ("back at main program");
+  back_in_main = 1;
+
+  if (was_in_f1 < 2)
+    {
+      puts ("didn't reach f1 twice");
+      exit (1);
+    }
+  if (was_in_f2 == 0)
+    {
+      puts ("didn't reach f2");
+      exit (1);
+    }
+
+  puts ("test succeeded");
+  return 0;
+}
diff --git a/stdlib/tst-setcontext.c b/stdlib/tst-setcontext.c
index 51296f74ab..9a6d79ba9d 100644
--- a/stdlib/tst-setcontext.c
+++ b/stdlib/tst-setcontext.c
@@ -133,7 +133,7 @@ check_called (void)
 {
   if (back_in_main == 0)
     {
-      puts ("program did no reach main again");
+      puts ("program did not reach main again");
       _exit (1);
     }
 }
diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c
index 7e07e6b404..7da677eec9 100644
--- a/sysdeps/mach/hurd/getcwd.c
+++ b/sysdeps/mach/hurd/getcwd.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,2002,04 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,98,2002,2004,2009
+	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
@@ -60,7 +61,6 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir,
       __mach_port_deallocate (__mach_task_self (), thisid);
       __mach_port_deallocate (__mach_task_self (), thisdevid);
       __mach_port_deallocate (__mach_task_self (), rootid);
-      __mach_port_deallocate (__mach_task_self (), rootdevid);
 
       if (dirbuf != NULL)
 	__vm_deallocate (__mach_task_self (),
diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h
index 64bf3423b6..251a5f6922 100644
--- a/sysdeps/s390/s390-32/dl-machine.h
+++ b/sysdeps/s390/s390-32/dl-machine.h
@@ -389,10 +389,13 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 	  *reloc_addr = value + reloc->r_addend - (Elf32_Addr) reloc_addr;
 	  break;
 	case R_390_PC16DBL:
-	case R_390_PLT16DBL:
 	  *(unsigned short *) reloc_addr = (unsigned short)
 	    ((short) (value + reloc->r_addend - (Elf32_Addr) reloc_addr) >> 1);
 	  break;
+	case R_390_PC32DBL:
+	  *(unsigned int *) reloc_addr = (unsigned int)
+	    ((int) (value + reloc->r_addend - (Elf32_Addr) reloc_addr) >> 1);
+	  break;
 	case R_390_PC16:
 	  *(unsigned short *) reloc_addr =
 	    value + reloc->r_addend - (Elf32_Addr) reloc_addr;
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index fa893befdf..c4df274cdb 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -371,7 +371,6 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 	  *reloc_addr = value +reloc->r_addend - (Elf64_Addr) reloc_addr;
 	  break;
 	case R_390_PC32DBL:
-	case R_390_PLT32DBL:
 	  *(unsigned int *) reloc_addr = (unsigned int)
 	    ((int) (value + reloc->r_addend - (Elf64_Addr) reloc_addr) >> 1);
 	  break;
@@ -380,7 +379,6 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
 	    value + reloc->r_addend - (Elf64_Addr) reloc_addr;
 	  break;
 	case R_390_PC16DBL:
-	case R_390_PLT16DBL:
 	  *(unsigned short *) reloc_addr = (unsigned short)
 	    ((short) (value + reloc->r_addend - (Elf64_Addr) reloc_addr) >> 1);
 	  break;
diff --git a/sysdeps/unix/sysv/linux/bits/poll.h b/sysdeps/unix/sysv/linux/bits/poll.h
index d7996b46c5..9dd75cb3af 100644
--- a/sysdeps/unix/sysv/linux/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/bits/poll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2006, 2009 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
@@ -27,7 +27,7 @@
 #define POLLPRI		0x002		/* There is urgent data to read.  */
 #define POLLOUT		0x004		/* Writing now will not block.  */
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
 /* These values are defined in XPG4.2.  */
 # define POLLRDNORM	0x040		/* Normal data may be read.  */
 # define POLLRDBAND	0x080		/* Priority data may be read.  */
diff --git a/sysdeps/unix/sysv/linux/futimens.c b/sysdeps/unix/sysv/linux/futimens.c
index 67f2588f86..fe8e92070d 100644
--- a/sysdeps/unix/sysv/linux/futimens.c
+++ b/sysdeps/unix/sysv/linux/futimens.c
@@ -33,6 +33,11 @@ int
 futimens (int fd, const struct timespec tsp[2])
 {
 #ifdef __NR_utimensat
+  if (fd < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
   return INLINE_SYSCALL (utimensat, 4, fd, NULL, tsp, 0);
 #else
   __set_errno (ENOSYS);
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/poll.h b/sysdeps/unix/sysv/linux/sparc/bits/poll.h
index 53b94bc50e..0a984ad765 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/poll.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/poll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2006, 2009 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
@@ -27,7 +27,7 @@
 #define POLLPRI		0x002		/* There is urgent data to read.  */
 #define POLLOUT		0x004		/* Writing now will not block.  */
 
-#ifdef __USE_XOPEN
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
 /* These values are defined in XPG4.2.  */
 # define POLLRDNORM	0x040		/* Normal data may be read.  */
 # define POLLRDBAND	0x080		/* Priority data may be read.  */