about summary refs log tree commit diff
path: root/sysdeps/sparc/sparc32
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sysdeps/sparc/sparc32
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'sysdeps/sparc/sparc32')
-rw-r--r--sysdeps/sparc/sparc32/Dist9
-rw-r--r--sysdeps/sparc/sparc32/Implies3
-rw-r--r--sysdeps/sparc/sparc32/__longjmp.S24
-rw-r--r--sysdeps/sparc/sparc32/bits/atomic.h260
-rw-r--r--sysdeps/sparc/sparc32/bits/setjmp.h13
-rw-r--r--sysdeps/sparc/sparc32/dl-machine.h343
-rw-r--r--sysdeps/sparc/sparc32/dl-trampoline.S184
-rw-r--r--sysdeps/sparc/sparc32/elf/start.S10
-rw-r--r--sysdeps/sparc/sparc32/fpu/e_sqrtl.c1
-rw-r--r--sysdeps/sparc/sparc32/fpu/libm-test-ulps433
-rw-r--r--sysdeps/sparc/sparc32/fpu/s_fabs.c11
-rw-r--r--sysdeps/sparc/sparc32/fpu/s_fabsf.S29
-rw-r--r--sysdeps/sparc/sparc32/fpu/s_fabsl.c8
-rw-r--r--sysdeps/sparc/sparc32/jmpbuf-offsets.h22
-rw-r--r--sysdeps/sparc/sparc32/jmpbuf-unwind.h48
-rw-r--r--sysdeps/sparc/sparc32/memchr.S21
-rw-r--r--sysdeps/sparc/sparc32/memcpy.S40
-rw-r--r--sysdeps/sparc/sparc32/memset.S2
-rw-r--r--sysdeps/sparc/sparc32/setjmp.S16
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/Dist28
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/Makefile20
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/Versions8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_add.c8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_div.c4
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_dtoq.c10
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_itoq.c6
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_lltoq.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_xtoq.c)8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtod.c10
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoi.c6
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoll.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_qtox.c)10
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtos.c10
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtou.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_qtoui.c)6
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_qtoull.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_qtoux.c)8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_sqrt.c3
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_stoq.c10
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_sub.c8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c)8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/q_utoq.c (renamed from sysdeps/sparc/sparc32/soft-fp/q_uitoq.c)8
-rw-r--r--sysdeps/sparc/sparc32/soft-fp/sfp-machine.h14
-rw-r--r--sysdeps/sparc/sparc32/sparcv8/Dist6
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/Dist7
-rw-r--r--sysdeps/sparc/sparc32/sparcv9/bits/atomic.h12
-rw-r--r--sysdeps/sparc/sparc32/sparcv9b/Implies1
-rw-r--r--sysdeps/sparc/sparc32/sparcv9v/memcpy.S2
-rw-r--r--sysdeps/sparc/sparc32/sparcv9v/memset.S2
-rw-r--r--sysdeps/sparc/sparc32/stpcpy.S16
-rw-r--r--sysdeps/sparc/sparc32/strcat.S78
-rw-r--r--sysdeps/sparc/sparc32/strchr.S37
-rw-r--r--sysdeps/sparc/sparc32/strcmp.S14
-rw-r--r--sysdeps/sparc/sparc32/strcpy.S16
-rw-r--r--sysdeps/sparc/sparc32/strlen.S28
51 files changed, 1407 insertions, 482 deletions
diff --git a/sysdeps/sparc/sparc32/Dist b/sysdeps/sparc/sparc32/Dist
deleted file mode 100644
index c3bf9746bc..0000000000
--- a/sysdeps/sparc/sparc32/Dist
+++ /dev/null
@@ -1,9 +0,0 @@
-dotmul.S
-umul.S
-divrem.m4
-sdiv.S
-udiv.S
-rem.S
-urem.S
-alloca.S
-ieee754.h
diff --git a/sysdeps/sparc/sparc32/Implies b/sysdeps/sparc/sparc32/Implies
index 5312721497..436436a651 100644
--- a/sysdeps/sparc/sparc32/Implies
+++ b/sysdeps/sparc/sparc32/Implies
@@ -1,5 +1,6 @@
 wordsize-32
 # SPARC uses IEEE 754 floating point.
-ieee754/flt-32
+ieee754/ldbl-128
 ieee754/dbl-64
+ieee754/flt-32
 sparc/sparc32/soft-fp
diff --git a/sysdeps/sparc/sparc32/__longjmp.S b/sysdeps/sparc/sparc32/__longjmp.S
index 1c81c92692..a5453b4294 100644
--- a/sysdeps/sparc/sparc32/__longjmp.S
+++ b/sysdeps/sparc/sparc32/__longjmp.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 93, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1996, 1997, 1998, 1999, 2000, 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
@@ -18,9 +19,7 @@
 
 #include <sysdep.h>
 
-#define _ASM 1
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 #define ENV(base,reg) [%base + (reg * 4)]
 #define ST_FLUSH_WINDOWS 3
 #define RW_FP [%fp + 0x48]
@@ -30,6 +29,9 @@ ENTRY(__longjmp)
 	   use them while unwinding frames and their register windows.  */
 
 	ld ENV(o0,JB_FP), %g3	/* Cache target FP in register %g3.  */
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE (%g3, %g3, %g4)
+#endif
 	mov %o0, %g1		/* ENV in %g1 */
      	orcc %o1, %g0, %g2	/* VAL in %g2 */
      	be,a 0f			/* Branch if zero; else skip delay slot.  */
@@ -62,8 +64,15 @@ LOC(thread):
 	 * windows.
 	 */
 	ta	ST_FLUSH_WINDOWS
+#ifdef PTR_DEMANGLE
+	ld	ENV(g1,JB_PC), %g5 /* Set return PC. */
+	ld	ENV(g1,JB_SP), %g1 /* Set saved SP on restore below. */
+	PTR_DEMANGLE2 (%o7, %g5, %g4)
+	PTR_DEMANGLE2 (%fp, %g1, %g4)
+#else
 	ld	ENV(g1,JB_PC), %o7 /* Set return PC. */
 	ld	ENV(g1,JB_SP), %fp /* Set saved SP on restore below. */
+#endif
 	sub	%fp, 64, %sp	/* Allocate a register frame. */
 	st	%g3, RW_FP	/* Set saved FP on restore below. */
 	retl
@@ -71,10 +80,17 @@ LOC(thread):
 
 LOC(found):
 	/* We have unwound register windows so %fp matches the target.  */
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE2 (%sp, %o0, %g4)
+#else
 	mov %o0, %sp		/* OK, install new SP.  */
+#endif
 
 LOC(sp_ok):
 	ld ENV(g1,JB_PC), %o0	/* Extract target return PC.  */
+#ifdef PTR_DEMANGLE
+	PTR_DEMANGLE2 (%o0, %o0, %g4)
+#endif
 	jmp %o0 + 8		/* Return there.  */
 	 mov %g2, %o0		/* Delay slot: set return value.  */
 
diff --git a/sysdeps/sparc/sparc32/bits/atomic.h b/sysdeps/sparc/sparc32/bits/atomic.h
index 736372a3d4..ef553f7270 100644
--- a/sysdeps/sparc/sparc32/bits/atomic.h
+++ b/sysdeps/sparc/sparc32/bits/atomic.h
@@ -1,5 +1,5 @@
 /* Atomic operations.  sparc32 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.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -21,6 +21,34 @@
 #ifndef _BITS_ATOMIC_H
 #define _BITS_ATOMIC_H	1
 
+#include <stdint.h>
+
+typedef int8_t atomic8_t;
+typedef uint8_t uatomic8_t;
+typedef int_fast8_t atomic_fast8_t;
+typedef uint_fast8_t uatomic_fast8_t;
+
+typedef int16_t atomic16_t;
+typedef uint16_t uatomic16_t;
+typedef int_fast16_t atomic_fast16_t;
+typedef uint_fast16_t uatomic_fast16_t;
+
+typedef int32_t atomic32_t;
+typedef uint32_t uatomic32_t;
+typedef int_fast32_t atomic_fast32_t;
+typedef uint_fast32_t uatomic_fast32_t;
+
+typedef int64_t atomic64_t;
+typedef uint64_t uatomic64_t;
+typedef int_fast64_t atomic_fast64_t;
+typedef uint_fast64_t uatomic_fast64_t;
+
+typedef intptr_t atomicptr_t;
+typedef uintptr_t uatomicptr_t;
+typedef intmax_t atomic_max_t;
+typedef uintmax_t uatomic_max_t;
+
+
 /* We have no compare and swap, just test and set.
    The following implementation contends on 64 global locks
    per library and assumes no variable will be accessed using atomic.h
@@ -41,22 +69,65 @@ volatile unsigned char __sparc32_atomic_locks[64]
       unsigned int __idx = (((long) addr >> 2) ^ ((long) addr >> 12)) \
 			   & 63;				      \
       do							      \
-	__asm ("ldstub %1, %0"					      \
-	       : "=r" (__old_lock),				      \
-		 "=m" (__sparc32_atomic_locks[__idx])		      \
-	       : "m" (__sparc32_atomic_locks[__idx]));		      \
+	__asm __volatile ("ldstub %1, %0"			      \
+			  : "=r" (__old_lock),			      \
+			    "=m" (__sparc32_atomic_locks[__idx])      \
+			  : "m" (__sparc32_atomic_locks[__idx])	      \
+			  : "memory");				      \
       while (__old_lock);					      \
     }								      \
   while (0)
 
 #define __sparc32_atomic_do_unlock(addr) \
   do								      \
-    __sparc32_atomic_locks[(((long) addr >> 2)			      \
-			    ^ ((long) addr >> 12)) & 63] = 0;	      \
+    {								      \
+      __sparc32_atomic_locks[(((long) addr >> 2)		      \
+			      ^ ((long) addr >> 12)) & 63] = 0;	      \
+      __asm __volatile ("" ::: "memory");			      \
+    }								      \
+  while (0)
+
+#define __sparc32_atomic_do_lock24(addr) \
+  do								      \
+    {								      \
+      unsigned int __old_lock;					      \
+      do							      \
+	__asm __volatile ("ldstub %1, %0"			      \
+			  : "=r" (__old_lock), "=m" (*(addr))	      \
+			  : "m" (*(addr))			      \
+			  : "memory");				      \
+      while (__old_lock);					      \
+    }								      \
   while (0)
 
+#define __sparc32_atomic_do_unlock24(addr) \
+  do								      \
+    {								      \
+      *(char *) (addr) = 0;					      \
+      __asm __volatile ("" ::: "memory");			      \
+    }								      \
+  while (0)
+
+
+#ifndef SHARED
+# define __v9_compare_and_exchange_val_32_acq(mem, newval, oldval) \
+({									      \
+  register __typeof (*(mem)) __acev_tmp __asm ("%g6");			      \
+  register __typeof (mem) __acev_mem __asm ("%g1") = (mem);		      \
+  register __typeof (*(mem)) __acev_oldval __asm ("%g5");		      \
+  __acev_tmp = (newval);						      \
+  __acev_oldval = (oldval);						      \
+  /* .word 0xcde05005 is cas [%g1], %g5, %g6.  Can't use cas here though,     \
+     because as will then mark the object file as V8+ arch.  */		      \
+  __asm __volatile (".word 0xcde05005"					      \
+		    : "+r" (__acev_tmp), "=m" (*__acev_mem)		      \
+		    : "r" (__acev_oldval), "m" (*__acev_mem),		      \
+		      "r" (__acev_mem) : "memory");			      \
+  __acev_tmp; })
+#endif
+
 /* The only basic operation needed is compare and exchange.  */
