about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-03-06 07:30:01 +0000
committerJakub Jelinek <jakub@redhat.com>2006-03-06 07:30:01 +0000
commitb3643a38588a0d7217ef933735b9cf142ccdbf2d (patch)
treedfd2d46a4adfdb376f8a8632289e117055f0e039
parent51d2f6dd7f5c5a2838e864f7d5795f3110536b6d (diff)
downloadglibc-b3643a38588a0d7217ef933735b9cf142ccdbf2d.tar.gz
glibc-b3643a38588a0d7217ef933735b9cf142ccdbf2d.tar.xz
glibc-b3643a38588a0d7217ef933735b9cf142ccdbf2d.zip
Updated to fedora-glibc-20060306T0720
-rw-r--r--ChangeLog118
-rw-r--r--bits/resource.h10
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in9
-rw-r--r--io/ftw.c19
-rw-r--r--malloc/arena.c13
-rw-r--r--malloc/malloc.c10
-rw-r--r--nptl/ChangeLog20
-rw-r--r--nptl/configure8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/aio_misc.h11
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/Makefile2
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h89
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h88
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S13
-rw-r--r--shlib-versions10
-rw-r--r--stdlib/tst-setcontext.c6
-rw-r--r--sysdeps/mach/hurd/bits/posix_opt.h108
-rw-r--r--sysdeps/mach/hurd/fdopendir.c3
-rw-r--r--sysdeps/mach/hurd/i386/tls.h4
-rw-r--r--sysdeps/mach/hurd/opendir.c28
-rw-r--r--sysdeps/posix/sysconf.c152
-rw-r--r--sysdeps/sparc/sparc32/dl-trampoline.S29
-rw-r--r--sysdeps/sparc/sparc32/elf/start.S4
-rw-r--r--sysdeps/sparc/sparc32/memchr.S21
-rw-r--r--sysdeps/sparc/sparc32/memcpy.S40
-rw-r--r--sysdeps/sparc/sparc32/stpcpy.S14
-rw-r--r--sysdeps/sparc/sparc32/strcat.S78
-rw-r--r--sysdeps/sparc/sparc32/strchr.S33
-rw-r--r--sysdeps/sparc/sparc32/strcmp.S14
-rw-r--r--sysdeps/sparc/sparc32/strcpy.S16
-rw-r--r--sysdeps/sparc/sparc32/strlen.S28
-rw-r--r--sysdeps/sparc/sparc64/dl-trampoline.S47
-rw-r--r--sysdeps/sparc/sparc64/elf/start.S4
-rw-r--r--sysdeps/sparc/sparc64/memcpy.S4
-rw-r--r--sysdeps/sparc/sparc64/sparcv9v/memset.S2
-rw-r--r--sysdeps/unix/alpha/sysdep.h2
-rw-r--r--sysdeps/unix/sysv/linux/configure23
-rw-r--r--sysdeps/unix/sysv/linux/configure.in23
-rw-r--r--sysdeps/unix/sysv/linux/sparc/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/rt-sysdep.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/clone.S22
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S26
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/socket.S31
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S16
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h155
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/brk.S8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/clone.S20
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S16
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/socket.S31
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S17
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h176
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.S1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.c1
-rw-r--r--sysdeps/unix/sysv/linux/sysconf.c24
59 files changed, 953 insertions, 752 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e26c1e3c7..8a9c70e5b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,20 +1,126 @@
-2006-03-02  Jakub Jelinek  <jakub@redhat.com>
+2006-03-05  Roland McGrath  <roland@redhat.com>
 
-	* malloc/malloc.c (MALLOC_ALIGNMENT): Set to __alignof__ (long double)
-	if long double is more aligned than 2 * SIZE_SZ.
-	(misaligned_chunk): Define.
-	(public_rEALLOc, _int_free, _int_realloc): Use it.
+	* malloc/malloc.c (MALLOC_ALIGNMENT): Revert to (2 * SIZE_SZ) value.
+	The correct value differs only on powerpc32, and for now changing it
+	there is causing more trouble than it's worth.
+
+	* malloc/arena.c: Add compile-time sanity check on padding calculation.
+
+2006-03-05  Jakub Jelinek  <jakub@redhat.com>
+
+	* malloc/arena.c (heap_info): Adjust the padding size if
+	MALLOC_ALIGNMENT > 2 * SIZE_SZ.
+
+2006-03-05  Roland McGrath  <roland@frob.com>
+
+	* sysdeps/posix/sysconf.c (__sysconf): Use #if _POSIX_FOO > 0
+	rather than #ifdef _POSIX_FOO for options.  We should return -1
+	at runtime for an option defined to 0 at compile time.
+
+	* sysdeps/mach/hurd/bits/posix_opt.h: Define many missing options,
+	many to -1 or 0.
+
+2006-03-05  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf)
+	[__NR_clock_getres || HP_TIMING_AVAIL]: Handle _SC_CPUTIME,
+	_SC_THREAD_CPUTIME.
+
+2006-03-05  David S. Miller  <davem@sunset.davemloft.net>
+
+	* sysdeps/sparc/sparc32/dl-trampoline.S: Add CFI markings.
+	* sysdeps/sparc/sparc32/elf/start.S: Likewise.
+	* sysdeps/sparc/sparc64/dl-trampoline.S: Likewise.
+	* sysdeps/sparc/sparc64/elf/start.S: Likewise.
+	* sysdeps/sparc/sparc32/memchr.S: Rearrange code to reside
+	within ENTRY/END.
+	* sysdeps/sparc/sparc32/memcpy.S: Likewise.
+	* sysdeps/sparc/sparc32/stpcpy.S: Likewise.
+	* sysdeps/sparc/sparc32/strcat.S: Likewise.
+	* sysdeps/sparc/sparc32/strchr.S: Likewise.
+	* sysdeps/sparc/sparc32/strcmp.S: Likewise.
+	* sysdeps/sparc/sparc32/strcpy.S: Likewise.
+	* sysdeps/sparc/sparc32/strlen.S: Likewise.
+	* sysdeps/sparc/sparc64/memcpy.S: Likewise.
+	* sysdeps/sparc/sparc64/sparcv9v/memset.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S: Add CFI markings
+	and use __syscall_error.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/brk.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S: Use __syscall_error.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/socket.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/socket.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h: Rewrite to use
+	CFI markings and __syscall_error.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S: Rearrange
+	code to reside within ENTRY/END.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sysdep.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/sysdep.S: File removed.
+	* sysdeps/unix/sysv/linux/sparc/rt-sysdep.c: New file.
+	* sysdeps/unix/sysv/linux/sparc/Makefile (librt-routines): Add it.
+
+	* shlib-versions: Use sparc64.*- for CPU patterns.
+
+2006-03-05  Roland McGrath  <roland@frob.com>
+
+	* bits/resource.h (RLIMIT_SBSIZE, RLIMIT_AS, RLIMIT_VMEM): Define.
+
+	* sysdeps/mach/hurd/fdopendir.c (__fdopendir): Use O_DIRECTORY
+	to force directory check.
+	* sysdeps/mach/hurd/opendir.c (__opendir): Likewise.
+
+2006-03-04  Roland McGrath  <roland@frob.com>
+
+	* sysdeps/mach/hurd/i386/tls.h (_hurd_tls_init): Make sure high bits
+	of SEL are clear after copying %gs to low bits.
+	(_hurd_tls_fork): Likewise.
+
+2006-03-03  Roland McGrath  <roland@redhat.com>
+
+	[BZ #2414]
+	* stdlib/tst-setcontext.c (f1): Take arguments of type int.
+
+2006-03-02  Roland McGrath  <roland@redhat.com>
+
+	* sysdeps/unix/alpha/sysdep.h (PTR_MANGLE): Use __typeof in cast.
+
+2006-03-02  Daniel Jacobowitz  <dan@codesourcery.com>
+
+	* sysdeps/unix/sysv/linux/configure.in: Remove MIPS cases.  Allow
+	libc_cv_slibdir et al. to be overridden.
+	* sysdeps/unix/sysv/linux/configure: Regenerated.
+
+2005-12-27  Jakub Jelinek  <jakub@redhat.com>
+
+	* elf/ldconfig.c (search_dir): Skip prelink temporaries.
+
+2006-03-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* elf/check-textrel.c: Don't include "config.h".
 
 2006-03-02  Jakub Jelinek  <jakub@redhat.com>
 
+	* io/ftw.c (process_entry): If dir->streamfd != -1,
+	use FXSTATAT rather than LXSTAT to find if unstatable
+	file is a dead symlink.
+
 	* elf/check-textrel.c: Include config.h.
 	(AB(handle_file)): Don't fail if PF_X | PF_W on architectures known
 	to have executable writable PLT.
 	* sysdeps/powerpc/powerpc32/configure.in (HAVE_PPC_SECURE_PLT): New
 	test.
-	* sysdeps/powerpc/powerpc32/configure: Rebuilt.
 	* config.h.in (HAVE_PPC_SECURE_PLT): Add.
 
+	* malloc/malloc.c (MALLOC_ALIGNMENT): Set to __alignof__ (long double)
+	if long double is more aligned than 2 * SIZE_SZ.
+	(misaligned_chunk): Define.
+	(public_rEALLOc, _int_free, _int_realloc): Use it.
+
 2006-01-05  H.J. Lu  <hongjiu.lu@intel.com>
 
 	[BZ #2013]
diff --git a/bits/resource.h b/bits/resource.h
index 05b28dfccd..8057f5cc65 100644
--- a/bits/resource.h
+++ b/bits/resource.h
@@ -1,5 +1,5 @@
 /* Bit values & structures for resource limits.  4.4 BSD/generic GNU version.
-   Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1994,1996,1997,1998,2006 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
@@ -63,6 +63,14 @@ enum __rlimit_resource
     RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing.  */
 #define	RLIMIT_OFILE	RLIMIT_OFILE
 #define	RLIMIT_NOFILE	RLIMIT_NOFILE
+    /* Maximum size of all socket buffers.  */
+    RLIMIT_SBSIZE,
+#define RLIMIT_SBSIZE	RLIMIT_SBSIZE
+    /* Maximum size in bytes of the process address space.  */
+    RLIMIT_AS,
+    RLIMIT_VMEM = RLIMIT_AS,	/* Another name for the same thing.  */
+#define RLIMIT_AS	RLIMIT_AS
+#define RLIMIT_VMEM	RLIMIT_AS
 
     RLIMIT_NLIMITS,		/* Number of limit flavors.  */
     RLIM_NLIMITS = RLIMIT_NLIMITS /* Traditional name for same.  */
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 1de55dc861..e124e52298 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
 glibc-base := HEAD
 DIST_BRANCH := devel
 COLLECTION := dist-fc4
-fedora-sync-date := 2006-03-02 08:55 UTC
-fedora-sync-tag := fedora-glibc-20060302T0855
+fedora-sync-date := 2006-03-06 07:20 UTC
+fedora-sync-tag := fedora-glibc-20060306T0720
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 843833564f..b8aa4da33f 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1,4 +1,4 @@
-%define glibcrelease 1
+%define glibcrelease 2
 %define auxarches i586 i686 athlon sparcv9 alphaev6
 %define prelinkarches noarch
 %define xenarches i686 athlon
@@ -1332,6 +1332,13 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Mon Mar  6 2006 Jakub Jelinek <jakub@redhat.com> 2.3.91-2
+- update from CVS
+  - fix sYSMALLOc for MALLOC_ALIGNMENT > 2 * SIZE_SZ (#183895)
+  - revert ppc32 malloc alignment patch, it breaks malloc_set_state
+    and needs some further thoughts and time (#183894)
+- provide accurate unwind info for lowlevellock.h stubs on x86_64
+
 * Thu Mar  2 2006 Jakub Jelinek <jakub@redhat.com> 2.3.91-1
 - update from CVS
   - fixes for various arches
diff --git a/io/ftw.c b/io/ftw.c
index 50303d9cd0..e96076a203 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -419,13 +419,22 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
     {
       if (errno != EACCES && errno != ENOENT)
 	result = -1;
-      else if (!(data->flags & FTW_PHYS)
-	       && (d_type == DT_LNK
-		   || (LXSTAT (_STAT_VER, name, &st) == 0
-		       && S_ISLNK (st.st_mode))))
+      else if (data->flags & FTW_PHYS)
+	flag = FTW_NS;
+      else if (d_type == DT_LNK)
 	flag = FTW_SLN;
       else
-	flag = FTW_NS;
+	{
+	  if (dir->streamfd != -1)
+	    statres = FXSTATAT (_STAT_VER, dir->streamfd, name, &st,
+				AT_SYMLINK_NOFOLLOW);
+	  else
+	    statres = LXSTAT (_STAT_VER, name, &st);
+	  if (statres == 0 && S_ISLNK (st.st_mode))
+	    flag = FTW_SLN;
+	  else
+	    flag = FTW_NS;
+	}
     }
   else
     {
diff --git a/malloc/arena.c b/malloc/arena.c
index d0d223e94e..4d95462f26 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -1,5 +1,5 @@
 /* Malloc implementation for multiple threads without lock contention.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
 
@@ -55,9 +55,18 @@ typedef struct _heap_info {
   mstate ar_ptr; /* Arena for this heap. */
   struct _heap_info *prev; /* Previous heap. */
   size_t size;   /* Current size in bytes. */
-  size_t pad;    /* Make sure the following data is properly aligned. */
+  /* Make sure the following data is properly aligned, particularly
+     that sizeof (heap_info) + 2 * SIZE_SZ is a multiple of
+     MALLOG_ALIGNMENT. */
+  char pad[-5 * SIZE_SZ & MALLOC_ALIGN_MASK];
 } heap_info;
 
+/* Get a compile-time error if the heap_info padding is not correct
+   to make alignment work as expected in sYSMALLOc.  */
+extern int sanity_check_heap_info_alignment[(sizeof (heap_info)
+					     + 2 * SIZE_SZ) % MALLOC_ALIGNMENT
+					    ? -1 : 1];
+
 /* Thread specific data */
 
 static tsd_key_t arena_key;
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 99b55c8639..da230d3493 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1,5 +1,5 @@
 /* Malloc implementation for multiple threads without lock contention.
-   Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wg@malloc.de>
    and Doug Lea <dl@cs.oswego.edu>, 2001.
@@ -381,8 +381,16 @@ extern "C" {
 
 
 #ifndef MALLOC_ALIGNMENT
+/* XXX This is the correct definition.  It differs from 2*SIZE_SZ only on
+   powerpc32.  For the time being, changing this is causing more
+   compatibility problems due to malloc_get_state/malloc_set_state than
+   will returning blocks not adequately aligned for long double objects
+   under -mlong-double-128.
+
 #define MALLOC_ALIGNMENT       (2 * SIZE_SZ < __alignof__ (long double) \
 				? __alignof__ (long double) : 2 * SIZE_SZ)
+*/
+#define MALLOC_ALIGNMENT       (2 * SIZE_SZ)
 #endif
 
 /* The corresponding bit mask value */
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index b35cfddcac..678a419aca 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,23 @@
+2006-03-05  Roland McGrath  <roland@redhat.com>
+
+	* configure (libc_add_on): Disable add-on when $add_ons_automatic = yes
+	and $config_os doesn't match *linux*.
+
+2006-03-05  David S. Miller  <davem@sunset.davemloft.net>
+
+	* sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S:
+	Use __syscall_error.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/Makefile: New file.
+
+2006-03-02  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/aio_misc.h: Various cleanups.
+
 2006-03-01  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/x86_64/lowlevelrobustlock.S
diff --git a/nptl/configure b/nptl/configure
index 1ce3caec6e..dd246c755a 100644
--- a/nptl/configure
+++ b/nptl/configure
@@ -3,3 +3,11 @@
 # as a subdirectory to search for in other add-ons' sysdeps trees.
 
 libc_add_on_canonical=nptl
+
+# Only linux configurations support NPTL.
+if test $add_ons_automatic = yes; then
+  case "$config_os" in
+  *linux*) ;;
+  *) libc_add_on= ;;
+  esac
+fi
diff --git a/nptl/sysdeps/unix/sysv/linux/aio_misc.h b/nptl/sysdeps/unix/sysv/linux/aio_misc.h
index 50064c44c1..406d96e865 100644
--- a/nptl/sysdeps/unix/sysv/linux/aio_misc.h
+++ b/nptl/sysdeps/unix/sysv/linux/aio_misc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
 
@@ -19,10 +19,10 @@
 
 #ifndef _AIO_MISC_H
 # include_next <aio_misc.h>
+# include <limits.h>
+# include <pthread.h>
 # include <signal.h>
 # include <sysdep.h>
-# include <pthread.h>
-# include <limits.h>
 
 # define aio_start_notify_thread __aio_start_notify_thread
 # define aio_create_helper_thread __aio_create_helper_thread
@@ -37,7 +37,8 @@ __aio_start_notify_thread (void)
 }
 
 extern inline int
-__aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg)
+__aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
+			    void *arg)
 {
   pthread_attr_t attr;
 
@@ -64,5 +65,5 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg)
 
   (void) pthread_attr_destroy (&attr);
   return ret;