-#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+#define __v7_compare_and_exchange_val_acq(mem, newval, oldval) \
   ({ __typeof (mem) __acev_memp = (mem);			      \
      __typeof (*mem) __acev_ret;				      \
      __typeof (*mem) __acev_newval = (newval);			      \
@@ -68,7 +139,7 @@ volatile unsigned char __sparc32_atomic_locks[64]
      __sparc32_atomic_do_unlock (__acev_memp);			      \
      __acev_ret; })
 
-#define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+#define __v7_compare_and_exchange_bool_acq(mem, newval, oldval) \
   ({ __typeof (mem) __aceb_memp = (mem);			      \
      int __aceb_ret;						      \
      __typeof (*mem) __aceb_newval = (newval);			      \
@@ -82,4 +153,175 @@ volatile unsigned char __sparc32_atomic_locks[64]
      __sparc32_atomic_do_unlock (__aceb_memp);			      \
      __aceb_ret; })
 
+#define __v7_exchange_acq(mem, newval) \
+  ({ __typeof (mem) __acev_memp = (mem);			      \
+     __typeof (*mem) __acev_ret;				      \
+     __typeof (*mem) __acev_newval = (newval);			      \
+								      \
+     __sparc32_atomic_do_lock (__acev_memp);			      \
+     __acev_ret = *__acev_memp;					      \
+     *__acev_memp = __acev_newval;				      \
+     __sparc32_atomic_do_unlock (__acev_memp);			      \
+     __acev_ret; })
+
+#define __v7_exchange_and_add(mem, value) \
+  ({ __typeof (mem) __acev_memp = (mem);			      \
+     __typeof (*mem) __acev_ret;				      \
+								      \
+     __sparc32_atomic_do_lock (__acev_memp);			      \
+     __acev_ret = *__acev_memp;					      \
+     *__acev_memp = __acev_ret + (value);			      \
+     __sparc32_atomic_do_unlock (__acev_memp);			      \
+     __acev_ret; })
+
+/* Special versions, which guarantee that top 8 bits of all values
+   are cleared and use those bits as the ldstub lock.  */
+#define __v7_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+  ({ __typeof (mem) __acev_memp = (mem);			      \
+     __typeof (*mem) __acev_ret;				      \
+     __typeof (*mem) __acev_newval = (newval);			      \
+								      \
+     __sparc32_atomic_do_lock24 (__acev_memp);			      \
+     __acev_ret = *__acev_memp & 0xffffff;			      \
+     if (__acev_ret == (oldval))				      \
+       *__acev_memp = __acev_newval;				      \
+     else							      \
+       __sparc32_atomic_do_unlock24 (__acev_memp);		      \
+     __asm __volatile ("" ::: "memory");			      \
+     __acev_ret; })
+
+#define __v7_exchange_24_rel(mem, newval) \
+  ({ __typeof (mem) __acev_memp = (mem);			      \
+     __typeof (*mem) __acev_ret;				      \
+     __typeof (*mem) __acev_newval = (newval);			      \
+								      \
+     __sparc32_atomic_do_lock24 (__acev_memp);			      \
+     __acev_ret = *__acev_memp & 0xffffff;			      \
+     *__acev_memp = __acev_newval;				      \
+     __asm __volatile ("" ::: "memory");			      \
+     __acev_ret; })
+
+#ifdef SHARED
+
+/* When dynamically linked, we assume pre-v9 libraries are only ever
+   used on pre-v9 CPU.  */
+# define __atomic_is_v9 0
+
+# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+  __v7_compare_and_exchange_val_acq (mem, newval, oldval)
+
+# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+  __v7_compare_and_exchange_bool_acq (mem, newval, oldval)
+
+# define atomic_exchange_acq(mem, newval) \
+  __v7_exchange_acq (mem, newval)
+
+# define atomic_exchange_and_add(mem, value) \
+  __v7_exchange_and_add (mem, value)
+
+# define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+  ({								      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     __v7_compare_and_exchange_val_24_acq (mem, newval, oldval); })
+
+# define atomic_exchange_24_rel(mem, newval) \
+  ({								      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     __v7_exchange_24_rel (mem, newval); })
+
+#else
+
+/* In libc.a/libpthread.a etc. we don't know if we'll be run on
+   pre-v9 or v9 CPU.  To be interoperable with dynamically linked
+   apps on v9 CPUs e.g. with process shared primitives, use cas insn
+   on v9 CPUs and ldstub on pre-v9.  */
+
+/* Avoid <ldsodefs.h> include here.  */
+extern uint64_t _dl_hwcap __attribute__((weak));
+# define __ATOMIC_HWCAP_SPARC_V9	16
+# define __atomic_is_v9 \
+  (__builtin_expect (&_dl_hwcap != 0, 1) \
+   && __builtin_expect (_dl_hwcap & __ATOMIC_HWCAP_SPARC_V9, \
+			__ATOMIC_HWCAP_SPARC_V9))
+
+# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+  ({								      \
+     __typeof (*mem) __acev_wret;				      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       __acev_wret						      \
+	 = __v9_compare_and_exchange_val_32_acq (mem, newval, oldval);\
+     else							      \
+       __acev_wret						      \
+	 = __v7_compare_and_exchange_val_acq (mem, newval, oldval);   \
+     __acev_wret; })
+
+# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+  ({								      \
+     int __acev_wret;						      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       {							      \
+	 __typeof (oldval) __acev_woldval = (oldval);		      \
+	 __acev_wret						      \
+	   = __v9_compare_and_exchange_val_32_acq (mem, newval,	      \
+						   __acev_woldval)    \
+	     != __acev_woldval;					      \
+       }							      \
+     else							      \
+       __acev_wret						      \
+	 = __v7_compare_and_exchange_bool_acq (mem, newval, oldval);  \
+     __acev_wret; })
+
+# define atomic_exchange_rel(mem, newval) \
+  ({								      \
+     __typeof (*mem) __acev_wret;				      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       {							      \
+	 __typeof (mem) __acev_wmemp = (mem);			      \
+	 __typeof (*(mem)) __acev_wval = (newval);		      \
+	 do							      \
+	   __acev_wret = *__acev_wmemp;				      \
+	 while (__builtin_expect				      \
+		  (__v9_compare_and_exchange_val_32_acq (__acev_wmemp,\
+							 __acev_wval, \
+							 __acev_wret) \
+		   != __acev_wret, 0));				      \
+       }							      \
+     else							      \
+       __acev_wret = __v7_exchange_acq (mem, newval);		      \
+     __acev_wret; })
+
+# define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+  ({								      \
+     __typeof (*mem) __acev_wret;				      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       __acev_wret						      \
+	 = __v9_compare_and_exchange_val_32_acq (mem, newval, oldval);\
+     else							      \
+       __acev_wret						      \
+	 = __v7_compare_and_exchange_val_24_acq (mem, newval, oldval);\
+     __acev_wret; })
+
+# define atomic_exchange_24_rel(mem, newval) \
+  ({								      \
+     __typeof (*mem) __acev_w24ret;				      \
+     if (sizeof (*mem) != 4)					      \
+       abort ();						      \
+     if (__atomic_is_v9)					      \
+       __acev_w24ret = atomic_exchange_rel (mem, newval);	      \
+     else							      \
+       __acev_w24ret = __v7_exchange_24_rel (mem, newval);	      \
+     __acev_w24ret; })
+
+#endif
+
 #endif	/* bits/atomic.h */
diff --git a/sysdeps/sparc/sparc32/bits/setjmp.h b/sysdeps/sparc/sparc32/bits/setjmp.h
index 76d7af02c7..86ccc20d20 100644
--- a/sysdeps/sparc/sparc32/bits/setjmp.h
+++ b/sysdeps/sparc/sparc32/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2005, 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
@@ -22,17 +22,6 @@
 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
 #endif
 
-#if defined __USE_MISC || defined _ASM
-# define JB_SP	0
-# define JB_FP	1
-# define JB_PC	2
-#endif
-
 #ifndef	_ASM
 typedef int __jmp_buf[3];
 #endif
-
-/* Test if longjmp to JMPBUF would unwind the frame
-   containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((int) (address) < (jmpbuf)[JB_SP])
diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h
index 52fc6329dd..02dabaabb4 100644
--- a/sysdeps/sparc/sparc32/dl-machine.h
+++ b/sysdeps/sparc/sparc32/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  SPARC version.
-   Copyright (C) 1996-2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1996-2003, 2004, 2005, 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
@@ -40,13 +40,6 @@
 #define OPCODE_SAVE_SP	0x9de3bfa8 /* save %sp, -(16+6)*4, %sp */
 #define OPCODE_BA	0x30800000 /* b,a ?; add PC-rel word address */
 
-/* Use a different preload file when running in 32-bit emulation mode
-   on a 64-bit host.  */
-#define LD_SO_PRELOAD ((GLRO(dl_hwcap) & HWCAP_SPARC_V9) \
-		       ? "/etc/ld.so.preload32" \
-		       : "/etc/ld.so.preload")
-
-
 /* Return nonzero iff ELF header is compatible with the running host.  */
 static inline int
 elf_machine_matches_host (const Elf32_Ehdr *ehdr)
@@ -131,30 +124,31 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 	 bits of %g1 with an offset into the .rela.plt section and jump to
 	 the beginning of the PLT.  */
       plt = (Elf32_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
-      if (! profile)
-	rfunc = (Elf32_Addr) &_dl_runtime_resolve;
-      else
+      if (__builtin_expect(profile, 0))
 	{
 	  rfunc = (Elf32_Addr) &_dl_runtime_profile;
 
-	  if (_dl_name_match_p (GLRO(dl_profile), l))
+	  if (GLRO(dl_profile) != NULL
+	      && _dl_name_match_p (GLRO(dl_profile), l))
 	    GL(dl_profile_map) = l;
 	}
+      else
+	{
+	  rfunc = (Elf32_Addr) &_dl_runtime_resolve;
+	}
 
       /* The beginning of the PLT does:
 
-		save %sp, -64, %sp
-	 pltpc:	call _dl_runtime_resolve
-		nop
+		sethi %hi(_dl_runtime_{resolve,profile}), %g2
+	 pltpc:	jmpl %g2 + %lo(_dl_runtime_{resolve,profile}), %g2
+		 nop
 		.word MAP
 
-         This saves the register window containing the arguments, and the
-	 PC value (pltpc) implicitly saved in %o7 by the call points near the
+         The PC value (pltpc) saved in %g2 by the jmpl points near the
 	 location where we store the link_map pointer for this object.  */
 
-      plt[0] = OPCODE_SAVE_SP;
-      /* Construct PC-relative word address.  */
-      plt[1] = OPCODE_CALL | ((rfunc - (Elf32_Addr) &plt[1]) >> 2);
+      plt[0] = 0x05000000 | ((rfunc >> 10) & 0x003fffff);
+      plt[1] = 0x85c0a000 | (rfunc & 0x3ff);
       plt[2] = OPCODE_NOP;	/* Fill call delay slot.  */
       plt[3] = (Elf32_Addr) l;
       if (__builtin_expect (l->l_info[VALIDX(DT_GNU_PRELINKED)] != NULL, 0)
@@ -190,39 +184,6 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
   return lazy;
 }
 
-/* This code is used in dl-runtime.c to call the `fixup' function
-   and then redirect to the address it returns.  */
-#define TRAMPOLINE_TEMPLATE(tramp_name, fixup_name)	\
-  asm ( "\
-	.text\n\
-	.globl	" #tramp_name "\n\
-	.type	" #tramp_name ", @function\n\
-	.align	32\n\
-" #tramp_name ":\n\
-	/* Set up the arguments to fixup --\n\
-	   %o0 = link_map out of plt0\n\
-	   %o1 = offset of reloc entry\n\
-	   %o2 = return address  */\n\
-	ld	[%o7 + 8], %o0\n\
-	srl	%g1, 10, %o1\n\
-	mov	%i7, %o2\n\
-	call	" #fixup_name "\n\
-	 sub	%o1, 4*12, %o1\n\
-	jmp	%o0\n\
-	 restore\n\
-	.size	" #tramp_name ", . - " #tramp_name "\n\
-	.previous")
-
-#ifndef PROF
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, profile_fixup);
-#else
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE			\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_resolve, fixup);	\
-  TRAMPOLINE_TEMPLATE (_dl_runtime_profile, fixup);
-#endif
-
 /* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
    PLT entries should not be allowed to define the value.
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
@@ -406,18 +367,25 @@ elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc,
 
 #endif /* dl_machine_h */
 
-#ifdef RESOLVE
+#define ARCH_LA_PLTENTER	sparc32_gnu_pltenter
+#define ARCH_LA_PLTEXIT		sparc32_gnu_pltexit
+
+#ifdef RESOLVE_MAP
 
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
 		  const Elf32_Sym *sym, const struct r_found_version *version,
 		  void *const reloc_addr_arg)
 {
   Elf32_Addr *const reloc_addr = reloc_addr_arg;
+  const Elf32_Sym *const refsym = sym;
+  Elf32_Addr value;
   const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
+  struct link_map *sym_map = NULL;
 
 #if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
   /* This is defined in rtld.c, but nowhere in the static libc.a; make the
@@ -428,6 +396,9 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
   weak_extern (_dl_rtld_map);
 #endif
 
+  if (__builtin_expect (r_type == R_SPARC_NONE, 0))
+    return;
+
 #if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
   if (__builtin_expect (r_type == R_SPARC_RELATIVE, 0))
     {
@@ -435,165 +406,148 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
       if (map != &_dl_rtld_map) /* Already done in rtld itself. */
 # endif
 	*reloc_addr += map->l_addr + reloc->r_addend;
+      return;
     }