-}                                                                                 
+}
 #endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/Makefile b/nptl/sysdeps/unix/sysv/linux/sparc/Makefile
new file mode 100644
index 0000000000..e98c9bd866
--- /dev/null
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/Makefile
@@ -0,0 +1,2 @@
+# pull in __syscall_error routine
+libpthread-routines += sysdep
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S
index 55229c9e66..fb01242b53 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/pt-vfork.S
@@ -21,6 +21,7 @@
 #include <tcb-offsets.h>
 
 	.text
+	.globl		__syscall_error
 ENTRY(__vfork)
 	ld	[%g7 + PID], %o5
 	sub	%g0, %o5, %o4
@@ -28,15 +29,17 @@ ENTRY(__vfork)
 
 	LOADSYSCALL(vfork)
 	ta	0x10
-	bcs,a	__syscall_error_handler
-	 st	%o5, [%g7 + PID]
-	SYSCALL_ERROR_HANDLER
-	sub	%o1, 1, %o1
+	bcc	2f
+	 mov	%o7, %g1
+	st	%o5, [%g7 + PID]
+	call	__syscall_error
+	 mov	%g1, %o7
+2:	sub	%o1, 1, %o1
 	andcc	%o0, %o1, %o0
 	bne,a	1f
 	 st	%o5, [%g7 + PID]
 1:	retl
 	 nop
+END(__vfork)
 
-PSEUDO_END (__vfork)
 weak_alias (__vfork, vfork)
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
index 5edf4b3772..75a4eb9469 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
@@ -26,55 +26,48 @@
 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
 
 # undef PSEUDO
-# define PSEUDO(name, syscall_name, args)				      \
-	.text;								      \
-ENTRY(name)								      \
-	ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;			      \
-	cmp %g1, 0;							      \
-	bne 1f;								      \
-.type	__##syscall_name##_nocancel,@function;				      \
-.globl	__##syscall_name##_nocancel;					      \
-__##syscall_name##_nocancel:						      \
-	 mov SYS_ify(syscall_name), %g1;				      \
-	ta 0x10;							      \
-	bcs __syscall_error_handler;					      \
-	 nop;								      \
-.size	__##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	      \
-	.subsection 2;							      \
-	cfi_startproc;							      \
-1:	save %sp, -96, %sp;						      \
-	cfi_def_cfa_register (%fp);					      \
-	cfi_window_save;						      \
-	cfi_register (%o7, %i7);					      \
-	CENABLE;							      \
-	 nop;								      \
-	mov %o0, %l0;							      \
-	COPY_ARGS_##args						      \
-	mov SYS_ify(syscall_name), %g1;					      \
-	ta 0x10;							      \
-	bcs __syscall_error_handler2;					      \
-	 mov %o0, %l1;							      \
-	CDISABLE;							      \
-	 mov %l0, %o0;							      \
-	jmpl %i7 + 8, %g0;						      \
-	 restore %g0, %l1, %o0;						      \
-	cfi_endproc;							      \
-	.previous;							      \
-	SYSCALL_ERROR_HANDLER						      \
-	SYSCALL_ERROR_HANDLER2
+# define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name)					\
+	ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;\
+	cmp %g1, 0;				\
+	bne 1f;					\
+.type	__##syscall_name##_nocancel,@function;	\
+.globl	__##syscall_name##_nocancel;		\
+__##syscall_name##_nocancel:			\
+	 mov SYS_ify(syscall_name), %g1;	\
+	ta 0x10;				\
+	bcc 8f;					\
+	 mov %o7, %g1;				\
+	call __syscall_error;			\
+	 mov %g1, %o7;				\
+8:	jmpl %o7 + 8, %g0;			\
+	 nop;					\
+.size	__##syscall_name##_nocancel,.-__##syscall_name##_nocancel;\
+1:	save %sp, -96, %sp;			\
+	cfi_def_cfa_register(%fp);		\
+	cfi_window_save;			\
+	cfi_register(%o7, %i7);			\
+	CENABLE;				\
+	 nop;					\
+	mov %o0, %l0;				\
+	COPY_ARGS_##args			\
+	mov SYS_ify(syscall_name), %g1;		\
+	ta 0x10;				\
+	bcc 1f;					\
+	 mov %o0, %l1;				\
+	CDISABLE;				\
+	 mov %l0, %o0;				\
+	call __syscall_error;			\
+	 mov %l1, %o0;				\
+	b 2f;					\
+	 mov -1, %l1;				\
+1:	CDISABLE;				\
+	 mov %l0, %o0;				\
+2:	jmpl %i7 + 8, %g0;			\
+	 restore %g0, %l1, %o0;
 
-#define SYSCALL_ERROR_HANDLER2						      \
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler2)			      \
-	.global __errno_location;					      \
-        .type   __errno_location,@function;				      \
-	CDISABLE;							      \
-	 mov	%l0, %o0;						      \
-	call	__errno_location;					      \
-	 nop;								      \
-	st	%l1, [%o0];						      \
-	jmpl	%i7 + 8, %g0;						      \
-	 restore %g0, -1, %o0;						      \
-	.previous;
 
 # ifdef IS_IN_libpthread
 #  define CENABLE	call __pthread_enable_asynccancel
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S
index 7229608142..a8e4dd5a43 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S
@@ -21,6 +21,7 @@
 #include <tcb-offsets.h>
 
 	.text
+	.globl		__syscall_error
 ENTRY(__vfork)
 	ld	[%g7 + PID], %o5
 	cmp	%o5, 0
@@ -31,16 +32,18 @@ ENTRY(__vfork)
 
 	LOADSYSCALL(vfork)
 	ta	0x10
-	bcs,a	__syscall_error_handler
-	 st	%o5, [%g7 + PID]
-	SYSCALL_ERROR_HANDLER
-	sub	%o1, 1, %o1
+	bcc	2f
+	 mov	%o7, %g1
+	st	%o5, [%g7 + PID]
+	call	__syscall_error
+	 mov	%g1, %o7
+2:	sub	%o1, 1, %o1
 	andcc	%o0, %o1, %o0
 	bne,a	1f
 	 st	%o5, [%g7 + PID]
 1:	retl
 	 nop
+END(__vfork)
 
-PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 weak_alias (__vfork, vfork)
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S b/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S
index e9018b2e99..8941043c3a 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/pt-vfork.S
@@ -21,6 +21,7 @@
 #include <tcb-offsets.h>
 
 	.text
+	.globl	__syscall_error
 ENTRY(__vfork)
 	ld	[%g7 + PID], %o5
 	sub	%g0, %o5, %o4
@@ -28,15 +29,17 @@ ENTRY(__vfork)
 
 	LOADSYSCALL(vfork)
 	ta	0x6d
-	bcs,a,pn %xcc, __syscall_error_handler
-	 st	%o5, [%g7 + PID]
-	SYSCALL_ERROR_HANDLER
-	sub	%o1, 1, %o1
+	bcc,pt	%xcc, 2f
+	 mov	%o7, %g1
+	st	%o5, [%g7 + PID]
+	call	__syscall_error
+	 mov	%g1, %o7
+2:	sub	%o1, 1, %o1
 	andcc	%o0, %o1, %o0
 	bne,a,pt %icc, 1f
 	 st	%o5, [%g7 + PID]
 1:	retl
 	 nop
+END(__vfork)
 
-PSEUDO_END (__vfork)
 weak_alias (__vfork, vfork)
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
index d69623c145..dd263a597c 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep-cancel.h
@@ -26,54 +26,46 @@
 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
 
 # undef PSEUDO
-# define PSEUDO(name, syscall_name, args)				      \
-	.text;								      \
-ENTRY(name)								      \
-	ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;			      \
-	brnz,pn %g1, 1f;						      \
-.type	__##syscall_name##_nocancel,@function;				      \
-.globl	__##syscall_name##_nocancel;					      \
-__##syscall_name##_nocancel:						      \
-	 mov SYS_ify(syscall_name), %g1;				      \
-	ta 0x6d;							      \
-	bcs,pn %xcc, __syscall_error_handler;				      \
-	 nop;								      \
-.size	__##syscall_name##_nocancel,.-__##syscall_name##_nocancel;	      \
-	.subsection 2;							      \
-	cfi_startproc;							      \
-1:	save %sp, -192, %sp;						      \
-	cfi_def_cfa_register (%fp);					      \
-	cfi_window_save;						      \
-	cfi_register (%o7, %i7);					      \
-	CENABLE;							      \
-	 nop;								      \
-	mov %o0, %l0;							      \
-	COPY_ARGS_##args						      \
-	mov SYS_ify(syscall_name), %g1;					      \
-	ta 0x6d;							      \
-	bcs,pn %xcc, __syscall_error_handler2;				      \
-	 mov %o0, %l1;							      \
-	CDISABLE;							      \
-	 mov %l0, %o0;							      \
-	jmpl %i7 + 8, %g0;						      \
-	 restore %g0, %l1, %o0;						      \
-	cfi_endproc;							      \
-	.previous;							      \
-	SYSCALL_ERROR_HANDLER						      \
-	SYSCALL_ERROR_HANDLER2
-
-#define SYSCALL_ERROR_HANDLER2						      \
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler2)			      \
-	.global __errno_location;					      \
-        .type   __errno_location,@function;				      \
-	CDISABLE;							      \
-	 mov	%l0, %o0;						      \
-	call	__errno_location;					      \
-	 nop;								      \
-	st	%l1, [%o0];						      \
-	jmpl	%i7 + 8, %g0;						      \
-	 restore %g0, -1, %o0;						      \
-	.previous;
+# define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name)					\
+	ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;\
+	brnz,pn %g1, 1f;			\
+.type	__##syscall_name##_nocancel,@function;	\
+.globl	__##syscall_name##_nocancel;		\
+__##syscall_name##_nocancel:			\
+	 mov SYS_ify(syscall_name), %g1;	\
+	ta 0x6d;				\
+	bcc,pt %xcc, 8f;			\
+	 mov %o7, %g1;				\
+	call __syscall_error;			\
+	 mov %g1, %o7;				\
+8:	jmpl %o7 + 8, %g0;			\
+	 nop;					\
+.size	__##syscall_name##_nocancel,.-__##syscall_name##_nocancel;\
+1:	save %sp, -192, %sp;			\
+	cfi_def_cfa_register(%fp);		\
+	cfi_window_save;			\
+	cfi_register(%o7, %i7);			\
+	CENABLE;				\
+	 nop;					\
+	mov %o0, %l0;				\
+	COPY_ARGS_##args			\
+	mov SYS_ify(syscall_name), %g1;		\
+	ta 0x6d;				\
+	bcc,pt %xcc, 1f;			\
+	 mov %o0, %l1;				\
+	CDISABLE;				\
+	 mov %l0, %o0;				\
+	call __syscall_error;			\
+	 mov %l1, %o0;				\
+	ba,pt %xcc, 2f;				\
+	 mov -1, %l1;				\
+1:	CDISABLE;				\
+	 mov %l0, %o0;				\
+2:	jmpl %i7 + 8, %g0;			\
+	 restore %g0, %l1, %o0;
 
 # ifdef IS_IN_libpthread
 #  define CENABLE	call __pthread_enable_asynccancel
diff --git a/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S b/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S
index d6b2455d43..5597574304 100644
--- a/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S
+++ b/nptl/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S
@@ -21,6 +21,7 @@
 #include <tcb-offsets.h>
 
 	.text
+	.globl	__syscall_error
 ENTRY(__vfork)
 	ld	[%g7 + PID], %o5
 	sethi	%hi(0x80000000), %o3
@@ -31,16 +32,18 @@ ENTRY(__vfork)
 
 	LOADSYSCALL(vfork)
 	ta	0x6d
-	bcs,a,pn %xcc, __syscall_error_handler
-	 st	%o5, [%g7 + PID]
-	SYSCALL_ERROR_HANDLER
-	sub	%o1, 1, %o1
+	bcc,pt	%xcc, 2f
+	 mov	%o7, %g1
+	st	%o5, [%g7 + PID]
+	call	__syscall_error
+	 mov	%g1, %o7
+2:	sub	%o1, 1, %o1
 	andcc	%o0, %o1, %o0
 	bne,a,pt %icc, 1f
 	 st	%o5, [%g7 + PID]
 1:	retl
 	 nop