-  else
-#endif
-    {
-#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
-      const Elf32_Sym *const refsym = sym;
-# ifdef USE_TLS
-      struct link_map *sym_map;
-# endif
 #endif
-      Elf32_Addr value;
+
 #ifndef RESOLVE_CONFLICT_FIND_MAP
-      if (sym->st_shndx != SHN_UNDEF &&
-	  ELF32_ST_BIND (sym->st_info) == STB_LOCAL)
-	{
-	  value = map->l_addr;
-# if defined USE_TLS && !defined RTLD_BOOTSTRAP
-	  sym_map = map;
-# endif
-	}
-      else
-	{
-# if defined USE_TLS && !defined RTLD_BOOTSTRAP
-	  sym_map = RESOLVE_MAP (&sym, version, r_type);
-	  value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
-# else
-	  value = RESOLVE (&sym, version, r_type);
-	  if (sym)
-	    value += sym->st_value;
-# endif
-	}
+  if (__builtin_expect (ELF32_ST_BIND (sym->st_info) == STB_LOCAL, 0)
+      && sym->st_shndx != SHN_UNDEF)
+    {
+      value = map->l_addr;
+    }
+  else
+    {
+      sym_map = RESOLVE_MAP (&sym, version, r_type);
+      value = sym_map == NULL ? 0 : sym_map->l_addr + sym->st_value;
+    }
 #else
-      value = 0;
+  value = 0;
 #endif
-      value += reloc->r_addend;	/* Assume copy relocs have zero addend.  */
 
-      switch (r_type)
-	{
+  value += reloc->r_addend;	/* Assume copy relocs have zero addend.  */
+
+  switch (r_type)
+    {
 #if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
-	case R_SPARC_COPY:
-	  if (sym == NULL)
-	    /* This can happen in trace mode if an object could not be
-	       found.  */
-	    break;
-	  if (sym->st_size > refsym->st_size
-	      || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
-	    {
-	      const char *strtab;
+    case R_SPARC_COPY:
+      if (sym == NULL)
+	/* This can happen in trace mode if an object could not be
+	   found.  */
+	break;
+      if (sym->st_size > refsym->st_size
+	  || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
+	{
+	  const char *strtab;
 
-	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-	      _dl_error_printf ("\
+	  strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
+	  _dl_error_printf ("\
 %s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				rtld_progname ?: "<program name unknown>",
-				strtab + refsym->st_name);
-	    }
-	  memcpy (reloc_addr_arg, (void *) value,
-		  MIN (sym->st_size, refsym->st_size));
-	  break;
+			    rtld_progname ?: "<program name unknown>",
+			    strtab + refsym->st_name);
+	}
+      memcpy (reloc_addr_arg, (void *) value,
+	      MIN (sym->st_size, refsym->st_size));
+      break;
 #endif
-	case R_SPARC_GLOB_DAT:
-	case R_SPARC_32:
-	  *reloc_addr = value;
-	  break;
-	case R_SPARC_JMP_SLOT:
-	  /* At this point we don't need to bother with thread safety,
-	     so we can optimize the first instruction of .plt out.  */
-	  sparc_fixup_plt (reloc, reloc_addr, value, 0);
-	  break;
+    case R_SPARC_GLOB_DAT:
+    case R_SPARC_32:
+      *reloc_addr = value;
+      break;
+    case R_SPARC_JMP_SLOT:
+      /* At this point we don't need to bother with thread safety,
+	 so we can optimize the first instruction of .plt out.  */
+      sparc_fixup_plt (reloc, reloc_addr, value, 0);
+      break;
 #if defined USE_TLS && (!defined RTLD_BOOTSTRAP || USE___THREAD) \
     && !defined RESOLVE_CONFLICT_FIND_MAP
-	case R_SPARC_TLS_DTPMOD32:
-	  /* Get the information from the link map returned by the
-	     resolv function.  */
-	  if (sym_map != NULL)
-	    *reloc_addr = sym_map->l_tls_modid;
-	  break;
-	case R_SPARC_TLS_DTPOFF32:
-	  /* During relocation all TLS symbols are defined and used.
-	     Therefore the offset is already correct.  */
-	  *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
-	  break;
-	case R_SPARC_TLS_TPOFF32:
-	  /* The offset is negative, forward from the thread pointer.  */
-	  /* We know the offset of object the symbol is contained in.
-	     It is a negative value which will be added to the
-	     thread pointer.  */
-	  if (sym != NULL)
-	    {
-	      CHECK_STATIC_TLS (map, sym_map);
-	      *reloc_addr = sym->st_value - sym_map->l_tls_offset
-			    + reloc->r_addend;
-	    }
-	  break;
+    case R_SPARC_TLS_DTPMOD32:
+      /* Get the information from the link map returned by the
+	 resolv function.  */
+      if (sym_map != NULL)
+	*reloc_addr = sym_map->l_tls_modid;
+      break;
+    case R_SPARC_TLS_DTPOFF32:
+      /* During relocation all TLS symbols are defined and used.
+	 Therefore the offset is already correct.  */
+      *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
+      break;
+    case R_SPARC_TLS_TPOFF32:
+      /* The offset is negative, forward from the thread pointer.  */
+      /* We know the offset of object the symbol is contained in.
+	 It is a negative value which will be added to the
+	 thread pointer.  */
+      if (sym != NULL)
+	{
+	  CHECK_STATIC_TLS (map, sym_map);
+	  *reloc_addr = sym->st_value - sym_map->l_tls_offset
+	    + reloc->r_addend;
+	}
+      break;
 # ifndef RTLD_BOOTSTRAP
-	case R_SPARC_TLS_LE_HIX22:
-	case R_SPARC_TLS_LE_LOX10:
-	  if (sym != NULL)
-	    {
-	      CHECK_STATIC_TLS (map, sym_map);
-	      value = sym->st_value - sym_map->l_tls_offset
-		      + reloc->r_addend;
-	      if (r_type == R_SPARC_TLS_LE_HIX22)
-		*reloc_addr = (*reloc_addr & 0xffc00000) | ((~value) >> 10);
-	      else
-		*reloc_addr = (*reloc_addr & 0xffffe000) | (value & 0x3ff)
-			      | 0x1c00;
-	    }
-	  break;
+    case R_SPARC_TLS_LE_HIX22:
+    case R_SPARC_TLS_LE_LOX10:
+      if (sym != NULL)
+	{
+	  CHECK_STATIC_TLS (map, sym_map);
+	  value = sym->st_value - sym_map->l_tls_offset
+	    + reloc->r_addend;
+	  if (r_type == R_SPARC_TLS_LE_HIX22)
+	    *reloc_addr = (*reloc_addr & 0xffc00000) | ((~value) >> 10);
+	  else
+	    *reloc_addr = (*reloc_addr & 0xffffe000) | (value & 0x3ff)
+	      | 0x1c00;
+	}
+      break;
 # endif
 #endif
 #ifndef RTLD_BOOTSTRAP
-	case R_SPARC_8:
-	  *(char *) reloc_addr = value;
-	  break;
-	case R_SPARC_16:
-	  *(short *) reloc_addr = value;
-	  break;
-	case R_SPARC_DISP8:
-	  *(char *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
-	  break;
-	case R_SPARC_DISP16:
-	  *(short *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
-	  break;
-	case R_SPARC_DISP32:
-	  *reloc_addr = (value - (Elf32_Addr) reloc_addr);
-	  break;
-	case R_SPARC_LO10:
-	  *reloc_addr = (*reloc_addr & ~0x3ff) | (value & 0x3ff);
-	  break;
-	case R_SPARC_WDISP30:
-	  *reloc_addr = ((*reloc_addr & 0xc0000000)
-			 | ((value - (unsigned int) reloc_addr) >> 2));
-	  break;
-	case R_SPARC_HI22:
-	  *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10);
-	  break;
-	case R_SPARC_UA16:
-	  ((unsigned char *) reloc_addr_arg) [0] = value >> 8;
-	  ((unsigned char *) reloc_addr_arg) [1] = value;
-	  break;
-	case R_SPARC_UA32:
-	  ((unsigned char *) reloc_addr_arg) [0] = value >> 24;
-	  ((unsigned char *) reloc_addr_arg) [1] = value >> 16;
-	  ((unsigned char *) reloc_addr_arg) [2] = value >> 8;
-	  ((unsigned char *) reloc_addr_arg) [3] = value;
-	  break;
+    case R_SPARC_8:
+      *(char *) reloc_addr = value;
+      break;
+    case R_SPARC_16:
+      *(short *) reloc_addr = value;
+      break;
+    case R_SPARC_DISP8:
+      *(char *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
+      break;
+    case R_SPARC_DISP16:
+      *(short *) reloc_addr = (value - (Elf32_Addr) reloc_addr);
+      break;
+    case R_SPARC_DISP32:
+      *reloc_addr = (value - (Elf32_Addr) reloc_addr);
+      break;
+    case R_SPARC_LO10:
+      *reloc_addr = (*reloc_addr & ~0x3ff) | (value & 0x3ff);
+      break;
+    case R_SPARC_WDISP30:
+      *reloc_addr = ((*reloc_addr & 0xc0000000)
+		     | ((value - (unsigned int) reloc_addr) >> 2));
+      break;
+    case R_SPARC_HI22:
+      *reloc_addr = (*reloc_addr & 0xffc00000) | (value >> 10);
+      break;
+    case R_SPARC_UA16:
+      ((unsigned char *) reloc_addr_arg) [0] = value >> 8;
+      ((unsigned char *) reloc_addr_arg) [1] = value;
+      break;
+    case R_SPARC_UA32:
+      ((unsigned char *) reloc_addr_arg) [0] = value >> 24;
+      ((unsigned char *) reloc_addr_arg) [1] = value >> 16;
+      ((unsigned char *) reloc_addr_arg) [2] = value >> 8;
+      ((unsigned char *) reloc_addr_arg) [3] = value;
+      break;
 #endif
-	case R_SPARC_NONE:		/* Alright, Wilbur.  */
-	  break;
 #if !defined RTLD_BOOTSTRAP || defined _NDEBUG
-	default:
-	  _dl_reloc_bad_type (map, r_type, 0);
-	  break;
+    default:
+      _dl_reloc_bad_type (map, r_type, 0);
+      break;
 #endif
-	}
     }
 }
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
 			   void *const reloc_addr_arg)
 {
@@ -601,7 +555,8 @@ elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
   *reloc_addr += l_addr + reloc->r_addend;
 }
 
-static inline void
+auto inline void
+__attribute__ ((always_inline))
 elf_machine_lazy_rel (struct link_map *map,
 		      Elf32_Addr l_addr, const Elf32_Rela *reloc)
 {
@@ -617,4 +572,4 @@ elf_machine_lazy_rel (struct link_map *map,
     }
 }
 
-#endif	/* RESOLVE */
+#endif	/* RESOLVE_MAP */
diff --git a/sysdeps/sparc/sparc32/dl-trampoline.S b/sysdeps/sparc/sparc32/dl-trampoline.S
new file mode 100644
index 0000000000..b0f86dda4e
--- /dev/null
+++ b/sysdeps/sparc/sparc32/dl-trampoline.S
@@ -0,0 +1,184 @@
+/* PLT trampolines.  Sparc 32-bit version.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+	.text
+	.align	32
+
+	/* %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
+	 *      the address of the link map
+	 */
+	.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
+	 * as the base of the La_sparc64_regs, so it looks
+	 * like:
+	 *	%l0			%sp
+	 *	...
+	 *	%l7			%sp + (7 * 8)
+	 *	%i0			%sp + (8 * 8)
+	 *	...
+	 *	%i7			%sp + (15 * 8)
+	 *	%f0			%sp + (16 * 8)
+	 *	%f16			%sp + (31 * 8)
+	 *	framesize		%sp + (32 * 8)
+	 */
+
+	.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)]
+	std	%l6, [%sp + ( 3 * 8)]
+	std	%i0, [%sp + ( 4 * 8)]
+	std	%i2, [%sp + ( 5 * 8)]
+	std	%i4, [%sp + ( 6 * 8)]
+	std	%i6, [%sp + ( 7 * 8)]
+	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
+	 * the caller's stack frame.
+	 * %o0: PLT resolved function address
+	 */
+	.globl	_dl_profile_invoke
+	.type	_dl_profile_invoke, @function
+_dl_profile_invoke:
+	cfi_startproc
+
+	sub	%sp, %l0, %sp
+1:
+	srl	%l0, 3, %l7
+	mov	%o0, %l1
+	mov	%i0, %o0
+	mov	%i1, %o1
+	mov	%i2, %o2
+	mov	%i3, %o3
+	mov	%i4, %o4
+	mov	%i5, %o5
+	mov	%fp, %l2
+	mov	%sp, %l3
+1:	ldd	[%l2], %g2
+	add	%l2, 0x8, %l2
+	subcc	%l7, 1, %l7
+	std	%g2, [%l3]
+	bne	1b
+	 add	%l3, 0x8, %l3
+
+	jmpl	%l1, %o7
+	 nop
+
+	std	%o0, [%sp + ( 9 * 8)]
+	std	%f0, [%sp + (10 * 8)]
+
+	mov	%l5, %o0
+	mov	%l6, %o1
+	add	%sp, %l0, %o2
+	call	_dl_call_pltexit
+	 add	%sp, (16 * 8), %o3
+
+	ldd	[%sp + (9 * 8)], %i0
+
+	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
+	 *      the address of the link map
+	 */
+	.align	32
+	.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
+	sub	%o1, 4*12, %o1
+
+	mov	%g3, %l0
+	mov	%o0, %l5
+	mov	%o1, %l6
+
+	call _dl_profile_save_regs
+	 nop
+
+	mov	%sp, %o3
+	call	_dl_profile_fixup
+	 add	%sp, (9 * 8), %o4
+
+	ld	[%sp + (9 * 8)], %o1
+	cmp	%o1, 0
+	bgeu	1f
+	 nop
+	
+	call	_dl_profile_invoke
+	 nop
+
+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 2787fd27f8..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,4 +93,12 @@ _start:
   /* Die very horribly if exit returns.  */
 	unimp
 
+	cfi_endproc
+
 	.size _start, .-_start
+
+/* Define a symbol for the first piece of initialized data.  */
+	.data
+	.globl	__data_start
+__data_start:
+weak_alias (__data_start, data_start)
diff --git a/sysdeps/sparc/sparc32/fpu/e_sqrtl.c b/sysdeps/sparc/sparc32/fpu/e_sqrtl.c
new file mode 100644
index 0000000000..3c3acfee02
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/e_sqrtl.c
@@ -0,0 +1 @@
+/* __ieee754_sqrtl is defined in q_sqrt.c.  */
diff --git a/sysdeps/sparc/sparc32/fpu/libm-test-ulps b/sysdeps/sparc/sparc32/fpu/libm-test-ulps
index 979e0e2c91..ccf53788a6 100644
--- a/sysdeps/sparc/sparc32/fpu/libm-test-ulps
+++ b/sysdeps/sparc/sparc32/fpu/libm-test-ulps
@@ -4,32 +4,49 @@
 Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
 float: 3
 ifloat: 3
+ildouble: 1
+ldouble: 1
 Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
 float: 3
 ifloat: 3
+ildouble: 1
+ldouble: 1
 Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 # atanh
 Test "atanh (0.75) == 0.972955074527656652552676371721589865":
 float: 1
 ifloat: 1
 
+# cacos
+Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
+
 # cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+ildouble: 5
+ldouble: 5
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
 double: 1
 float: 3
 idouble: 1
 ifloat: 3
+ildouble: 1
+ldouble: 1
 
 # casin
 Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
@@ -37,6 +54,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
+ildouble: 1
+ldouble: 1
 
 # casinh
 Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
@@ -44,19 +64,27 @@ double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
+ildouble: 2
+ldouble: 2
 Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # catan
 Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
@@ -70,6 +98,9 @@ ifloat: 1
 Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
 float: 4
 ifloat: 4
+Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
+ildouble: 1
+ldouble: 1
 
 # catanh
 Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
@@ -81,11 +112,18 @@ ifloat: 4
 Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 # cbrt
+Test "cbrt (-0.001) == -0.1":
+ildouble: 1
+ldouble: 1
 Test "cbrt (-27.0) == -3.0":
 double: 1
 idouble: 1
@@ -97,9 +135,14 @@ double: 1
 idouble: 1
 
 # ccos
+Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
 double: 1
 float: 1
@@ -113,9 +156,13 @@ ifloat: 1
 Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
 double: 1
 float: 1
@@ -126,12 +173,20 @@ float: 1
 ifloat: 1
 
 # cexp
+Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
 float: 1
 ifloat: 1
+Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
+ildouble: 1
+ldouble: 1
 
 # clog
 Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
@@ -140,57 +195,98 @@ ifloat: 3
 Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # clog10
 Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
 double: 1
 float: 5
 idouble: 1
 ifloat: 5
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i":
+double: 1
+idouble: 1
 Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
 float: 1
 ifloat: 1
+Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
 
 # cos
@@ -199,16 +295,22 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "cos (M_PI_6l * 4.0) == -0.5":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "cos (pi/2) == 0":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # cpow
 Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
@@ -222,16 +324,31 @@ double: 1
 float: 4
 idouble: 1
 ifloat: 4
+ildouble: 4
+ldouble: 4
+Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 2
+ldouble: 2
+Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i":
+ildouble: 1
+ldouble: 1
 Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
 double: 2
 float: 3
 idouble: 2
 ifloat: 3
+ildouble: 10
+ldouble: 10
+Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i":
+ildouble: 2
+ldouble: 2
 Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 double: 1
 float: 4
 idouble: 1
 ifloat: 4
+ildouble: 3
+ldouble: 3
 Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
 float: 2
 ifloat: 2
@@ -240,8 +357,21 @@ double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# csin
+Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i":
+ildouble: 1
+ldouble: 1
+Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i":
+ildouble: 1
+ldouble: 1
 
 # csinh
+Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
 double: 1
 idouble: 1
@@ -256,17 +386,31 @@ ifloat: 1
 Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i":
+ildouble: 1
+ldouble: 1
 
 # ctan
 Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 
 # ctanh
 Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
@@ -274,6 +418,11 @@ double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
+ildouble: 1
+ldouble: 1
 Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
 float: 1
 ifloat: 1
@@ -290,6 +439,9 @@ idouble: 1
 Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
 double: 1
 idouble: 1
+Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318":
+ildouble: 1
+ldouble: 1
 Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
 double: 1
 idouble: 1
@@ -310,14 +462,30 @@ double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
 
 # expm1
 Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
 double: 1
 idouble: 1
 Test "expm1 (1) == M_El - 1.0":
+double: 1
 float: 1
+idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+# gamma
+Test "gamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
 
 # hypot
 Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
@@ -359,9 +527,13 @@ double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "j0 (2.0) == 0.223890779141235668051827454649948626":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
 float: 1
@@ -370,17 +542,32 @@ ifloat: 1
 Test "j0 (8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # j1
+Test "j1 (-1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "j1 (0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "j1 (1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
 Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "j1 (2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "j1 (8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 4
+ldouble: 4
 
 # jn
 Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
@@ -396,9 +583,13 @@ double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
 double: 1
 float: 1
@@ -407,30 +598,57 @@ ifloat: 1
 Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (1, -1.0) == -0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 0.75) == 0.349243602174862192523281016426251335":
+ildouble: 1
+ldouble: 1
+Test "jn (1, 1.0) == 0.440050585744933515959682203718914913":
+ildouble: 1
+ldouble: 1
 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
 float: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
 double: 1
 idouble: 1
 Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
 double: 1
 idouble: 1
+ildouble: 4
+ldouble: 4
+Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9":
+ildouble: 1
+ldouble: 1
 Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
 double: 4
 float: 3
 idouble: 4
 ifloat: 3
+ildouble: 2
+ldouble: 2
 Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
 float: 4
 ifloat: 4
@@ -449,6 +667,8 @@ double: 3
 float: 1
 idouble: 3
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
 double: 1
 float: 2
@@ -456,16 +676,23 @@ idouble: 1
 ifloat: 2
 
 # lgamma
+Test "lgamma (-0.5) == log(2*sqrt(pi))":
+ildouble: 1
+ldouble: 1
 Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 # log10
 Test "log10 (0.75) == -0.124938736608299953132449886193870744":
@@ -476,11 +703,21 @@ ifloat: 2
 Test "log10 (e) == log10(e)":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 # log1p
 Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
 float: 1
 ifloat: 1
+Test "log1p (M_El - 1.0) == 1":
+ildouble: 1
+ldouble: 1
+
+# log2
+Test "log2 (0.75) == -.415037499278843818546261056052183492":
+ildouble: 1
+ldouble: 1
 
 # sincos
 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
@@ -488,31 +725,58 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
 float: 1
 ifloat: 1
 
+# sqrt
+Test "sqrt (2) == M_SQRT2l":
+ildouble: 1
+ldouble: 1
+
 # tan
 Test "tan (pi/4) == 1":
 double: 1
 idouble: 1
 
+# tanh
+Test "tanh (-0.75) == -0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (-1.0) == -0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+Test "tanh (0.75) == 0.635148952387287319214434357312496495":
+ildouble: 1
+ldouble: 1
+Test "tanh (1.0) == 0.7615941559557648881194582826047935904":
+ildouble: 1
+ldouble: 1
+
 # tgamma
 Test "tgamma (-0.5) == -2 sqrt (pi)":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "tgamma (0.5) == sqrt (pi)":
 float: 1
 ifloat: 1
@@ -521,6 +785,9 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+Test "tgamma (4) == 6":
+ildouble: 1
+ldouble: 1
 
 # y0
 Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
@@ -536,19 +803,28 @@ ifloat: 1
 Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
 float: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "y0 (8.0) == 0.223521489387566220527323400498620359":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 
 # y1
 Test "y1 (0.125) == -5.19993611253477499595928744876579921":
 double: 1
 idouble: 1
+Test "y1 (0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
 Test "y1 (1.5) == -0.412308626973911295952829820633445323":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y1 (10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
@@ -559,11 +835,15 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "y1 (8.0) == -0.158060461731247494255555266187483550":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 # yn
 Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
@@ -579,17 +859,26 @@ ifloat: 1
 Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
 float: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 3
+ldouble: 3
 Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
 double: 1
 idouble: 1
+Test "yn (1, 0.75) == -1.03759455076928541973767132140642198":
+ildouble: 1
+ldouble: 1
 Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
 double: 3
 float: 1
@@ -600,30 +889,44 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 5
+ldouble: 5
 Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
 double: 2
 idouble: 2
+ildouble: 2
+ldouble: 2
 Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
 double: 1
 idouble: 1
@@ -632,11 +935,15 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 2
+ldouble: 2
 Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
 double: 1
 idouble: 1
@@ -645,22 +952,32 @@ idouble: 1
 Function: "atan2":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 Function: "atanh":
 float: 1
 ifloat: 1
 
+Function: Imaginary part of "cacos":
+ildouble: 1
+ldouble: 1
+
 Function: Real part of "cacosh":
 double: 1
 float: 7
 idouble: 1
 ifloat: 7
+ildouble: 5
+ldouble: 5
 
 Function: Imaginary part of "cacosh":
 double: 1
 float: 3
 idouble: 1
 ifloat: 3
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "casin":
 double: 1
@@ -668,17 +985,25 @@ float: 1
 idouble: 1
 ifloat: 1
 
+Function: Imaginary part of "casin":
+ildouble: 1
+ldouble: 1
+
 Function: Real part of "casinh":
 double: 5
 float: 1
 idouble: 5
 ifloat: 1
+ildouble: 4
+ldouble: 4
 
 Function: Imaginary part of "casinh":
 double: 3
 float: 6
 idouble: 3
 ifloat: 6
+ildouble: 2
+ldouble: 2
 
 Function: Real part of "catan":
 float: 4
@@ -689,50 +1014,72 @@ double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "catanh":
 double: 4
 idouble: 4
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "catanh":
 float: 6
 ifloat: 6
+ildouble: 1
+ldouble: 1
 
 Function: "cbrt":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccos":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ccosh":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ccosh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "cexp":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "clog":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "clog":
 float: 3
@@ -741,34 +1088,54 @@ ifloat: 3
 Function: Real part of "clog10":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "clog10":
 double: 1
 float: 5
 idouble: 1
 ifloat: 5
+ildouble: 1
+ldouble: 1
 
 Function: "cos":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "cpow":
 double: 2
 float: 4
 idouble: 2
 ifloat: 4
+ildouble: 10
+ldouble: 10
 
 Function: Imaginary part of "cpow":
 double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: Real part of "csin":
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "csinh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "csinh":
 double: 1
@@ -779,24 +1146,38 @@ ifloat: 1
 Function: Real part of "csqrt":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: Imaginary part of "csqrt":
+ildouble: 1
+ldouble: 1
 
 Function: Real part of "ctan":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctan":
 double: 1
 idouble: 1
+ildouble: 2
+ldouble: 2
 
 Function: Real part of "ctanh":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: Imaginary part of "ctanh":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "erf":
 double: 1
@@ -805,18 +1186,32 @@ idouble: 1
 Function: "erfc":
 double: 1
 idouble: 1
+ildouble: 1
+ldouble: 1
 
 Function: "exp10":
 double: 6
 float: 2
 idouble: 6
 ifloat: 2
+ildouble: 1
+ldouble: 1
+
+Function: "exp2":
+ildouble: 2
+ldouble: 2
 
 Function: "expm1":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "gamma":
+ildouble: 1
+ldouble: 1
 
 Function: "hypot":
 float: 1
@@ -827,67 +1222,101 @@ double: 2
 float: 2
 idouble: 2
 ifloat: 2
+ildouble: 2
+ldouble: 2
 
 Function: "j1":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 4
+ldouble: 4
 
 Function: "jn":
 double: 4
 float: 4
 idouble: 4
 ifloat: 4
+ildouble: 4
+ldouble: 4
 
 Function: "lgamma":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "log10":
 double: 1
 float: 2
 idouble: 1
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "log1p":
 float: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "log2":
+ildouble: 1
+ldouble: 1
 
 Function: "sincos":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "sqrt":
+ildouble: 1
+ldouble: 1
 
 Function: "tan":
 double: 1
 idouble: 1
 
+Function: "tanh":
+ildouble: 1
+ldouble: 1
+
 Function: "tgamma":
 double: 1
 float: 1
 idouble: 1
 ifloat: 1
+ildouble: 1
+ldouble: 1
 
 Function: "y0":
 double: 2
 float: 1
 idouble: 2
 ifloat: 1
+ildouble: 3
+ldouble: 3
 
 Function: "y1":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 1
+ldouble: 1
 
 Function: "yn":
 double: 3
 float: 2
 idouble: 3
 ifloat: 2
+ildouble: 5
+ldouble: 5
 
 # end of automatic generation
diff --git a/sysdeps/sparc/sparc32/fpu/s_fabs.c b/sysdeps/sparc/sparc32/fpu/s_fabs.c
new file mode 100644
index 0000000000..b883e6e862
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/s_fabs.c
@@ -0,0 +1,11 @@
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+double __fabs (double x)
+{
+  return __builtin_fabs (x);
+}
+weak_alias (__fabs, fabs)
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __fabs, fabsl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/sparc/sparc32/fpu/s_fabsf.S b/sysdeps/sparc/sparc32/fpu/s_fabsf.S
new file mode 100644
index 0000000000..e1487247d1
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/s_fabsf.S
@@ -0,0 +1,29 @@
+/* Float absolute value, sparc32 version.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2006.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+
+ENTRY (__fabsf)
+	st	%o0, [%sp+64]
+	ld	[%sp+64], %f0
+	retl
+	 fabss	%f0, %f0
+END (__fabsf)
+weak_alias (__fabsf, fabsf)
diff --git a/sysdeps/sparc/sparc32/fpu/s_fabsl.c b/sysdeps/sparc/sparc32/fpu/s_fabsl.c
new file mode 100644
index 0000000000..3c03b92828
--- /dev/null
+++ b/sysdeps/sparc/sparc32/fpu/s_fabsl.c
@@ -0,0 +1,8 @@
+#include <math.h>
+#include <math_ldbl_opt.h>
+
+long double __fabsl (long double x)
+{
+  return __builtin_fabsl (x);
+}
+long_double_symbol (libm, __fabsl, fabsl);
diff --git a/sysdeps/sparc/sparc32/jmpbuf-offsets.h b/sysdeps/sparc/sparc32/jmpbuf-offsets.h
new file mode 100644
index 0000000000..1c6f7a9d17
--- /dev/null
+++ b/sysdeps/sparc/sparc32/jmpbuf-offsets.h
@@ -0,0 +1,22 @@
+/* Private macros for accessing __jmp_buf contents.  SPARC version.
+   Copyright (C) 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define JB_SP	0
+#define JB_FP	1
+#define JB_PC	2
diff --git a/sysdeps/sparc/sparc32/jmpbuf-unwind.h b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
new file mode 100644
index 0000000000..0f317b99d0
--- /dev/null
+++ b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
@@ -0,0 +1,48 @@
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+#include <jmpbuf-offsets.h>
+#include <stdint.h>
+#include <unwind.h>
+#include <sysdep.h>
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
+  ((int) (address) < demangle ((jmpbuf)[JB_SP]))
+
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
+
+static inline uintptr_t __attribute__ ((unused))
+_jmpbuf_sp (__jmp_buf regs)
+{
+  uintptr_t sp = regs[JB_SP];
+#ifdef PTR_DEMANGLE
+  PTR_DEMANGLE (sp);
+#endif
+  return sp;
+}
+
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
+
+/* We use the normal lobngjmp for unwinding.  */
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
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/memset.S b/sysdeps/sparc/sparc32/memset.S
index 8e91e998bf..e6204e8ac9 100644
--- a/sysdeps/sparc/sparc32/memset.S
+++ b/sysdeps/sparc/sparc32/memset.S
@@ -152,4 +152,4 @@ ENTRY(memset)
 END(memset)
 libc_hidden_builtin_def (memset)
 
-weak_alias(__bzero, bzero)
+weak_alias (__bzero, bzero)
diff --git a/sysdeps/sparc/sparc32/setjmp.S b/sysdeps/sparc/sparc32/setjmp.S
index 883ea06297..0a5d3cece8 100644
--- a/sysdeps/sparc/sparc32/setjmp.S
+++ b/sysdeps/sparc/sparc32/setjmp.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 93, 94, 96, 97, 98, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1994, 1996, 1997, 1998, 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
@@ -19,9 +20,7 @@
 #include <sysdep.h>
 #include <sys/trap.h>
 
-#define _ASM 1
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <jmpbuf-offsets.h>
 
 ENTRY(_setjmp)
 	b	1f
@@ -39,9 +38,18 @@ ENTRY (__sigsetjmp)
 	   a tail-call for simplicity; it always returns zero.  */
 	ta	ST_FLUSH_WINDOWS
 
+#ifdef PTR_MANGLE
+	PTR_MANGLE (%g1, %o7, %g4)
+	PTR_MANGLE2 (%g2, %sp, %g4)
+	PTR_MANGLE2 (%g3, %fp, %g4)
+	st	%g1, [%o0 + (JB_PC * 4)]
+	st	%g2, [%o0 + (JB_SP * 4)]
+	st	%g3, [%o0 + (JB_FP * 4)]
+#else
 	st	%o7, [%o0 + (JB_PC * 4)]
 	st	%sp, [%o0 + (JB_SP * 4)]
 	st	%fp, [%o0 + (JB_FP * 4)]
+#endif
 
 	mov	%o7, %g1
 	call	__sigjmp_save
diff --git a/sysdeps/sparc/sparc32/soft-fp/Dist b/sysdeps/sparc/sparc32/soft-fp/Dist
deleted file mode 100644
index b3c7344889..0000000000
--- a/sysdeps/sparc/sparc32/soft-fp/Dist
+++ /dev/null
@@ -1,28 +0,0 @@
-q_add.c
-q_cmp.c
-q_cmpe.c
-q_div.c
-q_dtoq.c
-q_feq.c
-q_fge.c
-q_fgt.c
-q_fle.c
-q_flt.c
-q_fne.c
-q_itoq.c
-q_mul.c
-q_neg.c
-q_qtod.c
-q_qtoi.c
-q_qtos.c
-q_qtoui.c
-q_qtoux.c
-q_qtox.c
-q_sqrt.c
-q_stoq.c
-q_sub.c
-q_uitoq.c
-q_util.c
-q_uxtoq.c
-q_xtoq.c
-sfp-machine.h
diff --git a/sysdeps/sparc/sparc32/soft-fp/Makefile b/sysdeps/sparc/sparc32/soft-fp/Makefile
index bba9bf7f86..d447b48285 100644
--- a/sysdeps/sparc/sparc32/soft-fp/Makefile
+++ b/sysdeps/sparc/sparc32/soft-fp/Makefile
@@ -1,6 +1,6 @@
 #  Software floating-point emulation.
 #  Makefile for SPARC v8 long double utility functions (_Q_*).
-#  Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+#  Copyright (C) 1999, 2000, 2006 Free Software Foundation, Inc.
 #  This file is part of the GNU C Library.
 #  Contributed by Jakub Jelinek (jj@ultra.linux.cz).
 #
@@ -20,13 +20,11 @@
 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 # 02111-1307 USA.
 
-#  Currently gcc does not support TFmode long double on sparc32
-#  so these routines are not used.
-#ifeq ($(subdir),soft-fp)
-#sparc32-quad-routines := q_add q_cmp q_cmpe q_div q_dtoq q_feq q_fge	\
-#	q_fgt q_fle q_flt q_fne q_itoq q_mul q_neg q_qtod q_qtoi	\
-#	q_qtos q_qtoui q_qtoux q_qtox q_sqrt q_stoq q_sub q_uitoq	\
-#	q_uxtoq q_xtoq q_util
-#sysdep_routines += $(sparc32-quad-routines)
-#
-#endif
+ifeq ($(subdir),soft-fp)
+sparc32-quad-routines := q_add q_cmp q_cmpe q_div q_dtoq q_feq q_fge	\
+	q_fgt q_fle q_flt q_fne q_itoq q_mul q_neg q_qtod q_qtoi	\
+	q_qtos q_qtou q_qtoull q_qtoll q_sqrt q_stoq q_sub q_utoq	\
+	q_ulltoq q_lltoq q_util
+sysdep_routines += $(sparc32-quad-routines)
+
+endif
diff --git a/sysdeps/sparc/sparc32/soft-fp/Versions b/sysdeps/sparc/sparc32/soft-fp/Versions
new file mode 100644
index 0000000000..6a09249c46
--- /dev/null
+++ b/sysdeps/sparc/sparc32/soft-fp/Versions
@@ -0,0 +1,8 @@
+libc {
+  GLIBC_2.4 {
+    _Q_add; _Q_cmp; _Q_cmpe; _Q_div; _Q_dtoq; _Q_feq; _Q_fge; _Q_fgt;
+    _Q_fle; _Q_flt; _Q_fne; _Q_itoq; _Q_mul; _Q_neg; _Q_qtod; _Q_qtoi;
+    _Q_qtos; _Q_qtou; _Q_qtoull; _Q_qtoll; _Q_sqrt; _Q_stoq; _Q_sub;
+    _Q_utoq; _Q_ulltoq; _Q_lltoq;
+  }
+}
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_add.c b/sysdeps/sparc/sparc32/soft-fp/q_add.c
index fb93461593..987c725582 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_add.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_add.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return a + b
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,10 +30,10 @@ long double _Q_add(const long double a, const long double b)
   long double c;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_ADD_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_div.c b/sysdeps/sparc/sparc32/soft-fp/q_div.c
index bb4e697236..86db5ed9e9 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_div.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_div.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return a / b
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -35,5 +35,5 @@ long double _Q_div(const long double a, const long double b)
   FP_DIV_Q(C, A, B);
   FP_PACK_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
-  return long double;
+  return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_dtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_dtoq.c
index 5cac5c0840..6b119f4501 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_dtoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_dtoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ long double _Q_dtoq(const double a)
   long double c;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_D(A, a);
+  FP_UNPACK_RAW_D(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,D,4,2,C,A);
+  FP_EXTEND(Q,D,4,2,C,A);
 #else
-  FP_CONV(Q,D,2,1,C,A);
+  FP_EXTEND(Q,D,2,1,C,A);
 #endif
-  FP_PACK_Q(c, C);
+  FP_PACK_RAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_itoq.c b/sysdeps/sparc/sparc32/soft-fp/q_itoq.c
index 0010b3bcbf..b50942f75f 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_itoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_itoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,8 +30,8 @@ long double _Q_itoq(const int a)
   int b = a;
   long double c;
 
-  FP_FROM_INT_Q(C, b, 32, int);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, b, 32, unsigned int);
+  FP_PACK_RAW_Q(c, C);
   FP_CLEAR_EXCEPTIONS;
   FP_HANDLE_EXCEPTIONS;
   return c;
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_lltoq.c
index 867ef27131..f977585e42 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_lltoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -23,15 +23,15 @@
 #include "soft-fp.h"
 #include "quad.h"
 
-long double _Q_xtoq(const long long a)
+long double _Q_lltoq(const long long a)
 {
   FP_DECL_EX;
   FP_DECL_Q(C);
   long double c;
   long long b = a;
 
-  FP_FROM_INT_Q(C, b, 64, long long);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, b, 64, unsigned long long);
+  FP_PACK_RAW_Q(c, C);
   FP_CLEAR_EXCEPTIONS;
   FP_HANDLE_EXCEPTIONS;
   return c;
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtod.c b/sysdeps/sparc/sparc32/soft-fp/q_qtod.c
index b0778476b8..82b01ec8a1 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtod.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtod.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (double)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ double _Q_qtod(const long double a)
   double r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(D,Q,2,4,R,A);
+  FP_TRUNC(D,Q,2,4,R,A);
 #else
-  FP_CONV(D,Q,1,2,R,A);
+  FP_TRUNC(D,Q,1,2,R,A);
 #endif
-  FP_PACK_D(r, R);
+  FP_PACK_SEMIRAW_D(r, R);
   FP_HANDLE_EXCEPTIONS;
 
   return r;
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c
index 0440e9abba..270ba9f677 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (int)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -28,9 +28,9 @@ int _Q_qtoi(const long double a)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
-  int r;
+  unsigned int r;
 
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 32, 1);
   FP_HANDLE_EXCEPTIONS;
 
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtox.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoll.c
index 108373328e..e0d29019b3 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtox.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoll.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
-   Return (long)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Return (long long)a
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -24,13 +24,13 @@
 #include "soft-fp.h"
 #include "quad.h"
 
-long long _Q_qtox(const long double a)
+long long _Q_qtoll(const long double a)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
-  long long r;
+  unsigned long long r;
 
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 64, 1);
   FP_HANDLE_EXCEPTIONS;
 
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtos.c b/sysdeps/sparc/sparc32/soft-fp/q_qtos.c
index 31c8d6ac82..93daa23cac 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtos.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtos.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (float)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -32,13 +32,13 @@ float _Q_qtos(const long double a)
   float r;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(S,Q,1,4,R,A);