+END(__vfork)
 
-PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 weak_alias (__vfork, vfork)
diff --git a/shlib-versions b/shlib-versions
index 0e05015116..9a10fc0566 100644
--- a/shlib-versions
+++ b/shlib-versions
@@ -40,14 +40,14 @@ s390x-.*-.*		WORDSIZE32		s390-@VENDOR@-@OS@
 s390-.*-.*		WORDSIZE64		s390x-@VENDOR@-@OS@
 powerpc64-.*-.*		WORDSIZE32		powerpc-@VENDOR@-@OS@
 powerpc.*-.*-.*		WORDSIZE64		powerpc64-@VENDOR@-@OS@
-sparc64-.*-.*		WORDSIZE32		sparc-@VENDOR@-@OS@
+sparc64.*-.*-.*		WORDSIZE32		sparc-@VENDOR@-@OS@
 sparc.*-.*-.*		WORDSIZE64		sparc64-@VENDOR@-@OS@
 
 # Configuration		Library=version		Earliest symbol set (optional)
 # -------------		---------------		------------------------------
 
 # The interface to -lm depends mostly only on cpu, not on operating system.
-sparc64-.*-linux.*	libm=6			GLIBC_2.2
+sparc64.*-.*-linux.*	libm=6			GLIBC_2.2
 alpha.*-.*-linux.*	libm=6.1
 ia64-.*-linux.*		libm=6.1		GLIBC_2.2
 sh.*-.*-linux.*		libm=6			GLIBC_2.2
@@ -58,7 +58,7 @@ sh.*-.*-linux.*		libm=6			GLIBC_2.2
 alpha.*-.*-linux.*	libc=6.1
 ia64-.*-linux.*		libc=6.1		GLIBC_2.2
 sh.*-.*-linux.*		libc=6			GLIBC_2.2
-sparc64-.*-linux.*	libc=6			GLIBC_2.2
+sparc64.*-.*-linux.*	libc=6			GLIBC_2.2
 .*-.*-linux.*		libc=6
 
 # libmachuser.so.1 corresponds to mach/*.defs as of Utah's UK22 release.
@@ -72,7 +72,7 @@ sparc64-.*-linux.*	libc=6			GLIBC_2.2
 
 # The dynamic loader also requires different names.
 i.86-.*-linux.*		ld=ld-linux.so.2
-sparc64-.*-linux.*	ld=ld-linux.so.2	GLIBC_2.2
+sparc64.*-.*-linux.*	ld=ld-linux.so.2	GLIBC_2.2
 sparc.*-.*-linux.*	ld=ld-linux.so.2
 alpha.*-.*-linux.*	ld=ld-linux.so.2
 sh.*-.*-linux.*		ld=ld-linux.so.2	GLIBC_2.2
@@ -121,7 +121,7 @@ alpha.*-.*-linux.*	libcrypt=1.1
 alpha.*-.*-linux.*	libBrokenLocale=1.1
 ia64-.*-.*		libBrokenLocale=1	GLIBC_2.2
 sh.*-.*-.*		libBrokenLocale=1	GLIBC_2.2
-sparc64-.*-.*		libBrokenLocale=1	GLIBC_2.2
+sparc64.*-.*-.*		libBrokenLocale=1	GLIBC_2.2
 .*-.*-.*		libBrokenLocale=1
 
 # The real-time library from POSIX.1b.
diff --git a/stdlib/tst-setcontext.c b/stdlib/tst-setcontext.c
index 7dff966e20..e8b1e22671 100644
--- a/stdlib/tst-setcontext.c
+++ b/stdlib/tst-setcontext.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,02, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2001,2002,2004,2006 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
@@ -30,9 +30,9 @@ static int was_in_f2;
 static char st2[32768];
 
 static void
-f1 (long a0, long a1, long a2, long a3)
+f1 (int a0, int a1, int a2, int a3)
 {
-  printf ("start f1(a0=%lx,a1=%lx,a2=%lx,a3=%lx)\n", a0, a1, a2, a3);
+  printf ("start f1(a0=%x,a1=%x,a2=%x,a3=%x)\n", a0, a1, a2, a3);
 
   if (a0 != 1 || a1 != 2 || a2 != 3 || a3 != -4)
     {
diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h
index 326bebff7f..6747bc276e 100644
--- a/sysdeps/mach/hurd/bits/posix_opt.h
+++ b/sysdeps/mach/hurd/bits/posix_opt.h
@@ -1,5 +1,5 @@
 /* Define POSIX options for GNU/Hurd.
-   Copyright (C) 1998,2000,2001,2002 Free Software Foundation, Inc.
+   Copyright (C) 1998,2000,2001,2002,2006 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
@@ -31,13 +31,6 @@
 /* Processes have a saved set-user-ID and a saved set-group-ID.  */
 #define	_POSIX_SAVED_IDS	1
 
-#if 0				/* XXX implement aio_* */
-/* Asynchronous I/O is supported.  */
-#define _POSIX_ASYNCHRONOUS_IO	1
-/* Alternative name for Unix98.  */
-#define _LFS_ASYNCHRONOUS_IO	_POSIX_ASYNCHRONOUS_IO
-#endif
-
 /* Synchronizing file data is supported, but msync is missing.  */
 #undef _POSIX_SYNCHRONIZED_IO
 
@@ -47,15 +40,15 @@
 /* Mapping of files to memory is supported.  */
 #define	_POSIX_MAPPED_FILES	200112L
 
+/* Locking of all memory could be supported in future.  */
+#define	_POSIX_MEMLOCK	0
+
 /* Locking of ranges of memory is supported.  */
 #define	_POSIX_MEMLOCK_RANGE	200112L
 
 /* Setting of memory protections is supported.  */
 #define	_POSIX_MEMORY_PROTECTION	200112L
 
-/* POSIX.4 shared memory objects are supported (using regular files).  */
-#define _POSIX_SHARED_MEMORY_OBJECTS	_POSIX_MAPPED_FILES
-
 /* Elements of the `c_cc' member of `struct termios' structure
    can be disabled by using the value _POSIX_VDISABLE.  */
 #define _POSIX_VDISABLE			((unsigned char) -1)
@@ -67,13 +60,106 @@
 #undef _POSIX_NO_TRUNC		/* Overlong file names get error?  */
 #undef _POSIX_SYNC_IO		/* File supports O_SYNC et al?  */
 
+
+/* We do not have the POSIX threads interface.  */
+#define _POSIX_THREADS	-1
+
+/* We have the reentrant functions described in POSIX.  */
+#define _POSIX_REENTRANT_FUNCTIONS      1
+#define _POSIX_THREAD_SAFE_FUNCTIONS	200112L
+
+/* These are all things that won't be supported when _POSIX_THREADS is not.  */
+#define _POSIX_THREAD_PRIORITY_SCHEDULING	-1
+#define _POSIX_THREAD_ATTR_STACKSIZE		-1
+#define _POSIX_THREAD_ATTR_STACKADDR		-1
+#define _POSIX_SEMAPHORES			-1
+
+/* Real-time signals are not yet supported.  */
+#define _POSIX_REALTIME_SIGNALS	-1
+
+/* Asynchronous I/O might supported with the existing ABI.  */
+#define _POSIX_ASYNCHRONOUS_IO	0
+/* Alternative name for Unix98.  */
+#define _LFS_ASYNCHRONOUS_IO	_POSIX_ASYNCHRONOUS_IO
+
+/* The LFS support in asynchronous I/O is also available.  */
+#define _LFS64_ASYNCHRONOUS_IO	_POSIX_ASYNCHRONOUS_IO
+
+/* The rest of the LFS is also available.  */
+#define _LFS_LARGEFILE		1
+#define _LFS64_LARGEFILE	1
+#define _LFS64_STDIO		1
+
+/* POSIX.4 shared memory objects are supported (using regular files).  */
+#define _POSIX_SHARED_MEMORY_OBJECTS	_POSIX_MAPPED_FILES
+
+/* CPU-time clocks support needs to be checked at runtime.  */
+#define _POSIX_CPUTIME	0
+
+/* Clock support in threads must be also checked at runtime.  */
+#define _POSIX_THREAD_CPUTIME	0
+
 /* GNU libc provides regular expression handling.  */
 #define _POSIX_REGEXP	1
 
+/* Reader/Writer locks are not available.  */
+#define _POSIX_READER_WRITER_LOCKS	-1
+
 /* We have a POSIX shell.  */
 #define _POSIX_SHELL	1
 
+/* We cannot support the Timeouts option without _POSIX_THREADS.  */
+#define _POSIX_TIMEOUTS	-1
+
 /* The `spawn' function family is supported.  */
 #define _POSIX_SPAWN	200112L
 
+/* We do not have POSIX timers, but could in future without ABI change.  */
+#define _POSIX_TIMERS	0
+
+/* The barrier functions are not available.  */
+#define _POSIX_BARRIERS	-1
+
+/* POSIX message queues could be available in future.  */
+#define	_POSIX_MESSAGE_PASSING	0
+
+/* Thread process-shared synchronization is not supported.  */
+#define _POSIX_THREAD_PROCESS_SHARED	-1
+
+/* The monotonic clock might be available.  */
+#define _POSIX_MONOTONIC_CLOCK	0
+
+/* The clock selection interfaces are available.  */
+#define _POSIX_CLOCK_SELECTION	200112L
+
+/* Advisory information interfaces could be available in future.  */
+#define _POSIX_ADVISORY_INFO	0
+
+/* IPv6 support is available.  */
+#define _POSIX_IPV6	200112L
+
+/* Raw socket support is available.  */
+#define _POSIX_RAW_SOCKETS	200112L
+
+/* We have at least one terminal.  */
+#define _POSIX2_CHAR_TERM	200112L
+
+/* Neither process nor thread sporadic server interfaces is available.  */
+#define _POSIX_SPORADIC_SERVER	-1
+#define _POSIX_THREAD_SPORADIC_SERVER	-1
+
+/* trace.h is not available.  */
+#define _POSIX_TRACE	-1
+#define _POSIX_TRACE_EVENT_FILTER	-1
+#define _POSIX_TRACE_INHERIT	-1
+#define _POSIX_TRACE_LOG	-1
+
+/* Typed memory objects are not available.  */
+#define _POSIX_TYPED_MEMORY_OBJECTS	-1
+
+/* No support for priority inheritance or protection so far.  */
+#define _POSIX_THREAD_PRIO_INHERIT	-1
+#define _POSIX_THREAD_PRIO_PROTECT	-1
+
+
 #endif /* bits/posix_opt.h */
diff --git a/sysdeps/mach/hurd/fdopendir.c b/sysdeps/mach/hurd/fdopendir.c
index c9caac30d7..016f825f1d 100644
--- a/sysdeps/mach/hurd/fdopendir.c
+++ b/sysdeps/mach/hurd/fdopendir.c
@@ -40,7 +40,8 @@ __fdopendir (int fd)
   /* Ensure that it's a directory.  */
   error_t err = HURD_FD_PORT_USE
     (d, ({
-	file_t dir = __file_name_lookup_under (port, "/", O_NOTRANS, 0);
+	file_t dir = __file_name_lookup_under (port, "/",
+					       O_DIRECTORY | O_NOTRANS, 0);;
 	if (dir != MACH_PORT_NULL)
 	  __mach_port_deallocate (__mach_task_self (), dir);
 	dir != MACH_PORT_NULL ? 0 : errno;
diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h
index ff849716e0..223a47d2f2 100644
--- a/sysdeps/mach/hurd/i386/tls.h
+++ b/sysdeps/mach/hurd/i386/tls.h
@@ -98,7 +98,7 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
     {
       /* Fetch the selector set by the first call.  */
       int sel;
-      asm ("mov %%gs, %w0" : "=q" (sel));
+      asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0));
       if (__builtin_expect (sel, 0x50) & 4) /* LDT selector */
 	{
 	  error_t err = __i386_set_ldt (tcb->self, sel, &desc, 1);
@@ -151,7 +151,7 @@ _hurd_tls_fork (thread_t child, struct i386_thread_state *state)
 {
   /* Fetch the selector set by _hurd_tls_init.  */
   int sel;
-  asm ("mov %%gs, %w0" : "=q" (sel));
+  asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0));
   if (sel == state->ds)		/* _hurd_tls_init was never called.  */
     return 0;
 
diff --git a/sysdeps/mach/hurd/opendir.c b/sysdeps/mach/hurd/opendir.c
index 5b10142d39..23e04ede0e 100644
--- a/sysdeps/mach/hurd/opendir.c
+++ b/sysdeps/mach/hurd/opendir.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,94,95,96,97,98,2001,2003,2005
+/* Copyright (C) 1993,1994,1995,1996,1997,1998,2001,2003,2005,2006
 	Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -71,9 +71,6 @@ _hurd_fd_opendir (struct hurd_fd *d)
 DIR *
 __opendir (const char *name)
 {
-  int fd;
-  DIR *dirp;
-
   if (name[0] == '\0')
     {
       /* POSIX.1-1990 says an empty name gets ENOENT;
@@ -82,31 +79,12 @@ __opendir (const char *name)
       return NULL;
     }
 
-  {
-    /* Append trailing slash to directory name to force ENOTDIR
-       if it's not a directory.
-
-       We open using the O_NONBLOCK flag so that a nondirectory with
-       blocking behavior (FIFO or device) gets ENOTDIR immediately
-       rather than waiting for the special file's open wakeup predicate.  */
-
-    size_t len = strlen (name);
-    if (name[len - 1] == '/')
-      fd = __open (name, O_RDONLY | O_NONBLOCK);
-    else
-      {
-	char n[len + 2];
-	memcpy (n, name, len);
-	n[len] = '/';
-	n[len + 1] = '\0';
-	fd = __open (n, O_RDONLY | O_NONBLOCK);
-      }
-  }
+  int fd = __open (name, O_RDONLY | O_NONBLOCK | O_DIRECTORY);
   if (fd < 0)
     return NULL;
 
   /* Extract the pointer to the descriptor structure.  */
-  dirp = _hurd_fd_opendir (_hurd_fd_get (fd));
+  DIR *dirp = _hurd_fd_opendir (_hurd_fd_get (fd));
   if (dirp == NULL)
     __close (fd);
 
diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c
index cb5137cd76..0c0d7d1418 100644
--- a/sysdeps/posix/sysconf.c
+++ b/sysdeps/posix/sysconf.c
@@ -95,112 +95,112 @@ __sysconf (name)
       return MAX (__tzname_max (), _POSIX_TZNAME_MAX);
 
     case _SC_JOB_CONTROL:
-#ifdef	_POSIX_JOB_CONTROL
-      return 1;
+#if _POSIX_JOB_CONTROL > 0
+      return _POSIX_JOB_CONTROL;
 #else
       return -1;
 #endif
 
     case _SC_SAVED_IDS:
-#ifdef	_POSIX_SAVED_IDS
+#if _POSIX_SAVED_IDS > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_REALTIME_SIGNALS:
-#ifdef	_POSIX_REALTIME_SIGNALS
+#if _POSIX_REALTIME_SIGNALS > 0
       return _POSIX_REALTIME_SIGNALS;
 #else
       return -1;
 #endif
 
     case _SC_PRIORITY_SCHEDULING:
-#ifdef	_POSIX_PRIORITY_SCHEDULING
+#if _POSIX_PRIORITY_SCHEDULING > 0
       return _POSIX_PRIORITY_SCHEDULING;
 #else
       return -1;
 #endif
 
     case _SC_TIMERS:
-#ifdef	_POSIX_TIMERS
+#if _POSIX_TIMERS > 0
       return _POSIX_TIMERS;
 #else
       return -1;
 #endif
 
     case _SC_ASYNCHRONOUS_IO:
-#ifdef	_POSIX_ASYNCHRONOUS_IO
+#if _POSIX_ASYNCHRONOUS_IO > 0
       return _POSIX_ASYNCHRONOUS_IO;
 #else
       return -1;
 #endif
 
     case _SC_PRIORITIZED_IO:
-#ifdef	_POSIX_PRIORITIZED_IO
+#if _POSIX_PRIORITIZED_IO > 0
       return _POSIX_PRIORITIZED_IO;
 #else
       return -1;
 #endif
 
     case _SC_SYNCHRONIZED_IO:
-#ifdef	_POSIX_SYNCHRONIZED_IO
+#if _POSIX_SYNCHRONIZED_IO > 0
       return _POSIX_SYNCHRONIZED_IO;
 #else
       return -1;
 #endif
 
     case _SC_FSYNC:
-#ifdef	_POSIX_FSYNC
+#if _POSIX_FSYNC > 0
       return _POSIX_FSYNC;
 #else
       return -1;
 #endif
 
     case _SC_MAPPED_FILES:
-#ifdef	_POSIX_MAPPED_FILES
+#if _POSIX_MAPPED_FILES > 0
       return _POSIX_MAPPED_FILES;
 #else
       return -1;
 #endif
 
     case _SC_MEMLOCK:
-#ifdef	_POSIX_MEMLOCK
+#if _POSIX_MEMLOCK > 0
       return _POSIX_MEMLOCK;
 #else
       return -1;
 #endif
 
     case _SC_MEMLOCK_RANGE:
-#ifdef	_POSIX_MEMLOCK_RANGE
+#if _POSIX_MEMLOCK_RANGE > 0
       return _POSIX_MEMLOCK_RANGE;
 #else
       return -1;
 #endif
 
     case _SC_MEMORY_PROTECTION:
-#ifdef	_POSIX_MEMORY_PROTECTION
+#if _POSIX_MEMORY_PROTECTION > 0
       return _POSIX_MEMORY_PROTECTION;
 #else
       return -1;
 #endif
 
     case _SC_MESSAGE_PASSING:
-#ifdef	_POSIX_MESSAGE_PASSING
+#if _POSIX_MESSAGE_PASSING > 0
       return _POSIX_MESSAGE_PASSING;
 #else
       return -1;
 #endif
 
     case _SC_SEMAPHORES:
-#ifdef	_POSIX_SEMAPHORES
+#if _POSIX_SEMAPHORES > 0
       return _POSIX_SEMAPHORES;
 #else
       return -1;
 #endif
 
     case _SC_SHARED_MEMORY_OBJECTS:
-#ifdef	_POSIX_SHARED_MEMORY_OBJECTS
+#if _POSIX_SHARED_MEMORY_OBJECTS > 0
       return _POSIX_SHARED_MEMORY_OBJECTS;
 #else
       return -1;
@@ -353,49 +353,49 @@ __sysconf (name)
 #endif
 
     case _SC_PII:
-#ifdef	_POSIX_PII
+#if _POSIX_PII > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_XTI:
-#ifdef	_POSIX_PII_XTI
+#if _POSIX_PII_XTI > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_SOCKET:
-#ifdef	_POSIX_PII_SOCKET
+#if _POSIX_PII_SOCKET > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_INTERNET:
-#ifdef	_POSIX_PII_INTERNET
+#if _POSIX_PII_INTERNET > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_OSI:
-#ifdef	_POSIX_PII_OSI
+#if _POSIX_PII_OSI > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_POLL:
-#ifdef	_POSIX_POLL
+#if _POSIX_POLL > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_SELECT:
-#ifdef	_POSIX_SELECT
+#if _POSIX_SELECT > 0
       return 1;
 #else
       return -1;
@@ -410,35 +410,35 @@ __sysconf (name)
 #endif
 
     case _SC_PII_INTERNET_STREAM:
-#ifdef	_POSIX_PII_INTERNET_STREAM
+#if _POSIX_PII_INTERNET_STREAM > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_INTERNET_DGRAM:
-#ifdef	_POSIX_PII_INTERNET_DGRAM
+#if _POSIX_PII_INTERNET_DGRAM > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_OSI_COTS:
-#ifdef	_POSIX_PII_OSI_COTS
+#if _POSIX_PII_OSI_COTS > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_OSI_CLTS:
-#ifdef	_POSIX_PII_OSI_CLTS
+#if _POSIX_PII_OSI_CLTS > 0
       return 1;
 #else
       return -1;
 #endif
 
     case _SC_PII_OSI_M:
-#ifdef	_POSIX_PII_OSI_M
+#if _POSIX_PII_OSI_M > 0
       return 1;
 #else
       return -1;
@@ -519,14 +519,14 @@ __sysconf (name)
 
       /* POSIX 1003.1c (POSIX Threads).  */
     case _SC_THREADS:
-#ifdef	_POSIX_THREADS
+#if _POSIX_THREADS > 0
       return _POSIX_THREADS;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_SAFE_FUNCTIONS:
-#ifdef	_POSIX_THREAD_SAFE_FUNCTIONS
+#if _POSIX_THREAD_SAFE_FUNCTIONS > 0
       return _POSIX_THREAD_SAFE_FUNCTIONS;
 #else
       return -1;
@@ -553,7 +553,7 @@ __sysconf (name)
 #endif
 
     case _SC_THREAD_DESTRUCTOR_ITERATIONS:
-#ifdef	_POSIX_THREAD_DESTRUCTOR_ITERATIONS
+#if _POSIX_THREAD_DESTRUCTOR_ITERATIONS > 0
       return _POSIX_THREAD_DESTRUCTOR_ITERATIONS;
 #else
       return -1;
@@ -581,42 +581,42 @@ __sysconf (name)
 #endif
 
     case _SC_THREAD_ATTR_STACKADDR:
-#ifdef	_POSIX_THREAD_ATTR_STACKADDR
+#if _POSIX_THREAD_ATTR_STACKADDR > 0
       return _POSIX_THREAD_ATTR_STACKADDR;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_ATTR_STACKSIZE:
-#ifdef	_POSIX_THREAD_ATTR_STACKSIZE
+#if _POSIX_THREAD_ATTR_STACKSIZE > 0
       return _POSIX_THREAD_ATTR_STACKSIZE;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_PRIORITY_SCHEDULING:
-#ifdef	_POSIX_THREAD_PRIORITY_SCHEDULING
+#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
       return _POSIX_THREAD_PRIORITY_SCHEDULING;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_PRIO_INHERIT:
-#ifdef	_POSIX_THREAD_PRIO_INHERIT
+#if _POSIX_THREAD_PRIO_INHERIT > 0
       return _POSIX_THREAD_PRIO_INHERIT;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_PRIO_PROTECT:
-#ifdef	_POSIX_THREAD_PRIO_PROTECT
+#if _POSIX_THREAD_PRIO_PROTECT > 0
       return _POSIX_THREAD_PRIO_PROTECT;
 #else
       return -1;
 #endif
 
     case _SC_THREAD_PROCESS_SHARED:
-#ifdef	_POSIX_THREAD_PROCESS_SHARED
+#if _POSIX_THREAD_PROCESS_SHARED > 0
       return _POSIX_THREAD_PROCESS_SHARED;
 #else
       return -1;
@@ -857,40 +857,40 @@ __sysconf (name)
 #endif
 
     case _SC_ADVISORY_INFO:
-#ifdef _POSIX_ADVISORY_INFO
+#if _POSIX_ADVISORY_INFO > 0
       return _POSIX_ADVISORY_INFO;
 #else
       return -1;
 #endif
 
     case _SC_BARRIERS:
-#ifdef _POSIX_BARRIERS
+#if _POSIX_BARRIERS > 0
       return _POSIX_BARRIERS;
 #else
       return -1;
 #endif
 
     case _SC_BASE:
-#ifdef _POSIX_BASE
+#if _POSIX_BASE > 0
       return _POSIX_BASE;
 #else
       return -1;
 #endif
     case _SC_C_LANG_SUPPORT:
-#ifdef _POSIX_C_LANG_SUPPORT
+#if _POSIX_C_LANG_SUPPORT > 0
       return _POSIX_C_LANG_SUPPORT;
 #else
       return -1;
 #endif
     case _SC_C_LANG_SUPPORT_R:
-#ifdef _POSIX_C_LANG_SUPPORT_R
+#if _POSIX_C_LANG_SUPPORT_R > 0
       return _POSIX_C_LANG_SUPPORT_R;
 #else
       return -1;
 #endif
 
     case _SC_CLOCK_SELECTION:
-#ifdef _POSIX_CLOCK_SELECTION
+#if _POSIX_CLOCK_SELECTION > 0
       return _POSIX_CLOCK_SELECTION;
 #else
       return -1;
@@ -904,58 +904,58 @@ __sysconf (name)
 #endif
 
     case _SC_DEVICE_IO:
-#ifdef _POSIX_DEVICE_IO
+#if _POSIX_DEVICE_IO > 0
       return _POSIX_DEVICE_IO;
 #else
       return -1;
 #endif
     case _SC_DEVICE_SPECIFIC:
-#ifdef _POSIX_DEVICE_SPCIFIC
+#if _POSIX_DEVICE_SPCIFIC > 0
       return _POSIX_DEVICE_SPECIFIC;
 #else
       return -1;
 #endif
     case _SC_DEVICE_SPECIFIC_R:
-#ifdef _POSIX_DEVICE_SPCIFIC_R
+#if _POSIX_DEVICE_SPCIFIC_R > 0
       return _POSIX_DEVICE_SPECIFIC_R;
 #else
       return -1;
 #endif
 
     case _SC_FD_MGMT:
-#ifdef _POSIX_FD_MGMT
+#if _POSIX_FD_MGMT > 0
       return _POSIX_FD_MGMT;
 #else
       return -1;
 #endif
 
     case _SC_FIFO:
-#ifdef _POSIX_FIFO
+#if _POSIX_FIFO > 0
       return _POSIX_FIFO;
 #else
       return -1;
 #endif
     case _SC_PIPE:
-#ifdef _POSIX_PIPE
+#if _POSIX_PIPE > 0
       return _POSIX_PIPE;
 #else
       return -1;
 #endif
 
     case _SC_FILE_ATTRIBUTES:
-#ifdef _POSIX_FILE_ATTRIBUTES
+#if _POSIX_FILE_ATTRIBUTES > 0
       return _POSIX_FILE_ATTRIBUTES;
 #else
       return -1;
 #endif
     case _SC_FILE_LOCKING:
-#ifdef _POSIX_FILE_LOCKING
+#if _POSIX_FILE_LOCKING > 0
       return _POSIX_FILE_LOCKING;
 #else
       return -1;
 #endif
     case _SC_FILE_SYSTEM:
-#ifdef _POSIX_FILE_SYSTEM
+#if _POSIX_FILE_SYSTEM > 0
       return _POSIX_FILE_SYSTEM;
 #else
       return -1;
@@ -969,53 +969,53 @@ __sysconf (name)
 #endif
 
     case _SC_MULTI_PROCESS:
-#ifdef _POSIX_MULTI_PROCESS
+#if _POSIX_MULTI_PROCESS > 0
       return _POSIX_MULTI_PROCESS;
 #else
       return -1;
 #endif
     case _SC_SINGLE_PROCESS:
-#ifdef _POSIX_SINGLE_PROCESS
+#if _POSIX_SINGLE_PROCESS > 0
       return _POSIX_SINGLE_PROCESS;
 #else
       return -1;
 #endif
 
     case _SC_NETWORKING:
-#ifdef _POSIX_NETWORKING
+#if _POSIX_NETWORKING > 0
       return _POSIX_NETWORKING;
 #else
       return -1;
 #endif
 
     case _SC_READER_WRITER_LOCKS:
-#ifdef _POSIX_READER_WRITER_LOCKS
+#if _POSIX_READER_WRITER_LOCKS > 0
       return _POSIX_READER_WRITER_LOCKS;
 #else
       return -1;
 #endif
     case _SC_SPIN_LOCKS:
-#ifdef _POSIX_SPIN_LOCKS
+#if _POSIX_SPIN_LOCKS > 0
       return _POSIX_SPIN_LOCKS;
 #else
       return -1;
 #endif
 
     case _SC_REGEXP:
-#ifdef _POSIX_REGEXP
+#if _POSIX_REGEXP > 0
       return _POSIX_REGEXP;
 #else
       return -1;
 #endif
     case _SC_REGEX_VERSION:
-#ifdef _POSIX_REGEX_VERSION
+#if _POSIX_REGEX_VERSION > 0
       return _POSIX_REGEX_VERSION;
 #else
       return -1;
 #endif
 
     case _SC_SHELL:
-#ifdef _POSIX_SHELL
+#if _POSIX_SHELL > 0
       return _POSIX_SHELL;
 #else
       return -1;
@@ -1029,33 +1029,33 @@ __sysconf (name)
 #endif
 
     case _SC_SPAWN:
-#ifdef _POSIX_SPAWN
+#if _POSIX_SPAWN > 0
       return _POSIX_SPAWN;
 #else
       return -1;
 #endif
 
     case _SC_SPORADIC_SERVER:
-#ifdef _POSIX_SPORADIC_SERVER
+#if _POSIX_SPORADIC_SERVER > 0
       return _POSIX_SPORADIC_SERVER;
 #else
       return -1;
 #endif
     case _SC_THREAD_SPORADIC_SERVER:
-#ifdef _POSIX_THREAD_SPORADIC_SERVER
+#if _POSIX_THREAD_SPORADIC_SERVER > 0
       return _POSIX_THREAD_SPORADIC_SERVER;
 #else
       return -1;
 #endif
 
     case _SC_SYSTEM_DATABASE:
-#ifdef _POSIX_SYSTEM_DATABASE
+#if _POSIX_SYSTEM_DATABASE > 0
       return _POSIX_SYSTEM_DATABASE;
 #else
       return -1;
 #endif
     case _SC_SYSTEM_DATABASE_R:
-#ifdef _POSIX_SYSTEM_DATABASE_R
+#if _POSIX_SYSTEM_DATABASE_R > 0
       return _POSIX_SYSTEM_DATABASE_R;
 #else
       return -1;
@@ -1069,27 +1069,27 @@ __sysconf (name)
 #endif
 
     case _SC_TIMEOUTS:
-#ifdef _POSIX_TIMEOUTS
+#if _POSIX_TIMEOUTS > 0
       return _POSIX_TIMEOUTS;
 #else
       return -1;
 #endif
 
     case _SC_TYPED_MEMORY_OBJECTS:
-#ifdef _POSIX_TYPED_MEMORY_OBJECTS
+#if _POSIX_TYPED_MEMORY_OBJECTS > 0
       return _POSIX_TYPED_MEMORY_OBJECTS;
 #else
       return -1;
 #endif
 
     case _SC_USER_GROUPS:
-#ifdef _POSIX_USER_GROUPS
+#if _POSIX_USER_GROUPS > 0
       return _POSIX_USER_GROUPS;
 #else
       return -1;
 #endif
     case _SC_USER_GROUPS_R:
-#ifdef _POSIX_USER_GROUPS_R
+#if _POSIX_USER_GROUPS_R > 0
       return _POSIX_USER_GROUPS_R;
 #else
       return -1;
@@ -1154,25 +1154,25 @@ __sysconf (name)
 #endif
 
     case _SC_TRACE:
-#ifdef _POSIX_TRACE
+#if _POSIX_TRACE > 0
       return _POSIX_TRACE;
 #else
       return -1;
 #endif
     case _SC_TRACE_EVENT_FILTER:
-#ifdef _POSIX_TRACE_EVENT_FILTER
+#if _POSIX_TRACE_EVENT_FILTER > 0
       return _POSIX_TRACE_EVENT_FILTER;
 #else
       return -1;
 #endif
     case _SC_TRACE_INHERIT:
-#ifdef _POSIX_TRACE_INHERIT
+#if _POSIX_TRACE_INHERIT > 0
       return _POSIX_TRACE_INHERIT;
 #else
       return -1;
 #endif
     case _SC_TRACE_LOG:
-#ifdef _POSIX_TRACE_LOG
+#if _POSIX_TRACE_LOG > 0
       return _POSIX_TRACE_LOG;
 #else
       return -1;
@@ -1198,14 +1198,14 @@ __sysconf (name)
       return 0;
 
     case _SC_IPV6:
-#ifdef _POSIX_IPV6
+#if _POSIX_IPV6 > 0
       return _POSIX_IPV6;
 #else
       return -1;
 #endif
 
     case _SC_RAW_SOCKETS:
-#ifdef _POSIX_RAW_SOCKETS
+#if _POSIX_RAW_SOCKETS > 0
       return _POSIX_RAW_SOCKETS;
 #else
       return -1;
diff --git a/sysdeps/sparc/sparc32/dl-trampoline.S b/sysdeps/sparc/sparc32/dl-trampoline.S
index 4b7853029a..b0f86dda4e 100644
--- a/sysdeps/sparc/sparc32/dl-trampoline.S
+++ b/sysdeps/sparc/sparc32/dl-trampoline.S
@@ -30,13 +30,22 @@
 	.globl	_dl_runtime_resolve
 	.type	_dl_runtime_resolve, @function
 _dl_runtime_resolve:
+	cfi_startproc
+
 	save	%sp, -104, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register (%o7, %i7)
+
 	ld	[%g2 + 8], %o0
 	srl	%g1, 10, %o1
 	call	_dl_fixup
 	 sub	%o1, 4*12, %o1
 	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_resolve, .-_dl_runtime_resolve
 
 	/* For the profiling cases we pass in our stack frame
@@ -56,6 +65,8 @@ _dl_runtime_resolve:
 	.globl	_dl_profile_save_regs
 	.type	_dl_profile_save_regs, @function
 _dl_profile_save_regs:
+	cfi_startproc
+
 	std	%l0, [%sp + ( 0 * 8)]
 	std	%l2, [%sp + ( 1 * 8)]
 	std	%l4, [%sp + ( 2 * 8)]
@@ -67,6 +78,9 @@ _dl_profile_save_regs:
 	ld	[%sp + (8 * 8)], %l4
 	retl
 	 st	%l4, [%sp + (8 * 8)]
+
+	cfi_endproc
+
 	.size	_dl_profile_save_regs, .-_dl_profile_save_regs
 
 	/* If we are going to call pltexit, then we must replicate
@@ -76,6 +90,8 @@ _dl_profile_save_regs:
 	.globl	_dl_profile_invoke
 	.type	_dl_profile_invoke, @function
 _dl_profile_invoke:
+	cfi_startproc
+
 	sub	%sp, %l0, %sp
 1:
 	srl	%l0, 3, %l7
@@ -112,6 +128,10 @@ _dl_profile_invoke:
 	jmpl	%i7 + 8, %g0
 	 restore
 
+	cfi_endproc
+
+	.size	_dl_profile_invoke, .-_dl_profile_invoke
+
 	/* %g1:	PLT offset loaded by PLT entry
 	 * %g2: callers PC, which is PLT0 + 4, and we store the
 	 *      link map at PLT0 + 12, therefore we add 8 to get
@@ -121,11 +141,17 @@ _dl_profile_invoke:
 	.globl	_dl_runtime_profile
 	.type	_dl_runtime_profile, @function
 _dl_runtime_profile:
+	cfi_startproc
+
 	cmp	%fp, 0
 	be,a	1f
 	 mov	104, %g3
 	sub	%fp, %sp, %g3
 1:	save	%sp, -104, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	ld	[%g2 + 8], %o0
 	srl	%g1, 10, %o1
 	mov	%i7, %o2
@@ -152,4 +178,7 @@ _dl_runtime_profile:
 
 1:	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_profile, .-_dl_runtime_profile
diff --git a/sysdeps/sparc/sparc32/elf/start.S b/sysdeps/sparc/sparc32/elf/start.S
index 4c7fb5bd23..702dd755e6 100644
--- a/sysdeps/sparc/sparc32/elf/start.S
+++ b/sysdeps/sparc/sparc32/elf/start.S
@@ -48,6 +48,7 @@
 	.global _start
 	.type _start,#function
 _start:
+	cfi_startproc
 
 #ifdef SHARED
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
@@ -59,6 +60,7 @@ _start:
      drop their arguments.  */
 	mov	%g0, %fp
 	sub	%sp, 6*4, %sp
+	cfi_adjust_cfa_offset(6*4)
 
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP.  */
@@ -91,6 +93,8 @@ _start:
   /* Die very horribly if exit returns.  */
 	unimp
 
+	cfi_endproc
+
 	.size _start, .-_start
 
 /* Define a symbol for the first piece of initialized data.  */
diff --git a/sysdeps/sparc/sparc32/memchr.S b/sysdeps/sparc/sparc32/memchr.S
index 0ca56ccdd9..fcd98315db 100644
--- a/sysdeps/sparc/sparc32/memchr.S
+++ b/sysdeps/sparc/sparc32/memchr.S
@@ -32,7 +32,15 @@
 
 	.text
 	.align		4
-0:	cmp		%o2, 0
+ENTRY(__memchr)
+	andcc		%o1, 0xff, %o1
+	sll		%o1, 8, %g6
+	andcc		%o0, 3, %g0
+	or		%o1, %g6, %g6
+	sll		%g6, 16, %o3
+	be		10f
+	 or		%o3, %g6, %g2
+	cmp		%o2, 0
 	be		9f
 	 sethi		%hi(0x80808080), %o4
 	ldub		[%o0], %g4
@@ -64,16 +72,7 @@
 	 clr		%o0
 1:	retl
 	 sub		%o0, 1, %o0
-
-ENTRY(__memchr)
-	andcc		%o1, 0xff, %o1
-	sll		%o1, 8, %g6
-	andcc		%o0, 3, %g0
-	or		%o1, %g6, %g6
-	sll		%g6, 16, %o3
-	bne		0b
-	 or		%o3, %g6, %g2
-	sethi		%hi(0x80808080), %o4
+10:	sethi		%hi(0x80808080), %o4
 	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o5
 5:	and		%o2, 3, %g1
diff --git a/sysdeps/sparc/sparc32/memcpy.S b/sysdeps/sparc/sparc32/memcpy.S
index 35bcef4963..6bd55c06a1 100644
--- a/sysdeps/sparc/sparc32/memcpy.S
+++ b/sysdeps/sparc/sparc32/memcpy.S
@@ -146,28 +146,12 @@
 	.text
 	.align	4
 
-70:	andcc		%o1, 1, %g0
-	be		4f
-	 andcc		%o1, 2, %g0
-
-	ldub		[%o1 - 1], %g2
-	sub		%o1, 1, %o1
-	stb		%g2, [%o0 - 1]
-	sub		%o2, 1, %o2
-	be		3f
-	 sub		%o0, 1, %o0
-4:	lduh		[%o1 - 2], %g2
-	sub		%o1, 2, %o1
-	sth		%g2, [%o0 - 2]
-	sub		%o2, 2, %o2
-	b		3f
-	 sub		%o0, 2, %o0
-
 ENTRY(bcopy)
 	mov		%o0, %o3
 	mov		%o1, %o0
 	mov		%o3, %o1
 END(bcopy)
+
 ENTRY(memmove)
 	cmp		%o0, %o1
 	st		%o0, [%sp + 64]
@@ -185,8 +169,26 @@ ENTRY(memmove)
 	 cmp		%o2, 15
 	bleu		91f
 	 andcc		%o1, 3, %g0
-	bne		70b
-3:	 andcc		%o1, 4, %g0
+	be		3f
+	 nop
+
+	andcc		%o1, 1, %g0
+	be		4f
+	 andcc		%o1, 2, %g0
+
+	ldub		[%o1 - 1], %g2
+	sub		%o1, 1, %o1
+	stb		%g2, [%o0 - 1]
+	sub		%o2, 1, %o2
+	be		3f
+	 sub		%o0, 1, %o0
+4:	lduh		[%o1 - 2], %g2
+	sub		%o1, 2, %o1
+	sth		%g2, [%o0 - 2]
+	sub		%o2, 2, %o2
+	sub		%o0, 2, %o0
+
+3:	andcc		%o1, 4, %g0
 
 	be		2f
 	 mov		%o2, %g1
diff --git a/sysdeps/sparc/sparc32/stpcpy.S b/sysdeps/sparc/sparc32/stpcpy.S
index e6688a9b21..222bc2a445 100644
--- a/sysdeps/sparc/sparc32/stpcpy.S
+++ b/sysdeps/sparc/sparc32/stpcpy.S
@@ -38,7 +38,13 @@
 
 	.text
 	.align		4
-10:	ldub		[%o1], %o5
+
+ENTRY(__stpcpy)
+	andcc		%o1, 3, %g0
+	be		20f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o1], %o5
 	stb		%o5, [%o0]
 	cmp		%o5, 0
 	add		%o0, 1, %o0
@@ -67,11 +73,7 @@
 1:	retl
 	 add		%o0, -1, %o0
 
-ENTRY(__stpcpy)
-	andcc		%o1, 3, %g0
-	bne		10b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+20:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o4
 5:	or		%o4, %lo(0x01010101), %o2
 6:	andcc		%o0, 3, %g0
diff --git a/sysdeps/sparc/sparc32/strcat.S b/sysdeps/sparc/sparc32/strcat.S
index 3709c8a692..4ce0771908 100644
--- a/sysdeps/sparc/sparc32/strcat.S
+++ b/sysdeps/sparc/sparc32/strcat.S
@@ -38,36 +38,14 @@
 
 	.text
 	.align		4
-10:	cmp		%o4, 2
-	be		1f
-	 cmp		%o4, 3
-	ldub		[%o1], %o5
-	add		%o1, 1, %o1
-	stb		%o5, [%o0]
-	be		3f
-	 cmp		%o5, 0
-	be		0f
-	 add		%o0, 1, %o0
-1:	lduh		[%o1], %o5
-	add		%o1, 2, %o1
-	srl		%o5, 8, %o4
-	cmp		%o4, 0
-	stb		%o4, [%o0]
-	bne,a		2f
-	 stb		%o5, [%o0 + 1]
-	retl
-	 mov		%g2, %o0
-2:	andcc		%o5, 0xff, %o5
-	bne		4f
-	 add		%o0, 2, %o0
-	retl
-	 mov 		%g2, %o0
-3:	bne		4f
-	 add		%o0, 1, %o0
-	retl
-	 mov		%g2, %o0
 
-11:	ldub		[%o0], %o5
+ENTRY(strcat)
+	mov		%o0, %g2
+	andcc		%o0, 3, %g0
+	be		30f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o0], %o5
 	cmp		%o5, 0
 	be		1f
 	 add		%o0, 1, %o0
@@ -93,12 +71,7 @@
 	b		3f
 	 sub		%o0, 1, %o0
 
-ENTRY(strcat)
-	mov		%o0, %g2
-	andcc		%o0, 3, %g0
-	bne		11b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+30:	or		%o4, %lo(0x80808080), %o3
 7:	sethi		%hi(0x01010101), %o4
 8:	or		%o4, %lo(0x01010101), %o2
 9:	ld		[%o0], %o5
@@ -128,8 +101,39 @@ ENTRY(strcat)
 	 ld		[%o0], %o5
 	sub		%o0, 1, %o0
 3:	andcc		%o1, 3, %o4
-	bne		10b
-4:	 andcc		%o0, 3, %g3
+	be		4f
+	 nop
+
+	cmp		%o4, 2
+	be		11f
+	 cmp		%o4, 3
+	ldub		[%o1], %o5
+	add		%o1, 1, %o1
+	stb		%o5, [%o0]
+	be		13f
+	 cmp		%o5, 0
+	be		0f
+	 add		%o0, 1, %o0
+11:	lduh		[%o1], %o5
+	add		%o1, 2, %o1
+	srl		%o5, 8, %o4
+	cmp		%o4, 0
+	stb		%o4, [%o0]
+	bne,a		12f
+	 stb		%o5, [%o0 + 1]
+	retl
+	 mov		%g2, %o0
+12:	andcc		%o5, 0xff, %o5
+	bne		4f
+	 add		%o0, 2, %o0
+	retl
+	 mov 		%g2, %o0
+13:	bne		4f
+	 add		%o0, 1, %o0
+	retl
+	 mov		%g2, %o0
+
+4:	andcc		%o0, 3, %g3
 	bne		12f
 1:	ld		[%o1], %o5
 	add		%o1, 4, %o1
diff --git a/sysdeps/sparc/sparc32/strchr.S b/sysdeps/sparc/sparc32/strchr.S
index 6120ecd6a3..7c397171f5 100644
--- a/sysdeps/sparc/sparc32/strchr.S
+++ b/sysdeps/sparc/sparc32/strchr.S
@@ -39,9 +39,20 @@
 
 	.text
 	.align		4
-10:	ldub		[%o0], %g4
+ENTRY(strchr)
+	andcc		%o1, 0xff, %o1
+	be		12f
+	 sll		%o1, 8, %o2
+	andcc		%o0, 3, %g0
+	or		%o1, %o2, %o2
+	sethi		%hi(0x80808080), %o4
+	sll		%o2, 16, %o3
+	be		13f
+	 or		%o3, %o2, %g2
+
+	ldub		[%o0], %g4
 	cmp		%g4, %o1
-	be		1f
+	be		11f
 	 add		%o0, 1, %o0
 	cmp		%g4, 0
 	be		9f
@@ -50,7 +61,7 @@
 	 or		%o4, %lo(0x80808080), %o3
 	ldub		[%o0], %g4
 	cmp		%g4, %o1
-	be		1f
+	be		11f
 	 add		%o0, 1, %o0
 	cmp		%g4, 0
 	be		9f
@@ -59,27 +70,17 @@
 	 sethi		%hi(0x01010101), %o5
 	ldub		[%o0], %g4
 	cmp		%g4, %o1
-	be		1f
+	be		11f
 	 add		%o0, 1, %o0
 	cmp		%g4, 0
 	be		9f
 	 or		%o5, %lo(0x01010101), %o2
 	b		6f
 	 ld		[%o0], %g4
-1:	retl
+11:	retl
 	 sub		%o0, 1, %o0
 
-ENTRY(strchr)
-	andcc		%o1, 0xff, %o1
-	be		12f
-	 sll		%o1, 8, %o2
-	andcc		%o0, 3, %g0
-	or		%o1, %o2, %o2
-	sethi		%hi(0x80808080), %o4
-	sll		%o2, 16, %o3
-	bne		10b
-	 or		%o3, %o2, %g2
-	or		%o4, %lo(0x80808080), %o3
+13:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o5
 5:	or		%o5, %lo(0x01010101), %o2
 7:	ld		[%o0], %g4
diff --git a/sysdeps/sparc/sparc32/strcmp.S b/sysdeps/sparc/sparc32/strcmp.S
index 6723593eed..cf369dd839 100644
--- a/sysdeps/sparc/sparc32/strcmp.S
+++ b/sysdeps/sparc/sparc32/strcmp.S
@@ -38,7 +38,13 @@
 
 	.text
 	.align		4
-10:	ldub		[%o0], %o4
+
+ENTRY(strcmp)
+	andcc		%o0, 3, %g0
+	be		13f
+	 sethi		%hi(0x80808080), %g1
+
+	ldub		[%o0], %o4
 	add		%o0, 1, %o0
 	ldub		[%o1], %o5
 	cmp		%o4, 0
@@ -76,11 +82,7 @@
 2:	retl
 	 mov		%o4, %o0
 
-ENTRY(strcmp)
-	andcc		%o0, 3, %g0
-	bne		10b
-	 sethi		%hi(0x80808080), %g1
-	or		%g1, %lo(0x80808080), %o3
+13:	or		%g1, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %g1
 5:	andcc		%o1, 3, %g2
 	bne		12f
diff --git a/sysdeps/sparc/sparc32/strcpy.S b/sysdeps/sparc/sparc32/strcpy.S
index 787ac9f7c8..f3f337e3f7 100644
--- a/sysdeps/sparc/sparc32/strcpy.S
+++ b/sysdeps/sparc/sparc32/strcpy.S
@@ -38,7 +38,14 @@
 
 	.text
 	.align		4
-1:	ldub		[%o1], %o5
+
+ENTRY(strcpy)
+	mov		%o0, %g2
+	andcc		%o1, 3, %g0
+	be		10f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o1], %o5
 	stb		%o5, [%o0]
 	cmp		%o5, 0
 	add		%o0, 1, %o0