+  FP_TRUNC(S,Q,1,4,R,A);
 #else
-  FP_CONV(S,Q,1,2,R,A);
+  FP_TRUNC(S,Q,1,2,R,A);
 #endif
-  FP_PACK_S(r, R);
+  FP_PACK_SEMIRAW_S(r, R);
   FP_HANDLE_EXCEPTIONS;
 
   return r;
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c b/sysdeps/sparc/sparc32/soft-fp/q_qtou.c
index bdbf052e09..812b4e06ea 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtou.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (unsigned int)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -24,13 +24,13 @@
 #include "soft-fp.h"
 #include "quad.h"
 
-unsigned int _Q_qtoui(const long double a)
+unsigned int _Q_qtou(const long double a)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
   unsigned int r;
 
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 32, -1);
   FP_HANDLE_EXCEPTIONS;
 
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoull.c
index 3e6d40f220..7a88c9f382 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoull.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
-   Return (unsigned long)a
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Return (unsigned long long)a
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -24,13 +24,13 @@
 #include "soft-fp.h"
 #include "quad.h"
 
-unsigned long long _Q_qtoux(const long double a)
+unsigned long long _Q_qtoull(const long double a)
 {
   FP_DECL_EX;
   FP_DECL_Q(A);
   unsigned long long r;
 
-  FP_UNPACK_Q(A, a);
+  FP_UNPACK_RAW_Q(A, a);
   FP_TO_INT_Q(r, A, 64, -1);
   FP_HANDLE_EXCEPTIONS;
 
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c b/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c
index 7516ed7c5c..373d02a639 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return sqrtl(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -36,3 +36,4 @@ long double _Q_sqrt(const long double a)
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
+strong_alias (_Q_sqrt, __ieee754_sqrtl);
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_stoq.c b/sysdeps/sparc/sparc32/soft-fp/q_stoq.c
index 98609faf20..714d880dd7 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_stoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_stoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    c = (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -31,13 +31,13 @@ long double _Q_stoq(const float a)
   FP_DECL_Q(C);
   long double c;
 
-  FP_UNPACK_S(A, a);
+  FP_UNPACK_RAW_S(A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_CONV(Q,S,4,1,C,A);
+  FP_EXTEND(Q,S,4,1,C,A);
 #else
-  FP_CONV(Q,S,2,1,C,A);
+  FP_EXTEND(Q,S,2,1,C,A);
 #endif
-  FP_PACK_Q(c, C);
+  FP_PACK_RAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_sub.c b/sysdeps/sparc/sparc32/soft-fp/q_sub.c
index 1987aea480..8616727bb1 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_sub.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_sub.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    c = a - b
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -30,10 +30,10 @@ long double _Q_sub(const long double a, const long double b)
   long double c;
 
   FP_INIT_ROUNDMODE;
-  FP_UNPACK_Q(A, a);
-  FP_UNPACK_Q(B, b);
+  FP_UNPACK_SEMIRAW_Q(A, a);
+  FP_UNPACK_SEMIRAW_Q(B, b);
   FP_SUB_Q(C, A, B);
-  FP_PACK_Q(c, C);
+  FP_PACK_SEMIRAW_Q(c, C);
   FP_HANDLE_EXCEPTIONS;
   return c;
 }
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c
index 8944e9614d..53c0add2d8 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -23,15 +23,15 @@
 #include "soft-fp.h"
 #include "quad.h"
 
-long double _Q_uxtoq(const unsigned long long a)
+long double _Q_ulltoq(const unsigned long long a)
 {
   FP_DECL_EX;
   FP_DECL_Q(C);
   long double c;
   unsigned long long b = a;
 
-  FP_FROM_INT_Q(C, b, 64, long long);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, b, 64, unsigned long long);
+  FP_PACK_RAW_Q(c, C);
   FP_CLEAR_EXCEPTIONS;
   FP_HANDLE_EXCEPTIONS;
   return c;
diff --git a/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c b/sysdeps/sparc/sparc32/soft-fp/q_utoq.c
index b716fabde2..f902bf8397 100644
--- a/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c
+++ b/sysdeps/sparc/sparc32/soft-fp/q_utoq.c
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    c = (long double)(a)
-   Copyright (C) 1997,1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
 		  Jakub Jelinek (jj@ultra.linux.cz).
@@ -23,15 +23,15 @@
 #include "soft-fp.h"
 #include "quad.h"
 
-long double _Q_uitoq(const unsigned int a)
+long double _Q_utoq(const unsigned int a)
 {
   FP_DECL_EX;
   FP_DECL_Q(C);
   long double c;
   unsigned int b = a;
 
-  FP_FROM_INT_Q(C, b, 32, int);
-  FP_PACK_Q(c, C);
+  FP_FROM_INT_Q(C, b, 32, unsigned int);
+  FP_PACK_RAW_Q(c, C);
   FP_CLEAR_EXCEPTIONS;
   FP_HANDLE_EXCEPTIONS;
   return c;
diff --git a/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h b/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
index 40bcbb4762..f1211705ef 100644
--- a/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
+++ b/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
@@ -1,6 +1,6 @@
 /* Machine-dependent software floating-point definitions.
    Sparc userland (_Q_*) version.
-   Copyright (C) 1997,1998,1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999, 2002, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com),
 		  Jakub Jelinek (jj@ultra.linux.cz) and
@@ -22,6 +22,7 @@
    02111-1307 USA.  */
 
 #include <fpu_control.h>
+#include <stdlib.h>
 
 #define _FP_W_TYPE_SIZE		32
 #define _FP_W_TYPE		unsigned long
@@ -208,14 +209,5 @@ do {								\
       	" : : "r" (___Q_numbers) : "f30");			\
     }								\
   else								\
-    {								\
-      __asm__ __volatile__("\
-        mov %0, %%o0\n\
-        mov %%o7, %%g1\n\
-        call ___Q_simulate_exceptions\n\
-         mov %%g1, %%o7\
-        " : : "r" (_fex) :					\
-        "g1", "g2", "g3", "g4", "g5", "o0", 			\
-        "o1", "o2", "o3", "o4", "o5", "cc");			\
-    }								\
+    ___Q_simulate_exceptions (_fex);			        \
 } while (0)
diff --git a/sysdeps/sparc/sparc32/sparcv8/Dist b/sysdeps/sparc/sparc32/sparcv8/Dist
deleted file mode 100644
index 6318172684..0000000000
--- a/sysdeps/sparc/sparc32/sparcv8/Dist
+++ /dev/null
@@ -1,6 +0,0 @@
-urem.S
-umul.S
-udiv.S
-sdiv.S
-rem.S
-dotmul.S
diff --git a/sysdeps/sparc/sparc32/sparcv9/Dist b/sysdeps/sparc/sparc32/sparcv9/Dist
deleted file mode 100644
index 2de64957fb..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9/Dist
+++ /dev/null
@@ -1,7 +0,0 @@
-dotmul.S
-hp-timing.c
-rem.S
-sdiv.S
-udiv.S
-umul.S
-urem.S
diff --git a/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h b/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
index 6d316f37d5..7b9d61d468 100644
--- a/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
+++ b/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
@@ -1,5 +1,5 @@
 /* Atomic operations.  sparcv9 version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
 
@@ -59,7 +59,7 @@ typedef uintmax_t uatomic_max_t;
   __asm __volatile ("cas [%4], %2, %0"					      \
 		    : "=r" (__acev_tmp), "=m" (*__acev_mem)		      \
 		    : "r" (oldval), "m" (*__acev_mem), "r" (__acev_mem),      \
-		      "0" (newval));					      \
+		      "0" (newval) : "memory");				      \
   __acev_tmp; })
 
 /* This can be implemented if needed.  */
@@ -74,11 +74,17 @@ typedef uintmax_t uatomic_max_t;
      if (sizeof (*(mem)) == 4)						      \
        __asm ("swap %0, %1"						      \
 	      : "=m" (*__memp), "=r" (__oldval)				      \
-	      : "m" (*__memp), "1" (__value));				      \
+	      : "m" (*__memp), "1" (__value) : "memory");		      \
      else								      \
        abort ();							      \
      __oldval; })
 
+#define atomic_compare_and_exchange_val_24_acq(mem, newval, oldval) \
+  atomic_compare_and_exchange_val_acq (mem, newval, oldval)
+
+#define atomic_exchange_24_rel(mem, newval) \
+  atomic_exchange_rel (mem, newval)
+
 #define atomic_full_barrier() \
   __asm __volatile ("membar #LoadLoad | #LoadStore"			      \
 			  " | #StoreLoad | #StoreStore" : : : "memory")
diff --git a/sysdeps/sparc/sparc32/sparcv9b/Implies b/sysdeps/sparc/sparc32/sparcv9b/Implies
deleted file mode 100644
index 78a424460b..0000000000
--- a/sysdeps/sparc/sparc32/sparcv9b/Implies
+++ /dev/null
@@ -1 +0,0 @@
-sparc/sparc32/sparcv9
diff --git a/sysdeps/sparc/sparc32/sparcv9v/memcpy.S b/sysdeps/sparc/sparc32/sparcv9v/memcpy.S
new file mode 100644
index 0000000000..4c05f57bc2
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9v/memcpy.S
@@ -0,0 +1,2 @@
+#define XCC icc
+#include <sparc64/sparcv9v/memcpy.S>
diff --git a/sysdeps/sparc/sparc32/sparcv9v/memset.S b/sysdeps/sparc/sparc32/sparcv9v/memset.S
new file mode 100644
index 0000000000..5e46c7489f
--- /dev/null
+++ b/sysdeps/sparc/sparc32/sparcv9v/memset.S
@@ -0,0 +1,2 @@
+#define XCC icc
+#include <sparc64/sparcv9v/memset.S>
diff --git a/sysdeps/sparc/sparc32/stpcpy.S b/sysdeps/sparc/sparc32/stpcpy.S
index 937fed35f8..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
@@ -160,6 +162,6 @@ ENTRY(__stpcpy)
 	 nop
 END(__stpcpy)
 
-weak_alias(__stpcpy, stpcpy)
+weak_alias (__stpcpy, stpcpy)
 libc_hidden_def (__stpcpy)
 libc_hidden_builtin_def (stpcpy)
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 b5be3adf60..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
@@ -278,7 +279,7 @@ ENTRY(strrchr)
 	 mov		%o5, %o0
 END(strrchr)
 
-weak_alias(strchr, index)
-weak_alias(strrchr, rindex)
+weak_alias (strchr, index)
+weak_alias (strrchr, rindex)
 libc_hidden_builtin_def (strchr)
 libc_hidden_builtin_def (strrchr)
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