@@ -65,12 +72,7 @@
 	b		6f
 	 andcc		%o0, 3, %g3
 
-ENTRY(strcpy)
-	mov		%o0, %g2
-	andcc		%o1, 3, %g0
-	bne		1b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+10:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o4
 5:	andcc		%o0, 3, %g3
 6:	bne		10f
diff --git a/sysdeps/sparc/sparc32/strlen.S b/sysdeps/sparc/sparc32/strlen.S
index 76466ec9dd..ed92f20e28 100644
--- a/sysdeps/sparc/sparc32/strlen.S
+++ b/sysdeps/sparc/sparc32/strlen.S
@@ -38,39 +38,41 @@
 
 	.text
 	.align		4
-10:	ldub		[%o0], %o5
+
+ENTRY(strlen)
+	mov		%o0, %o1
+	andcc		%o0, 3, %g0
+	be		20f
+	 sethi		%hi(0x80808080), %o4
+
+	ldub		[%o0], %o5
 	cmp		%o5, 0
-	be		1f
+	be		21f
 	 add		%o0, 1, %o0
 	andcc		%o0, 3, %g0
 	be		4f
 	 or		%o4, %lo(0x80808080), %o3
 	ldub		[%o0], %o5
 	cmp		%o5, 0
-	be		2f
+	be		22f
 	 add		%o0, 1, %o0
 	andcc		%o0, 3, %g0
 	be		5f
 	 sethi		%hi(0x01010101), %o4
 	ldub		[%o0], %o5
 	cmp		%o5, 0
-	be		3f
+	be		23f
 	 add		%o0, 1, %o0
 	b		11f
 	 or		%o4, %lo(0x01010101), %o2
-1:	retl
+21:	retl
 	 mov		0, %o0
-2:	retl
+22:	retl
 	 mov		1, %o0
-3:	retl
+23:	retl
 	 mov		2, %o0
 
-ENTRY(strlen)
-	mov		%o0, %o1
-	andcc		%o0, 3, %g0
-	bne		10b
-	 sethi		%hi(0x80808080), %o4
-	or		%o4, %lo(0x80808080), %o3
+20:	or		%o4, %lo(0x80808080), %o3
 4:	sethi		%hi(0x01010101), %o4
 5:	or		%o4, %lo(0x01010101), %o2
 11:	ld		[%o0], %o5
diff --git a/sysdeps/sparc/sparc64/dl-trampoline.S b/sysdeps/sparc/sparc64/dl-trampoline.S
index f85527f4c4..81e5c556c3 100644
--- a/sysdeps/sparc/sparc64/dl-trampoline.S
+++ b/sysdeps/sparc/sparc64/dl-trampoline.S
@@ -30,7 +30,13 @@
 	.globl	_dl_runtime_resolve_0
 	.type	_dl_runtime_resolve_0, @function
 _dl_runtime_resolve_0:
+	cfi_startproc
+
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	sethi   %hi(1047552), %l2
 	ldx	[%g4 + 32 + 8], %o0
 	sub     %g1, %g4, %l0
@@ -54,6 +60,9 @@ _dl_runtime_resolve_0:
 	 sllx    %l0, 3, %o1
 	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_resolve_0, .-_dl_runtime_resolve_0
 
 	/* %g1:	PLT offset loaded by PLT entry
@@ -64,7 +73,13 @@ _dl_runtime_resolve_0:
 	.globl	_dl_runtime_resolve_1
 	.type	_dl_runtime_resolve_1, @function
 _dl_runtime_resolve_1:
+	cfi_startproc
+
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	srlx	%g1, 12, %o1
 	ldx	[%g4 + 8], %o0
 	add	%o1, %o1, %o3
@@ -73,6 +88,9 @@ _dl_runtime_resolve_1:
 	 add	%o1, %o3, %o1
 	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_resolve_1, .-_dl_runtime_resolve_1
 
 	/* For the profiling cases we pass in our stack frame
@@ -92,6 +110,8 @@ _dl_runtime_resolve_1:
 	.globl	_dl_profile_save_regs
 	.type	_dl_profile_save_regs, @function
 _dl_profile_save_regs:
+	cfi_startproc
+
 	stx	%l0, [%sp + STACK_BIAS + ( 0 * 8)]
 	stx	%l1, [%sp + STACK_BIAS + ( 1 * 8)]
 	stx	%l2, [%sp + STACK_BIAS + ( 2 * 8)]
@@ -125,6 +145,9 @@ _dl_profile_save_regs:
 	std	%f28, [%sp + STACK_BIAS + (30 * 8)]
 	retl
 	 std	%f30, [%sp + STACK_BIAS + (31 * 8)]
+
+	cfi_endproc
+
 	.size	_dl_profile_save_regs, .-_dl_profile_save_regs
 
 	/* If we are going to call pltexit, then we must replicate
@@ -134,6 +157,8 @@ _dl_profile_save_regs:
 	.globl	_dl_profile_invoke
 	.type	_dl_profile_invoke, @function
 _dl_profile_invoke:
+	cfi_startproc
+
 	sub	%sp, %l0, %sp
 1:
 	srlx	%l0, 3, %l7
@@ -180,6 +205,10 @@ _dl_profile_invoke:
 	jmpl	%i7 + 8, %g0
 	 restore
 
+	cfi_endproc
+
+	.size	_dl_profile_invoke, .-_dl_profile_invoke
+
 	/* %g1:	PLT offset loaded by PLT entry
 	 * %g4: callers PC, which is PLT0 + 24, therefore we
 	 *      add (32 + 8) to get the address of PLT2 which
@@ -189,10 +218,16 @@ _dl_profile_invoke:
 	.globl	_dl_runtime_profile_0
 	.type	_dl_runtime_profile_0, @function
 _dl_runtime_profile_0:
+	cfi_startproc
+
 	brz,a,pn %fp, 1f
 	 mov	192, %g5
 	sub	%fp, %sp, %g5
 1:	save	%sp, -336, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	sethi   %hi(1047552), %l2
 	ldx	[%g4 + 32 + 8], %o0
 	sub     %g1, %g4, %l0
@@ -236,6 +271,9 @@ _dl_runtime_profile_0:
 
 1:	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_profile_0, .-_dl_runtime_profile_0
 
 	/* %g1:	PLT offset loaded by PLT entry
@@ -246,10 +284,16 @@ _dl_runtime_profile_0:
 	.globl	_dl_runtime_profile_1
 	.type	_dl_runtime_profile_1, @function
 _dl_runtime_profile_1:
+	cfi_startproc
+
 	brz,a,pn %fp, 1f
 	 mov	192, %g5
 	sub	%fp, %sp, %g5
 1:	save	%sp, -336, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
+
 	srlx	%g1, 12, %o1
 	ldx	[%g4 + 8], %o0
 	add	%o1, %o1, %o3
@@ -277,4 +321,7 @@ _dl_runtime_profile_1:
 
 1:	jmp	%o0
 	 restore
+
+	cfi_endproc
+
 	.size	_dl_runtime_resolve_1, .-_dl_runtime_resolve_1
diff --git a/sysdeps/sparc/sparc64/elf/start.S b/sysdeps/sparc/sparc64/elf/start.S
index c008c6cea0..df44cae068 100644
--- a/sysdeps/sparc/sparc64/elf/start.S
+++ b/sysdeps/sparc/sparc64/elf/start.S
@@ -48,6 +48,7 @@
 	.global _start
 	.type _start,#function
 _start:
+	cfi_startproc
 
 #ifdef SHARED
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7
@@ -59,6 +60,7 @@ _start:
      drop their arguments.  */
 	mov	%g0, %fp
 	sub	%sp, 6*8, %sp
+	cfi_adjust_cfa_offset(6*8)
 
   /* Extract the arguments and environment as encoded on the stack.  The
      argument info starts after one register window (16 words) past the SP,
@@ -92,6 +94,8 @@ _start:
   /* Die very horribly if exit returns.  */
 	illtrap	0
 
+	cfi_endproc
+
 	.size _start, .-_start
 
 /* Define a symbol for the first piece of initialized data.  */
diff --git a/sysdeps/sparc/sparc64/memcpy.S b/sysdeps/sparc/sparc64/memcpy.S
index a3f7b96a91..5993358017 100644
--- a/sysdeps/sparc/sparc64/memcpy.S
+++ b/sysdeps/sparc/sparc64/memcpy.S
@@ -209,6 +209,7 @@ ENTRY(bcopy)
 END(bcopy)
 
 	.align		32
+ENTRY(__memcpy_large)
 200:	be,pt		%xcc, 201f			/* CTI				*/
 	 andcc		%o0, 0x38, %g5			/* IEU1		Group		*/
 	mov		8, %g1				/* IEU0				*/
@@ -443,6 +444,7 @@ END(bcopy)
 	 stb		%o5, [%o0 - 1]			/* Store			*/
 209:	retl
 	 mov		%g4, %o0
+END(__memcpy_large)
 
 #ifdef USE_BPR
 
@@ -698,6 +700,7 @@ ENTRY(memcpy)
 END(memcpy)
 
 	.align		32
+ENTRY(__memmove_slowpath)
 228:	andcc		%o2, 1, %g0			/* IEU1		Group		*/
 	be,pt		%icc, 2f+4			/* CTI				*/
 1:	 ldub		[%o1 - 1], %o5			/* LOAD		Group		*/
@@ -718,6 +721,7 @@ END(memcpy)
 	 mov		%g4, %o0
 219:	retl
 	 nop
+END(__memmove_slowpath)
 
 	.align		32
 ENTRY(memmove)
diff --git a/sysdeps/sparc/sparc64/sparcv9v/memset.S b/sysdeps/sparc/sparc64/sparcv9v/memset.S
index 7a51ef77dc..ac0a50cf8e 100644
--- a/sysdeps/sparc/sparc64/sparcv9v/memset.S
+++ b/sysdeps/sparc/sparc64/sparcv9v/memset.S
@@ -45,6 +45,7 @@ ENTRY(memset)
 	sllx		%o2, 32, %g1
 	ba,pt		%XCC, 1f
 	 or		%g1, %o2, %o2
+END(memset)
 
 ENTRY(__bzero)
 	clr		%o2
@@ -121,7 +122,6 @@ ENTRY(__bzero)
 	retl
 	 mov		%o3, %o0
 END(__bzero)
-END(memset)
 
 libc_hidden_builtin_def (memset)
 weak_alias (__bzero, bzero)
diff --git a/sysdeps/unix/alpha/sysdep.h b/sysdeps/unix/alpha/sysdep.h
index 2260ec5480..2e5bc798eb 100644
--- a/sysdeps/unix/alpha/sysdep.h
+++ b/sysdeps/unix/alpha/sysdep.h
@@ -415,7 +415,7 @@ __LABEL(name)						\
 # else
 extern uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
 #  define PTR_MANGLE(var)	\
-	(var) = (void *) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
+  (var) = (__typeof (var)) ((uintptr_t) (var) ^ __pointer_chk_guard_local)
 #  define PTR_DEMANGLE(var)  PTR_MANGLE(var)
 # endif
 #elif defined PIC
diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
index 06683089ad..a8a9cc4702 100644
--- a/sysdeps/unix/sysv/linux/configure
+++ b/sysdeps/unix/sysv/linux/configure
@@ -115,10 +115,6 @@ case "$machine" in
     arch_minimum_kernel=2.0.10
     libc_cv_gcc_unwind_find_fde=yes
     ;;
-  mips*)
-    arch_minimum_kernel=2.4.0
-    libc_cv_gcc_unwind_find_fde=yes
-    ;;
   powerpc/powerpc32)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -228,10 +224,12 @@ fi
 # in /lib and /etc.
 case "$prefix" in
 /usr | /usr/)
-  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
+  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
+  # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
+  # and libc_cv_localedir.
+  test -n "$libc_cv_slibdir" || \
   case $machine in
-  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
-  mips/mips64/n64/* )
+  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
     libc_cv_slibdir="/lib64"
     if test "$libdir" = '${exec_prefix}/lib'; then
       libdir='${exec_prefix}/lib64';
@@ -239,14 +237,6 @@ case "$prefix" in
       libc_cv_localedir='${exec_prefix}/lib/locale'
     fi
     ;;
-  mips/mips64/n32/* )
-    libc_cv_slibdir="/lib32"
-    if test "$libdir" = '${exec_prefix}/lib'; then
-      libdir='${exec_prefix}/lib32';
-      # Locale data can be shared between 32bit and 64bit libraries
-      libc_cv_localedir='${exec_prefix}/lib/locale'
-    fi
-    ;;
   *)
     libc_cv_slibdir="/lib"
     ;;
@@ -317,9 +307,6 @@ case "$machine" in
   ia64*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
     ;;
-  mips/*64*)
-    ldd_rewrite_script=../sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
-    ;;
   s390*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
     ;;
diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in
index b90de065af..43681f3251 100644
--- a/sysdeps/unix/sysv/linux/configure.in
+++ b/sysdeps/unix/sysv/linux/configure.in
@@ -75,10 +75,6 @@ case "$machine" in
     arch_minimum_kernel=2.0.10
     libc_cv_gcc_unwind_find_fde=yes
     ;;
-  mips*)
-    arch_minimum_kernel=2.4.0
-    libc_cv_gcc_unwind_find_fde=yes
-    ;;
   powerpc/powerpc32)
     libc_cv_gcc_unwind_find_fde=yes
     arch_minimum_kernel=2.0.10
@@ -163,10 +159,12 @@ fi
 # in /lib and /etc.
 case "$prefix" in
 /usr | /usr/)
-  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
+  # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
+  # Allow earlier configure scripts to handle libc_cv_slibdir, libdir,
+  # and libc_cv_localedir.
+  test -n "$libc_cv_slibdir" || \
   case $machine in
-  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 | \
-  mips/mips64/n64/* )
+  sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64)
     libc_cv_slibdir="/lib64"
     if test "$libdir" = '${exec_prefix}/lib'; then
       libdir='${exec_prefix}/lib64';
@@ -174,14 +172,6 @@ case "$prefix" in
       libc_cv_localedir='${exec_prefix}/lib/locale'
     fi
     ;;
-  mips/mips64/n32/* )
-    libc_cv_slibdir="/lib32"
-    if test "$libdir" = '${exec_prefix}/lib'; then
-      libdir='${exec_prefix}/lib32';
-      # Locale data can be shared between 32bit and 64bit libraries
-      libc_cv_localedir='${exec_prefix}/lib/locale'
-    fi
-    ;;
   *)
     libc_cv_slibdir="/lib"
     ;;
@@ -252,9 +242,6 @@ case "$machine" in
   ia64*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed
     ;;
-  mips/*64*)
-    ldd_rewrite_script=../sysdeps/unix/sysv/linux/mips/mips64/ldd-rewrite.sed
-    ;;
   s390*)
     ldd_rewrite_script=../sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
     ;;
diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile
index 29e5406348..9cb2a634d5 100644
--- a/sysdeps/unix/sysv/linux/sparc/Makefile
+++ b/sysdeps/unix/sysv/linux/sparc/Makefile
@@ -1 +1,5 @@
 64bit-predefine = __sparc_v9__ __arch64__
+
+ifeq ($(subdir),rt)
+librt-routines += rt-sysdep
+endif
diff --git a/sysdeps/unix/sysv/linux/sparc/rt-sysdep.c b/sysdeps/unix/sysv/linux/sparc/rt-sysdep.c
new file mode 100644
index 0000000000..3ff55952e2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/rt-sysdep.c
@@ -0,0 +1 @@
+#include <sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
index 95106d149f..f91fc4f629 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S
@@ -24,6 +24,7 @@
 #include <asm/errno.h>
 #include <asm/unistd.h>
 #include <tcb-offsets.h>
+#include <sysdep.h>
 
 #define CLONE_VM	0x00000100
 #define CLONE_THREAD	0x00010000
@@ -32,12 +33,11 @@
 	     pid_t *ptid, void *tls, pid_t *ctid); */
 
 	.text
-	.align	4
-	.globl	__clone
-	.type	__clone,@function
-
-__clone:
+ENTRY (__clone)
 	save	%sp,-96,%sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 
 	/* sanity check arguments */
 	orcc	%i0,%g0,%g2
@@ -67,21 +67,21 @@ __clone:
 	 tst	%o1
 	bne	__thread_start
 	 nop
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %o0,%g0,%o0
 
 .Lerror:
 	call	__errno_location
 	 or	%g0,EINVAL,%i0
 	st	%i0,[%o0]
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %g0,-1,%o0
-
-	.size	__clone, .-__clone
+END(__clone)
 
 	.type	__thread_start,@function
-
 __thread_start:
+	cfi_startproc
+
 #ifdef RESET_PID
 	sethi	%hi(CLONE_THREAD), %l0
 	andcc	%g4, %l0, %g0
@@ -102,6 +102,8 @@ __thread_start:
 	call	_exit,0
 	 nop
 
+	cfi_endproc
+
 	.size	__thread_start, .-__thread_start
 
 weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
index 27ea9f8912..dbe0872616 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
@@ -19,20 +19,22 @@
 
 #include <sysdep.h>
 
-	.globl __libc_pipe
-ENTRY (__libc_pipe)
-        mov %o0, %o2            /* Save PIPEDES. */
-	mov SYS_ify(pipe),%g1
-	ta 0x10
-	bcs __syscall_error_handler
-	 nop
-	st %o0, [%o2]           /* PIPEDES[0] = %o0; */
-        st %o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
+	.text
+	.globl		__syscall_error
+ENTRY(__libc_pipe)
+        mov	%o0, %o2            /* Save PIPEDES. */
+	mov	SYS_ify(pipe),%g1
+	ta	0x10
+	bcc	1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	st	%o0, [%o2]           /* PIPEDES[0] = %o0; */
+        st	%o1, [%o2 + 4]       /* PIPEDES[1] = %o1; */
 	retl
-	 clr %o0
-	SYSCALL_ERROR_HANDLER
+	 clr	%o0
+END(__libc_pipe)
 
-PSEUDO_END (__libc_pipe)
 weak_alias (__libc_pipe, __pipe)
 libc_hidden_def (__pipe)
 weak_alias (__libc_pipe, pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
index 911d5c6b39..71a63d5b79 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
@@ -47,7 +47,7 @@
 # endif
 #endif
 
-.globl __socket
+	.globl		__syscall_error
 ENTRY (__socket)
 
 	/* Drop up to 6 arguments (recvfrom) into the memory allocated by
@@ -76,18 +76,19 @@ ENTRY (__socket)
 	add %sp, 68, %o1		/* arg 2: parameter block */
 	LOADSYSCALL(socketcall)
 	t 0x10
-        bcs __syscall_error_handler
-	 nop
-	retl
+	bcc 1f
+	 mov %o7, %g1
+	call __syscall_error
+	 mov %g1, %o7
+1:	jmpl %o7 + 8, %g0
 	 nop
 
 #if defined NEED_CANCELLATION && defined CENABLE
 .Lsocket_cancel:
-	cfi_startproc
 	save %sp, -96, %sp
-	cfi_def_cfa_register (%fp)
+	cfi_def_cfa_register(%fp)
 	cfi_window_save
-	cfi_register (%o7, %i7)
+	cfi_register(%o7, %i7)
 	CENABLE
 	 nop
 	mov %o0, %l0
@@ -95,18 +96,20 @@ ENTRY (__socket)
 	mov P(SOCKOP_,socket), %o0
 	LOADSYSCALL(socketcall)
 	t 0x10
-	bcs __syscall_error_handler2
+	bcc 1f
 	 mov %o0, %l1
-	CDISABLE
+	CDISABLE;
+	 mov %l0, %o0;
+	call __syscall_error;
+	 mov %l1, %o0;
+	b 1f
+	 mov -1, %l1;
+1:	CDISABLE
 	 mov %l0, %o0
-	jmpl %i7 + 8, %g0
+2:	jmpl %i7 + 8, %g0
 	 restore %g0, %l1, %o0
-	cfi_endproc
-	SYSCALL_ERROR_HANDLER2
 #endif
 
-	SYSCALL_ERROR_HANDLER
-
 END (__socket)
 
 #ifndef NO_WEAK_ALIAS
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
index 3b135c8e86..1610745524 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
@@ -17,8 +17,10 @@
    02111-1307 USA.  */
 
 #include <sysdep.h>
+
 	.text
-ENTRY (syscall)
+	.globl	__syscall_error
+ENTRY(syscall)
 	mov	%o0, %g1
 	mov	%o1, %o0
 	mov	%o2, %o1
@@ -26,10 +28,10 @@ ENTRY (syscall)
 	mov	%o4, %o3
 	mov	%o5, %o4
 	ta	0x10
-	bcs	__syscall_error_handler
-	 nop
-	retl
+	bcc	1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
-	SYSCALL_ERROR_HANDLER
-
-PSEUDO_END (syscall)
+END(syscall)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
index 45f5c44d5d..c808a97fc5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
@@ -38,131 +38,54 @@
 #undef PSEUDO
 #undef PSEUDO_NOERRNO
 #undef PSEUDO_ERRVAL
+#undef PSEUDO_END
 #undef ENTRY
 #undef END
 #undef LOC
 
-#define ENTRY(name) \
-	.global C_SYMBOL_NAME(name); \
-	.align 4;\
-	C_LABEL(name);\
-	.type name,@function;
+#define ENTRY(name)			\
+	.align	4;			\
+	.global	C_SYMBOL_NAME(name);	\
+	.type	name, @function;	\
+C_LABEL(name)				\
+	cfi_startproc;
 
-#define END(name) \
+#define END(name)			\
+	cfi_endproc;			\
 	.size name, . - name
 
 #define LOC(name)  .L##name
 
-#ifdef LINKER_HANDLES_R_SPARC_WDISP22
-/* Unfortunately, we cannot do this yet.  Linker doesn't seem to
-   handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly .  */
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.section .gnu.linkonce.t.handler,"ax",@progbits;		\
-	.globl handler;							\
-	.hidden handler;						\
-	.type handler,@function;					\
-handler:
-#else
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.subsection 3;							\
-handler:
-#endif
-
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc_get_pic_l7,"ax",@progbits;	\
-	.globl __sparc_get_pic_l7;					\
-	.hidden __sparc_get_pic_l7;					\
-	.type __sparc_get_pic_l7,@function;				\
-__sparc_get_pic_l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-96,%sp;						\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc_get_pic_l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	ld	[%l7 + rtld_errno], %l0;				\
-	st	%i0, [%l0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#elif USE___THREAD
-# ifndef NOT_IN_libc
-#  define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-#  define SYSCALL_ERROR_ERRNO errno
-# endif
-# ifdef SHARED
-#  define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc_get_pic_l7,"ax",@progbits;	\
-	.globl __sparc_get_pic_l7;					\
-	.hidden __sparc_get_pic_l7;					\
-	.type __sparc_get_pic_l7,@function;				\
-__sparc_get_pic_l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-96,%sp;						\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %l1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc_get_pic_l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	add	%l1, %tie_lo10(SYSCALL_ERROR_ERRNO), %l1;		\
-	ld	[%l7 + %l1], %l1, %tie_ld(SYSCALL_ERROR_ERRNO);		\
-	st	%i0, [%g7 + %l1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-# else
-#  define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_), %g2;			\
-	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;		\
-	add	%g2, %lo(_GLOBAL_OFFSET_TABLE_), %g2;			\
-	ld	[%g2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO);		\
-	st	%o0, [%g7 + %g1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%o7+8, %g0;						\
-	 mov	-1, %o0;						\
-	.previous;
-# endif
-#else
-# define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	.global __errno_location;					\
-        .type   __errno_location,@function;				\
-	save   %sp, -96, %sp;						\
-	call   __errno_location;					\
-	 nop;								\
-	st	%i0, [%o0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#endif
-
-#define PSEUDO(name, syscall_name, args)			\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10;						\
-	bcs __syscall_error_handler;				\
-	 nop;							\
-	SYSCALL_ERROR_HANDLER
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)		\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)			\
-	.text;							\
-	ENTRY(name);						\
-	LOADSYSCALL(syscall_name);				\
-	ta 0x10
+	/* If the offset to __syscall_error fits into a signed 22-bit
+	 * immediate branch offset, the linker will relax the call into
+	 * a normal branch.
+	 */
+#define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;			\
+	bcc		1f;			\
+	 mov		%o7, %g1;		\
+	call		__syscall_error;	\
+	 mov		%g1, %o7;		\
+1:
+
+#define PSEUDO_NOERRNO(name, syscall_name, args)\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;
+
+#define PSEUDO_ERRVAL(name, syscall_name, args)	\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x10;
+
+#define PSEUDO_END(name)			\
+	END(name)
 
 #else  /* __ASSEMBLER__ */
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
index 1fabd11f71..134ce789f7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S
@@ -37,8 +37,11 @@ __curbrk: .skip 8
 #endif
 
 	.text
-ENTRY(__brk)
+ENTRY (__brk)
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 #ifdef PIC
 1:	call	2f
 	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(1b-.)), %l7
@@ -90,7 +93,6 @@ ENTRY(__brk)
 	sub	%g0, 1, %i0
 	jmpl	%i7+8, %g0
 	 restore
-
-	.size __brk, .-__brk
+END (__brk)
 
 weak_alias (__brk, brk)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
index 0e1025ff6a..ebfce9e2c5 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S
@@ -23,6 +23,7 @@
 #include <asm/errno.h>
 #include <asm/unistd.h>
 #include <tcb-offsets.h>
+#include <sysdep.h>
 
 #define CLONE_VM	0x00000100
 #define CLONE_THREAD	0x00010000
@@ -34,12 +35,12 @@
 	.register	%g3,#scratch
 
 	.text
-	.align	4
-	.globl	__clone
-	.type	__clone,@function
 
-__clone:
+ENTRY (__clone)
 	save	%sp, -192, %sp
+	cfi_def_cfa_register(%fp)
+	cfi_window_save
+	cfi_register(%o7, %i7)
 
 	/* sanity check arguments */
 	brz,pn	%i0, 99f		/* fn non-NULL? */
@@ -65,7 +66,7 @@ __clone:
 	 nop
 	brnz,pn	%o1, __thread_start
 	 nop
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %o0, %g0, %o0
 99:
 #ifndef _LIBC_REENTRANT
@@ -88,12 +89,13 @@ __clone:
 	 nop
 	st	%i0, [%o0]
 #endif
-	ret
+	jmpl	%i7 + 8, %g0
 	 restore %g0,-1,%o0
-	.size __clone, .-__clone
+END(__clone)
 
 	.type __thread_start,@function
 __thread_start:
+	cfi_startproc
 #ifdef RESET_PID
 	sethi	%hi(CLONE_THREAD), %l0
 	andcc	%g4, %l0, %g0
@@ -112,6 +114,8 @@ __thread_start:
 	 mov	%g3,%o0
 	call	_exit,0
 	 nop
-	.size __thread_start, .-__thread_start
+	cfi_endproc
+
+	.size	__thread_start, .-__thread_start
 
 weak_alias (__clone, clone)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
index 5ccedff21a..14f244e628 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
@@ -19,18 +19,22 @@
 
 #include <sysdep.h>
 
-ENTRY (__libc_pipe)
+	.text
+
+	.globl	__syscall_error
+ENTRY(__libc_pipe)
 	mov	%o0, %o2		/* Save PIPEDES. */
 	LOADSYSCALL(pipe)
 	ta	0x6d
-	bcs,pn	%xcc, __syscall_error_handler
-	 nop
-	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	st	%o0, [%o2]		/* PIPEDES[0] = %o0; */
 	st	%o1, [%o2 + 4]		/* PIPEDES[1] = %o1; */
 	retl
 	 clr	%o0
-	SYSCALL_ERROR_HANDLER
-PSEUDO_END (__libc_pipe)
+END(__libc_pipe)
 
 weak_alias (__libc_pipe, __pipe)
 libc_hidden_def (__pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
index 4e0bc96d22..90d47c18fa 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setcontext.S
@@ -24,12 +24,15 @@
 .weak setcontext
 ENTRY(setcontext)
 
-	mov	1, %o1
+	ba,pt	%xcc, 1f
+	 mov	1, %o1
+
+END(setcontext)
 
 /* int __setcontext(ucontext_t *ctx, int restoremask); */
 ENTRY(__setcontext)
 
-	ldx	[%o0 + UC_SIGMASK], %o2
+1:	ldx	[%o0 + UC_SIGMASK], %o2
 	stx	%o2, [%o0 + __UC_SIGMASK]
 	ta	0x6f
 
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
index 1a9359af5b..ab1690bb42 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S
@@ -39,7 +39,8 @@ libc_hidden_def (_setjmp)
 /* int setjmp(jmp_buf) */
 
 ENTRY(setjmp)
-	set	1, %o1
+	ba,pt	%xcc, __sigsetjmp_local
+	 set	1, %o1
 END(setjmp)
 
 /* int __sigsetjmp(jmp_buf, savemask)  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
index 7a8b205538..353705b4ac 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
@@ -47,8 +47,8 @@
 # endif
 #endif
 
-.globl __socket
-ENTRY (__socket)
+	.globl	__syscall_error
+ENTRY(__socket)
 
 	/* Drop up to 6 arguments (recvfrom) into the memory allocated by
 	   the caller for varargs, since that's really what we have.  */
@@ -77,14 +77,15 @@ ENTRY (__socket)
 	LOADSYSCALL(socketcall)
 	ta	0x6d
 
-	bcs,pn	%xcc, __syscall_error_handler
-	 nop
-	retl
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
 
 #if defined NEED_CANCELLATION && defined CENABLE
 .Lsocket_cancel:
-	cfi_startproc
 	save	%sp, -160, %sp
 	cfi_def_cfa_register (%fp)
 	cfi_window_save
@@ -97,19 +98,21 @@ ENTRY (__socket)
 	LOADSYSCALL(socketcall)
 	ta	0x6d
 
-	bcs,pn	%xcc, __syscall_error_handler2
+	bcc,pt	%xcc, 1f
 	 mov	%o0, %l1
-	CDISABLE
+	CDISABLE;
+	 mov	%l0, %o0;
+	call	__syscall_error;
+	 mov	%l1, %o0;
+	ba,pt	%xcc, 2f
+	 mov	-1, %l1;
+1:	CDISABLE
 	 mov	%l0, %o0
-	jmpl	%i7 + 8, %g0
+2:	jmpl	%i7 + 8, %g0
 	 restore %g0, %l1, %o0
-	cfi_endproc
-	SYSCALL_ERROR_HANDLER2
 #endif
 
-	SYSCALL_ERROR_HANDLER
-
-END (__socket)
+END(__socket)
 
 #ifndef NO_WEAK_ALIAS
 weak_alias (__socket, socket)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S b/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
index 27bd086206..27487d8ed9 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
@@ -19,8 +19,8 @@
 #include <sysdep.h>
 	.text
 
-ENTRY (syscall)
-
+	.globl	__syscall_error
+ENTRY(syscall)
 	mov	%o0,%g1
 	mov	%o1,%o0
 	mov	%o2,%o1
@@ -30,11 +30,10 @@ ENTRY (syscall)
 
 	ta	0x6d
 
-	bcs,pn %xcc,__syscall_error_handler
-	 nop
-	retl
+	bcc,pt	%xcc, 1f
+	 mov	%o7, %g1
+	call	__syscall_error
+	 mov	%g1, %o7
+1:	retl
 	 nop
-
-	SYSCALL_ERROR_HANDLER
-
-PSEUDO_END (syscall)
+END(syscall)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
index dfc38f151a..f156f9241a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -49,142 +49,52 @@
 #undef PSEUDO
 #undef PSEUDO_NOERRNO
 #undef PSEUDO_ERRVAL
-#undef ENTRY
-
-#define ENTRY(name)							\
-	.global C_SYMBOL_NAME(name);					\
-	.align 2;							\
-	C_LABEL(name);							\
-	.type name,@function;
-
-#ifdef LINKER_HANDLES_R_SPARC_WDISP22
-/* Unfortunately, we cannot do this yet.  Linker doesn't seem to
-   handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly .  */
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.section .gnu.linkonce.t.handler,"ax",@progbits;		\
-	.globl handler;							\
-	.hidden handler;						\
-	.type handler,@function;					\
-handler:
-#else
-# define SYSCALL_ERROR_HANDLER_ENTRY(handler)				\
-	.subsection 3;							\
-handler:
-#endif
-
-#if RTLD_PRIVATE_ERRNO
-# define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc64.get_pic.l7,"ax",@progbits;	\
-	.globl __sparc64.get_pic.l7;					\
-	.hidden __sparc64.get_pic.l7;					\
-	.type __sparc64.get_pic.l7,@function;				\
-__sparc64.get_pic.l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp, -192, %sp;						\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc64.get_pic.l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	sethi	%hi(rtld_errno), %g1;					\
-	or	%g1, %lo(rtld_errno), %g1;				\
-	ldx	[%l7 + %g1], %l0;					\
-	st	%i0, [%l0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#elif USE___THREAD
-# ifndef NOT_IN_libc
-#  define SYSCALL_ERROR_ERRNO __libc_errno
-# else
-#  define SYSCALL_ERROR_ERRNO errno
-# endif
-# ifdef SHARED
-#  define SYSCALL_ERROR_HANDLER						\
-	.section .gnu.linkonce.t.__sparc64.get_pic.l7,"ax",@progbits;	\
-	.globl __sparc64.get_pic.l7;					\
-	.hidden __sparc64.get_pic.l7;					\
-	.type __sparc64.get_pic.l7,@function;				\
-__sparc64.get_pic.l7:							\
-	retl;								\
-	 add	%o7, %l7, %l7;						\
-	.previous;							\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	save	%sp,-192,%sp;						\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %l1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_-4), %l7;			\
-	call	__sparc64.get_pic.l7;					\
-	 add	%l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7;			\
-	add	%l1, %tie_lo10(SYSCALL_ERROR_ERRNO), %l1;		\
-	ldx	[%l7 + %l1], %l1, %tie_ldx(SYSCALL_ERROR_ERRNO);	\
-	st	%i0, [%g7 + %l1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-# else
-#  define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	sethi	%tie_hi22(SYSCALL_ERROR_ERRNO), %g1;			\
-	sethi	%hi(_GLOBAL_OFFSET_TABLE_), %g4;			\
-	add	%g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1;		\
-	add	%g4, %lo(_GLOBAL_OFFSET_TABLE_), %g4;			\
-	ldx	[%g4 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);	\
-	st	%o0, [%g7 + %g1], %tie_add(SYSCALL_ERROR_ERRNO);	\
-	jmpl	%o7+8, %g0;						\
-	 mov	-1, %o0;						\
-	.previous;
-# endif
-#else
-# define SYSCALL_ERROR_HANDLER						\
-SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler)			\
-	.global __errno_location;					\
-	.type   __errno_location,@function;				\
-	save	%sp, -192, %sp;						\
-	call	__errno_location;					\
-	 nop;								\
-	st	%i0, [%o0];						\
-	jmpl	%i7+8, %g0;						\
-	 restore %g0, -1, %o0;						\
-	.previous;
-#endif
-
-#define PSEUDO(name, syscall_name, args)				\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d;							\
-	bcs,pn	%xcc, __syscall_error_handler;				\
-	 nop;								\
-	SYSCALL_ERROR_HANDLER
-
-#define PSEUDO_NOERRNO(name, syscall_name, args)			\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d
-
-#define PSEUDO_ERRVAL(name, syscall_name, args)				\
-	.text;								\
-	ENTRY(name);							\
-	LOADSYSCALL(syscall_name);					\
-	ta	0x6d
-
 #undef PSEUDO_END
-#define PSEUDO_END(name)						\
-	.size name,.-name
-
-#undef PSEUDO_END_NOERRNO
-#define PSEUDO_END_NOERRNO(name)					\
-	.size name,.-name
+#undef ENTRY
+#undef END
 
-#undef PSEUDO_END_ERRVAL
-#define PSEUDO_END_ERRVAL(name)						\
-	.size name,.-name
+#define ENTRY(name)			\
+	.align	4;			\
+	.global	C_SYMBOL_NAME(name);	\
+	.type	name, @function;	\
+C_LABEL(name)				\
+	cfi_startproc;
+
+#define END(name)			\
+	cfi_endproc;			\
+	.size name, . - name
+
+	/* If the offset to __syscall_error fits into a signed 22-bit
+	 * immediate branch offset, the linker will relax the call into
+	 * a normal branch.
+	 */
+#define PSEUDO(name, syscall_name, args)	\
+	.text;					\
+	.globl		__syscall_error;	\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;			\
+	bcc,pt		%xcc, 1f;		\
+	 mov		%o7, %g1;		\
+	call		__syscall_error;	\
+	 mov		%g1, %o7;		\
+1:
+
+#define	PSEUDO_NOERRNO(name, syscall_name, args)\
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;
+
+#define	PSEUDO_ERRVAL(name, syscall_name, args) \
+	.text;					\
+ENTRY(name);					\
+	LOADSYSCALL(syscall_name);		\
+	ta		0x6d;
+
+#define PSEUDO_END(name)			\
+	END(name)
 
-#undef END
-#define END(name)							\
-	.size name,.-name
 
 /* Careful here!  This "ret" define can interfere; use jmpl if unsure.  */
 #define ret		retl; nop
diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.S b/sysdeps/unix/sysv/linux/sparc/sysdep.S
deleted file mode 100644
index b031238ceb..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sysdep.S
+++ /dev/null
@@ -1 +0,0 @@
-/* Nothing to do here.  */
diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.c b/sysdeps/unix/sysv/linux/sparc/sysdep.c
new file mode 100644
index 0000000000..f86414570d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sysdep.c
@@ -0,0 +1 @@
+#include <sysdeps/unix/sysv/linux/powerpc/sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/sysconf.c b/sysdeps/unix/sysv/linux/sysconf.c
index 3cf6aa70bb..f9f6f1bfa5 100644
--- a/sysdeps/unix/sysv/linux/sysconf.c
+++ b/sysdeps/unix/sysv/linux/sysconf.c
@@ -1,5 +1,5 @@
 /* Get file-specific information about a file.  Linux version.
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2006 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
@@ -48,6 +48,28 @@ __sysconf (int name)
       }
 #endif
 
+#if defined __NR_clock_getres || HP_TIMING_AVAIL
+    case _SC_CPUTIME:
+    case _SC_THREAD_CPUTIME:
+      {
+	/* If we have HP_TIMING, we will fall back on that if the system
+	   call does not work, so we support it either way.  */
+# if !HP_TIMING_AVAIL
+	/* Check using the clock_getres system call.  */
+	struct timespec ts;
+	INTERNAL_SYSCALL_DECL (err);
+	int r = INTERNAL_SYSCALL (clock_getres, err, 2,
+				  (name == _SC_CPUTIME
+				   ? CLOCK_PROCESS_CPUTIME_ID
+				   : CLOCK_THREAD_CPUTIME_ID),
+				  &ts);
+	if (INTERNAL_SYSCALL_ERROR_P (r, err))
+	  return -1;
+# endif
+	return _POSIX_VERSION;
+      }
+#endif
+
     case _SC_NGROUPS_MAX:
       /* Try to read the information from the /proc/sys/kernel/ngroups_max
 	 file.  */