about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/htonl.c34
-rw-r--r--sysdeps/generic/htons.c34
-rw-r--r--sysdeps/generic/netinet/in.h15
-rw-r--r--sysdeps/generic/ntohl.c34
-rw-r--r--sysdeps/generic/ntohs.c34
-rw-r--r--sysdeps/libm-i387/e_acoshf.S4
-rw-r--r--sysdeps/libm-i387/e_acoshl.S3
-rw-r--r--sysdeps/mach/hurd/fcntlbits.h34
-rw-r--r--sysdeps/sparc/Dist1
-rw-r--r--sysdeps/sparc/bsd-_setjmp.S47
-rw-r--r--sysdeps/sparc/bsd-setjmp.S44
-rw-r--r--sysdeps/sparc/divrem.m44
-rw-r--r--sysdeps/sparc/dl-machine.h145
-rw-r--r--sysdeps/sparc/elf/DEFS.h5
-rw-r--r--sysdeps/sparc/elf/start.S31
-rw-r--r--sysdeps/sparc/fpu_control.h7
-rw-r--r--sysdeps/sparc/rem.S4
-rw-r--r--sysdeps/sparc/sdiv.S4
-rw-r--r--sysdeps/sparc/setjmp.S44
-rw-r--r--sysdeps/sparc/udiv.S4
-rw-r--r--sysdeps/sparc/urem.S4
-rw-r--r--sysdeps/unix/sysv/linux/netinet/in.h15
-rw-r--r--sysdeps/unix/sysv/linux/sparc/Makefile8
-rw-r--r--sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S109
-rw-r--r--sysdeps/unix/sysv/linux/sparc/errno.c1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/profil-counter.h11
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sigaction.c21
-rw-r--r--sysdeps/unix/sysv/linux/sparc/syscall.S19
-rw-r--r--sysdeps/unix/sysv/linux/sparc/syscalls.list3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.S3
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.h41
31 files changed, 468 insertions, 299 deletions
diff --git a/sysdeps/generic/htonl.c b/sysdeps/generic/htonl.c
index 724ef54639..f1e077ae1a 100644
--- a/sysdeps/generic/htonl.c
+++ b/sysdeps/generic/htonl.c
@@ -1,28 +1,28 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1993, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
-#include <ansidecl.h>
 #include <netinet/in.h>
 
 #undef	htonl
 
-unsigned long int
-DEFUN(htonl, (x), unsigned long int x)
+u_int32_t
+htonl (x)
+     u_int32_t x;
 {
 #if BYTE_ORDER == LITTLE_ENDIAN
   x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24);
diff --git a/sysdeps/generic/htons.c b/sysdeps/generic/htons.c
index e3209f3e68..3aaf28551c 100644
--- a/sysdeps/generic/htons.c
+++ b/sysdeps/generic/htons.c
@@ -1,28 +1,28 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1993, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
-#include <ansidecl.h>
 #include <netinet/in.h>
 
 #undef	htons
 
-unsigned short int
-DEFUN(htons, (x), unsigned short int x)
+u_int16_t
+htons (x)
+     u_int16_t x;
 {
 #if BYTE_ORDER == LITTLE_ENDIAN
   x = (x << 8) | (x >> 8);
diff --git a/sysdeps/generic/netinet/in.h b/sysdeps/generic/netinet/in.h
index ad77c8be7d..5531fc2ece 100644
--- a/sysdeps/generic/netinet/in.h
+++ b/sysdeps/generic/netinet/in.h
@@ -190,12 +190,17 @@ struct ip_mreq
   struct in_addr imr_interface;	/* local IP address of interface */
 };
 
-/* Functions to convert between host and network byte order.  */
+/* Functions to convert between host and network byte order.
 
-extern unsigned long int ntohl __P ((unsigned long int));
-extern unsigned short int ntohs __P ((unsigned short int));
-extern unsigned long int htonl __P ((unsigned long int));
-extern unsigned short int htons __P ((unsigned short int));
+   Please note that these functions normally take `unsigned long int' or
+   `unsigned short int' values as arguments and also return them.  But
+   this was a short-sighted decision since on different systems the types
+   may have different representations but the values are always the same.  */
+
+extern u_int32_t ntohl __P ((u_int32_t __netlong));
+extern u_int16_t ntohs __P ((u_int16_t __netshort));
+extern u_int32_t htonl __P ((u_int32_t __hostlong));
+extern u_int16_t htons __P ((u_int16_t __hostshort));
 
 #include <endian.h>
 
diff --git a/sysdeps/generic/ntohl.c b/sysdeps/generic/ntohl.c
index 389cc9ffc0..0cb83c5aa4 100644
--- a/sysdeps/generic/ntohl.c
+++ b/sysdeps/generic/ntohl.c
@@ -1,28 +1,28 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1993, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
-#include <ansidecl.h>
 #include <netinet/in.h>
 
 #undef	ntohl
 
-unsigned long int
-DEFUN(ntohl, (x), unsigned long int x)
+u_int32_t
+ntohl (x)
+     u_int32_t x;
 {
 #if BYTE_ORDER == LITTLE_ENDIAN
   x = (x << 24) | ((x & 0xff00) << 8) | ((x & 0xff0000) >> 8) | (x >> 24);
diff --git a/sysdeps/generic/ntohs.c b/sysdeps/generic/ntohs.c
index 1ac462a6d2..f4f37eec93 100644
--- a/sysdeps/generic/ntohs.c
+++ b/sysdeps/generic/ntohs.c
@@ -1,28 +1,28 @@
-/* Copyright (C) 1993 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1993, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
-#include <ansidecl.h>
 #include <netinet/in.h>
 
 #undef	ntohs
 
-unsigned short int
-DEFUN(ntohs, (x), unsigned short int x)
+u_int16_t
+ntohs (x)
+     u_int16_t x;
 {
 #if BYTE_ORDER == LITTLE_ENDIAN
   x = (x << 8) | (x >> 8);
diff --git a/sysdeps/libm-i387/e_acoshf.S b/sysdeps/libm-i387/e_acoshf.S
index a4f50ba7ac..8aa78957e2 100644
--- a/sysdeps/libm-i387/e_acoshf.S
+++ b/sysdeps/libm-i387/e_acoshf.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arcsinh.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -42,7 +42,7 @@ limit:	.double 0.29
 
 	.text
 ENTRY(__ieee754_acoshf)
-	movl	8(%esp), %ecx
+	movl	4(%esp), %ecx
 	cmpl	$0x3f800000, %ecx
 	jl	5f			// < 1 => invalid
 	fldln2				// log(2)
diff --git a/sysdeps/libm-i387/e_acoshl.S b/sysdeps/libm-i387/e_acoshl.S
index b0fa45c44e..0c81daaebe 100644
--- a/sysdeps/libm-i387/e_acoshl.S
+++ b/sysdeps/libm-i387/e_acoshl.S
@@ -1,5 +1,5 @@
 /* ix87 specific implementation of arcsinh.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -49,6 +49,7 @@ limit:	.double 0.29
 	.text
 ENTRY(__ieee754_acoshl)
 	movl	12(%esp), %ecx
+	andl	$0xffff, %ecx
 	cmpl	$0x3fff, %ecx
 	jl	5f			// < 1 => invalid
 	fldln2				// log(2)
diff --git a/sysdeps/mach/hurd/fcntlbits.h b/sysdeps/mach/hurd/fcntlbits.h
index efa7069107..9906c97eb3 100644
--- a/sysdeps/mach/hurd/fcntlbits.h
+++ b/sysdeps/mach/hurd/fcntlbits.h
@@ -1,21 +1,21 @@
 /* O_*, F_*, FD_* bit values for GNU.
-Copyright (C) 1993, 1994, 1996, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   Copyright (C) 1993, 1994, 1996, 1997 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifndef	_FCNTLBITS_H
 
diff --git a/sysdeps/sparc/Dist b/sysdeps/sparc/Dist
index ef6c44f78e..55f26143fd 100644
--- a/sysdeps/sparc/Dist
+++ b/sysdeps/sparc/Dist
@@ -1,4 +1,5 @@
 DEFS.h
+elf/DEFS.h
 dotmul.S umul.S
 divrem.m4 sdiv.S udiv.S rem.S urem.S
 alloca.S
diff --git a/sysdeps/sparc/bsd-_setjmp.S b/sysdeps/sparc/bsd-_setjmp.S
index 5b685d5496..522fe0e3a1 100644
--- a/sysdeps/sparc/bsd-_setjmp.S
+++ b/sysdeps/sparc/bsd-_setjmp.S
@@ -1,26 +1,43 @@
 /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  Sparc version.
-Copyright (C) 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1994, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
 
-ENTRY (setjmp)
+ENTRY (_setjmp)
+#ifdef PIC
+1:
+	jmpl  2f,%o1
+	nop
+2:
+	sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)),%l7
+	or    %l7,%lo(_GLOBAL_OFFSET_TABLE_-(1b-.)),%l7
+	add   %l7,%o1,%l7
+	sethi %hi(C_SYMBOL_NAME (__sigsetjmp)),%g1
+	or    %g1,%lo(C_SYMBOL_NAME (__sigsetjmp)),%g1
+	ld    [%l7+%g1],%g1
+	ld    [%g1],%g1
+	jmpl  %g1,%g0
+	mov   %g0,%o1           /* Pass second argument of zero */
+#else
+
 	sethi %hi(C_SYMBOL_NAME (__sigsetjmp)), %g1
 	or %lo(C_SYMBOL_NAME (__sigsetjmp)), %g1, %g1
 	jmp %g1
 	mov %g0, %o1		/* Pass second argument of zero.  */
+#endif
diff --git a/sysdeps/sparc/bsd-setjmp.S b/sysdeps/sparc/bsd-setjmp.S
index b0a6326a2c..09aee661da 100644
--- a/sysdeps/sparc/bsd-setjmp.S
+++ b/sysdeps/sparc/bsd-setjmp.S
@@ -1,26 +1,42 @@
 /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  Sparc version.
-Copyright (C) 1994 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1994, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
 
 ENTRY (setjmp)
+#ifdef PIC
+1:
+	jmpl  2f,%o1
+	nop
+2:
+	sethi %hi(_GLOBAL_OFFSET_TABLE_-(1b-.)),%l7
+	or    %l7,%lo(_GLOBAL_OFFSET_TABLE_-(1b-.)),%l7
+	add   %l7,%o1,%l7
+	sethi %hi(C_SYMBOL_NAME (__sigsetjmp)),%g1
+	or    %g1,%lo(C_SYMBOL_NAME (__sigsetjmp)),%g1
+	ld    [%l7+%g1],%g1
+	ld    [%g1],%g1
+	jmpl  %g1,%g0
+	mov   1,%o1
+#else
 	sethi %hi(C_SYMBOL_NAME (__sigsetjmp)), %g1
 	or %lo(C_SYMBOL_NAME (__sigsetjmp)), %g1, %g1
 	jmp %g1
 	mov 1, %o1		/* Pass second argument of one.  */
+#endif
diff --git a/sysdeps/sparc/divrem.m4 b/sysdeps/sparc/divrem.m4
index bde8a21e29..cada804706 100644
--- a/sysdeps/sparc/divrem.m4
+++ b/sysdeps/sparc/divrem.m4
@@ -83,11 +83,15 @@ L.$1.eval(2**N+$2):
 	ifelse($1, 1, `9:')')dnl
 
 #include "DEFS.h"
+#ifdef __linux__
+#include <asm/traps.h>
+#else
 #ifdef __svr4__
 #include <sys/trap.h>
 #else
 #include <machine/trap.h>
 #endif
+#endif
 
 FUNC(NAME)
 ifelse(S, `true',
diff --git a/sysdeps/sparc/dl-machine.h b/sysdeps/sparc/dl-machine.h
index ad288e15b2..5240b0cf81 100644
--- a/sysdeps/sparc/dl-machine.h
+++ b/sysdeps/sparc/dl-machine.h
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  SPARC version.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 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
@@ -36,13 +36,7 @@
 static inline int
 elf_machine_matches_host (Elf32_Half e_machine)
 {
-  switch (e_machine)
-    {
-    case EM_SPARC:
-      return 1;
-    default:
-      return 0;
-    }
+  return e_machine == EM_SPARC;
 }
 
 
@@ -62,28 +56,50 @@ static inline Elf32_Addr
 elf_machine_load_address (void)
 {
   Elf32_Addr addr;
-???
+
+  asm (
+       "add   %%fp,0x44,%%o2\n\t"	/* o2 = point to argc */
+       "ld    [%%o2 - 4],%%o0\n\t"	/* o0 = load argc     */
+       "sll   %%o0, 2, %%o0\n\t"	/* o0 = argc * sizeof (int) */
+       "add   %%o2,%%o0,%%o2\n\t"	/* o2 = skip over argv */
+       "add   %%o2,4,%%o2\n\t"		/* skip over null after argv */
+
+       /* Now %o2 is pointing to env, skip over that as well.  */
+       "1:\n\t"
+       "ld    [%%o2],%%o0\n\t"
+        "cmp   %%o0,0\n\t"
+       "bnz   1b\n\t"
+       "add   %%o2,4,%%o2\n\t"
+
+       /* Note that above, we want to advance the NULL after envp so
+	  we always add 4.  */
+
+       /* Now, search for the AT_BASE property.  */
+       "2:\n\t"
+       "ld   [%%o2],%%o0\n\t"
+       "cmp  %%o0,0\n\t"
+       "be,a 3f\n\t"
+       "or   %%g0,%%g0,%0\n\t"
+       "cmp  %%o0,7\n\t"	/* AT_BASE = 7 */
+       "be,a 3f\n\t"
+       "ld   [%%o2+4],%0\n\t"
+       "b    2b\n\t"
+       "add  %%o2,8,%%o2\n\t"
+       /* At this point %0 has the load address for the interpreter */
+       "3:\n\t"
+       : "=r" (addr)
+       : /* no inputs */
+       : "o0", "o2");
   return addr;
 }
 
-/* The `subl' insn above will contain an R_68K_RELATIVE relocation
-   entry intended to insert the run-time address of the label `here'.
-   This will be the first relocation in the text of the dynamic
-   linker; we skip it to avoid trying to modify read-only text in this
-   early stage.  */
-#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
-  ((dynamic_info)[DT_RELA]->d_un.d_ptr += sizeof (Elf32_Rela), \
-   (dynamic_info)[DT_RELASZ]->d_un.d_val -= sizeof (Elf32_Rela))
-
+#ifdef RESOLVE
 /* Perform the relocation specified by RELOC and SYM (which is fully resolved).
    MAP is the object containing the reloc.  */
 
 static inline void
 elf_machine_rela (struct link_map *map,
-		  const Elf32_Rela *reloc, const Elf32_Sym *sym,
-		  Elf32_Addr (*resolve) (const Elf32_Sym **ref,
-					 Elf32_Addr reloc_addr,
-					 int noplt))
+		  const Elf32_Rela *reloc, const Elf32_Sym *sym)
 {
   Elf32_Addr *const reloc_addr = (void *) (map->l_addr + reloc->r_offset);
   Elf32_Addr loadbase;
@@ -91,21 +107,17 @@ elf_machine_rela (struct link_map *map,
   switch (ELF32_R_TYPE (reloc->r_info))
     {
     case R_SPARC_COPY:
-      loadbase = (*resolve) (&sym, (Elf32_Addr) reloc_addr, 0);
+      loadbase = RESOLVE (&sym, DL_LOOKUP_NOEXEC);
       memcpy (reloc_addr, (void *) (loadbase + sym->st_value), sym->st_size);
       break;
     case R_SPARC_GLOB_DAT:
     case R_SPARC_32:
-      loadbase = (resolve ? (*resolve) (&sym, (Elf32_Addr) reloc_addr, 0) :
-		  /* RESOLVE is null during bootstrap relocation.  */
-		  map->l_addr);
+      loadbase = RESOLVE (&sym, 0);
       *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
 		     + reloc->r_addend);
       break;
     case R_SPARC_JMP_SLOT:
-      loadbase = (resolve ? (*resolve) (&sym, (Elf32_Addr) reloc_addr, 1) :
-		  /* RESOLVE is null during bootstrap relocation.  */
-		  map->l_addr);
+      loadbase = RESOLVE (&sym, DL_LOOKUP_NOPLT);
       {
 	Elf32_Addr value = ((sym ? (loadbase + sym->st_value) : 0)
 			    + reloc->r_addend);
@@ -114,25 +126,20 @@ elf_machine_rela (struct link_map *map,
       }
       break;
     case R_SPARC_8:
-      loadbase = (*resolve) (&sym, (Elf32_Addr) reloc_addr, 0);
+      loadbase = RESOLVE (&sym, 0);
       *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
 			      + reloc->r_addend);
       break;
     case R_SPARC_16:
-      loadbase = (*resolve) (&sym, (Elf32_Addr) reloc_addr, 0);
+      loadbase = RESOLVE (&sym, 0);
       *(short *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
 			       + reloc->r_addend);
       break;
-    case R_SPARC_32:
-      loadbase = (resolve ? (*resolve) (&sym, (Elf32_Addr) reloc_addr, 0) :
-		  /* RESOLVE is null during bootstrap relocation.  */
-		  map->l_addr);
-      break;
     case R_SPARC_RELATIVE:
-      *reloc_addr = map->l_addr + reloc->r_addend;
+      *reloc_addr += map->l_addr + reloc->r_addend;
       break;
     case R_SPARC_DISP8:
-      loadbase = (*resolve) (&sym, (Elf32_Addr) reloc_addr, 0);
+      loadbase = RESOLVE (&sym, 0);
       *(char *) reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
 			      + reloc->r_addend
 			      - (Elf32_Addr) reloc_addr);
@@ -144,11 +151,31 @@ elf_machine_rela (struct link_map *map,
 			       - (Elf32_Addr) reloc_addr);
       break;
     case R_SPARC_DISP32:
-      loadbase = (*resolve) (&sym, (Elf32_Addr) reloc_addr, 0);
+      loadbase = RESOLVE (&sym, 0);
       *reloc_addr = ((sym ? (loadbase + sym->st_value) : 0)
 		     + reloc->r_addend
 		     - (Elf32_Addr) reloc_addr);
       break;
+      case R_SPARC_LO10:
+	{
+	  unsigned int saddr;
+
+	  loadbase = RESOLVE (&sym, 0);
+	  saddr = (loadbase ? loadbase : map->l_addr) + reloc->r_addend;
+
+	  *reloc_addr = (*reloc_addr & ~0x3ff) | (saddr & 0x3ff);
+	}
+       break;
+    case R_SPARC_HI22:
+      {
+	unsigned int saddr;
+
+	loadbase = RESOLVE (&sym, 0);
+	saddr = (loadbase ? loadbase : map->l_addr) + reloc->r_addend;
+
+	*reloc_addr = (*reloc_addr & 0xffc00000)|(saddr >> 10);
+      }
+      break;
     case R_SPARC_NONE:		/* Alright, Wilbur.  */
       break;
     default:
@@ -172,6 +199,10 @@ elf_machine_lazy_rel (struct link_map *map, const Elf32_Rela *reloc)
     }
 }
 
+#define ELF_ADJUST_ARG(arg) __asm__("\tadd %%fp,64,%0\n" : "=r" (arg))
+
+#endif	/* RESOLV */
+
 /* Nonzero iff TYPE describes relocation of a PLT entry, so
    PLT entries should not be allowed to define the value.  */
 #define elf_machine_pltrel_p(type) ((type) == R_SPARC_JMP_SLOT)
@@ -213,26 +244,27 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
       plt[1] = OPCODE_CALL | (((Elf32_Addr) &_dl_runtime_resolve -
 			       (Elf32_Addr) &plt[1]) >> 2);
       plt[2] = OPCODE_NOP;	/* Fill call delay slot.  */
-      plt[3] = l;
+      plt[3] = (Elf32_Addr *) l;
     }
 
   /* This code is used in dl-runtime.c to call the `fixup' function
      and then redirect to the address it returns.  */
 #define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
-| Trampoline for _dl_runtime_resolver
+# Trampoline for _dl_runtime_resolver
 	.globl _dl_runtime_resolve
 	.type _dl_runtime_resolve, @function
 _dl_runtime_resolve:
-	| Pass two args to fixup: the PLT address computed from the PC saved
-	| in the PLT's call insn, and the reloc offset passed in %g1.
-	ld [%o7 + 8], %o1	| Second arg, loaded from PLTPC[2].
-	call fixup
-	shrl %g1, 22, %o0	| First arg, set in delay slot of call.
-	| Jump to the real function.
-	jmpl %o0, %g0
-	| In the delay slot of that jump, restore the register window
-	| saved by the first insn of the PLT.
-	restore
+	#call  %g0
+	# Pass two args to fixup: the PLT address computed from the PC saved
+	# in the PLT's call insn, and the reloc offset passed in %g1.
+	#ld [%o7 + 8], %o1      | Second arg, loaded from PLTPC[2].
+	#call fixup
+	#shrl %g1, 22, %o0      | First arg, set in delay slot of call.
+	# Jump to the real function.
+	#jmpl %o0, %g0
+	# In the delay slot of that jump, restore the register window
+	# saved by the first insn of the PLT.
+	#restore
 	.size _dl_runtime_resolve, . - _dl_runtime_resolve
 ");
 /* The PLT uses Elf32_Rela relocs.  */
@@ -248,4 +280,13 @@ _dl_runtime_resolve:
    The C function `_dl_start' is the real entry point;
    its return value is the user program's entry point.  */
 
-#define RTLD_START asm (???)
+#define RTLD_START __asm__ ( \
+".text\n\
+ .globl _start\n\
+ .type _start,@function\n\
+_start:\n\
+  call _dl_start\n\
+  nop\n\
+  call %o0\n\
+  nop\n\
+");
diff --git a/sysdeps/sparc/elf/DEFS.h b/sysdeps/sparc/elf/DEFS.h
new file mode 100644
index 0000000000..84f078ae40
--- /dev/null
+++ b/sysdeps/sparc/elf/DEFS.h
@@ -0,0 +1,5 @@
+#define	FUNC(name)		\
+	.global name;		\
+	.type name,@function;	\
+	.align 4;		\
+	name:
diff --git a/sysdeps/sparc/elf/start.S b/sysdeps/sparc/elf/start.S
index 6dae08bafa..db407d7bae 100644
--- a/sysdeps/sparc/elf/start.S
+++ b/sysdeps/sparc/elf/start.S
@@ -1,21 +1,21 @@
 /* Startup code compliant to the ELF SPARC ABI.
-Copyright (C) 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1996, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* This is the canonical entry point, usually the first thing in the text
    segment.  The SVR4/SPARC ABI (NOTE: I don't actually have it) says that
@@ -82,7 +82,7 @@ nofini:
 	sll ENVP, 2, ENVP
 	add ARGV, ENVP, ENVP
 	/* Store ENVP in the global variable `_environ'.  */
-	st [TMP + %lo(_environ)], ENVP
+	ld [TMP + %lo(_environ)], ENVP
 
 	/* Call `_init', which is the entry point to our own `.init'
 	   section; and register with `atexit' to have `exit' call
@@ -100,6 +100,7 @@ nofini:
 	mov ENVP, %o2
 
 	call exit		/* This should never return.  */
+	nop
 	unimp 0			/* Crash if somehow it does return.  */
 
 /* Define a symbol for the first piece of initialized data.  */
diff --git a/sysdeps/sparc/fpu_control.h b/sysdeps/sparc/fpu_control.h
index a8015abc29..cfd85844c3 100644
--- a/sysdeps/sparc/fpu_control.h
+++ b/sysdeps/sparc/fpu_control.h
@@ -53,13 +53,6 @@
 /* private namespace. It should only be used by crt0.o. */
 extern unsigned short __fpu_control;
 
-__BEGIN_DECLS
-
-/* called by crt0.o. It can be used to manipulate 387 control word. */
-extern void __setfpucw __P ((unsigned short));
-
-__END_DECLS
-
 /* Type of the control word.  */
 typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
 
diff --git a/sysdeps/sparc/rem.S b/sysdeps/sparc/rem.S
index 17662f7fd4..565fc0f678 100644
--- a/sysdeps/sparc/rem.S
+++ b/sysdeps/sparc/rem.S
@@ -38,11 +38,15 @@
 
 
 #include "DEFS.h"
+#ifdef __linux__
+#include <asm/traps.h>
+#else
 #ifdef __svr4__
 #include <sys/trap.h>
 #else
 #include <machine/trap.h>
 #endif
+#endif
 
 FUNC(.rem)
 	! compute sign of result; if neither is negative, no problem
diff --git a/sysdeps/sparc/sdiv.S b/sysdeps/sparc/sdiv.S
index dadbb36b0a..7397e5edb8 100644
--- a/sysdeps/sparc/sdiv.S
+++ b/sysdeps/sparc/sdiv.S
@@ -38,11 +38,15 @@
 
 
 #include "DEFS.h"
+#ifdef __linux__
+#include <asm/traps.h>
+#else
 #ifdef __svr4__
 #include <sys/trap.h>
 #else
 #include <machine/trap.h>
 #endif
+#endif
 
 FUNC(.div)
 	! compute sign of result; if neither is negative, no problem
diff --git a/sysdeps/sparc/setjmp.S b/sysdeps/sparc/setjmp.S
index db8a3c2916..d9599079c2 100644
--- a/sysdeps/sparc/setjmp.S
+++ b/sysdeps/sparc/setjmp.S
@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1993, 1994, 1996, 1997 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
+   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
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
 
@@ -25,9 +25,25 @@ ENTRY (__sigsetjmp)
 	/* Save our SP and FP; in the delay slot of the jump, save our
 	   return PC.  Save the signal mask if requested with a tail-call
 	   for simplicity; it always returns zero.  */
+#ifdef PIC
+2:
+	jmpl 1f,%g2
+	nop
+1:
+	sethi %hi(_GLOBAL_OFFSET_TABLE_-(2b-.)),%l7
+	sethi %hi(C_SYMBOL_NAME (__sigjmp_save)), %g3
+	st    %sp, [%o0 + (JB_SP * 4)]
+	or    %l7,%lo(_GLOBAL_OFFSET_TABLE_-(2b-.)),%l7
+	or    %g3,%lo(C_SYMBOL_NAME (__sigjmp_save)), %g3
+	st    %fp, [%o0 + (JB_FP * 4)]
+	ld    [%l7+%g3],%g1
+	jmp   %g1
+	st   %o7, [%o0+(JB_PC*4)]
+#else
 	sethi %hi(C_SYMBOL_NAME (__sigjmp_save)), %g1
 	st %sp, [%o0 + (JB_SP*4)]
 	or %lo(C_SYMBOL_NAME (__sigjmp_save)), %g1, %g1
 	st %fp, [%o0 + (JB_FP*4)]
 	jmp %g1
 	 st %o7, [%o0 + (JB_PC*4)]
+#endif /* PIC */
diff --git a/sysdeps/sparc/udiv.S b/sysdeps/sparc/udiv.S
index 826d01183d..252afd0193 100644
--- a/sysdeps/sparc/udiv.S
+++ b/sysdeps/sparc/udiv.S
@@ -38,11 +38,15 @@
 
 
 #include "DEFS.h"
+#ifdef __linux__
+#include <asm/traps.h>
+#else
 #ifdef __svr4__
 #include <sys/trap.h>
 #else
 #include <machine/trap.h>
 #endif
+#endif
 
 FUNC(.udiv)
 
diff --git a/sysdeps/sparc/urem.S b/sysdeps/sparc/urem.S
index 9f64c8859e..99a5acf40a 100644
--- a/sysdeps/sparc/urem.S
+++ b/sysdeps/sparc/urem.S
@@ -38,11 +38,15 @@
 
 
 #include "DEFS.h"
+#ifdef __linux__
+#include <asm/traps.h>
+#else
 #ifdef __svr4__
 #include <sys/trap.h>
 #else
 #include <machine/trap.h>
 #endif
+#endif
 
 FUNC(.urem)
 
diff --git a/sysdeps/unix/sysv/linux/netinet/in.h b/sysdeps/unix/sysv/linux/netinet/in.h
index 53be934968..5b6cc78821 100644
--- a/sysdeps/unix/sysv/linux/netinet/in.h
+++ b/sysdeps/unix/sysv/linux/netinet/in.h
@@ -233,12 +233,17 @@ struct ip_mreq
     struct in_addr imr_interface;	/* local IP address of interface */
   };
 
-/* Functions to convert between host and network byte order.  */
+/* Functions to convert between host and network byte order.
 
-extern unsigned long int ntohl __P ((unsigned long int));
-extern unsigned short int ntohs __P ((unsigned short int));
-extern unsigned long int htonl __P ((unsigned long int));
-extern unsigned short int htons __P ((unsigned short int));
+   Please note that these functions normally take `unsigned long int' or
+   `unsigned short int' values as arguments and also return them.  But
+   this was a short-sighted decision since on different systems the types
+   may have different representations but the values are always the same.  */
+
+extern u_int32_t ntohl __P ((u_int32_t __netlong));
+extern u_int16_t ntohs __P ((u_int16_t __netshort));
+extern u_int32_t htonl __P ((u_int32_t __hostlong));
+extern u_int16_t htons __P ((u_int16_t __hostshort));
 
 #include <endian.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/Makefile b/sysdeps/unix/sysv/linux/sparc/Makefile
index 629e6b37df..30ef946c19 100644
--- a/sysdeps/unix/sysv/linux/sparc/Makefile
+++ b/sysdeps/unix/sysv/linux/sparc/Makefile
@@ -1,3 +1,11 @@
 ifeq ($(subdir),signal)
 sysdep_routines += __sigtrampoline
 endif
+
+# When I get this to work, this is the right thing
+ifeq ($(subdir),elf)
+CFLAGS-rtld.c += -mv8
+#rtld-routines += dl-sysdepsparc
+endif   # elf
+
+asm-CPPFLAGS = -fPIC
diff --git a/sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S b/sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S
index 4fea850ee3..2dd13062fc 100644
--- a/sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S
+++ b/sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S
@@ -4,10 +4,10 @@
 /* Contributed by Miguel de Icaza (miguel@gnu.ai.mit.edu)       */
 /* Many thanks go to David Miller for explaining all this to me */
 /* miguel@nuclecu.unam.mx                                       */
-/* Sources:	 David Miller, 4.4BSD/SPARC code 	        */
+/* Sources:     David Miller, 4.4BSD/SPARC code                */
 
 #include <sysdep.h>
-
+#define __ASSEMBLY__
 /* For REGWIN_SZ */
 #include <asm/ptrace.h>
 #include <asm/psr.h>
@@ -18,13 +18,13 @@
 	.text
 
 ENTRY(____sparc_signal_trampoline)
-	.global SYMBOL_NAME(____sig_table)
+	.global C_SYMBOL_NAME(____sig_table)
 
 	/* Make room for 32 %f registers + %fsr
-         * this is 132 bytes + alignement = 136
-         * 96 is the C frame size
-         */
-	save  	%sp,-136-CCFSZ,%sp
+	 * this is 132 bytes + alignement = 136
+	 * 96 is the C frame size
+	 */
+	save    %sp,-136-CCFSZ,%sp
 
 	/* save regular registers */
 	mov	%g2,%l2
@@ -34,31 +34,31 @@ ENTRY(____sparc_signal_trampoline)
 	mov	%g6,%l6
 	mov	%g7,%l7
 
-	/* save fpu registers */
-	ld	[%fp+64+16+20],%l0      /* load the psr from sigcontext */
+       /* save fpu registers */
+	ld	[%fp+64+16+20],%l0	/* load the psr from sigcontext */
 	sethi	%hi(PSR_EF),%l1
-	andcc	%l0,%l1,%l0	        /* is floating point enabled?   */
+	andcc	%l0,%l1,%l0		/* is floating point enabled?   */
 	be	1f
 	rd	%y,%l1			/* save y anyways */
 
 	/* save fpu registers */
-	st      %fsr, [%sp + CCFSZ + 0]
-        std     %f0, [%sp + CCFSZ + 8]
-        std     %f2, [%sp + CCFSZ + 16]
-        std     %f4, [%sp + CCFSZ + 24]
-        std     %f6, [%sp + CCFSZ + 32]
-        std     %f8, [%sp + CCFSZ + 40]
-        std     %f10, [%sp + CCFSZ + 48]
-        std     %f12, [%sp + CCFSZ + 56]
-        std     %f14, [%sp + CCFSZ + 64]
-        std     %f16, [%sp + CCFSZ + 72]
-        std     %f18, [%sp + CCFSZ + 80]
-        std     %f20, [%sp + CCFSZ + 88]
-        std     %f22, [%sp + CCFSZ + 96]
-        std     %f24, [%sp + CCFSZ + 104]
-        std     %f26, [%sp + CCFSZ + 112]
-        std     %f28, [%sp + CCFSZ + 120]
-        std     %f30, [%sp + CCFSZ + 128]
+	st	%fsr, [%sp + CCFSZ + 0]
+	std	%f0, [%sp + CCFSZ + 8]
+	std	%f2, [%sp + CCFSZ + 16]
+	std	%f4, [%sp + CCFSZ + 24]
+	std	%f6, [%sp + CCFSZ + 32]
+	std	%f8, [%sp + CCFSZ + 40]
+	std	%f10, [%sp + CCFSZ + 48]
+	std	%f12, [%sp + CCFSZ + 56]
+	std	%f14, [%sp + CCFSZ + 64]
+	std	%f16, [%sp + CCFSZ + 72]
+	std	%f18, [%sp + CCFSZ + 80]
+	std	%f20, [%sp + CCFSZ + 88]
+	std	%f22, [%sp + CCFSZ + 96]
+	std	%f24, [%sp + CCFSZ + 104]
+	std	%f26, [%sp + CCFSZ + 112]
+	std	%f28, [%sp + CCFSZ + 120]
+	std	%f30, [%sp + CCFSZ + 128]
 
 1:
 	/* Load signal number */
@@ -69,7 +69,7 @@ ENTRY(____sparc_signal_trampoline)
 	/* Sanity check */
 	cmp	%o0,33
 	bl	1f
-	or	%g0,%g0,%g1	/*Call sys_setup */
+	or	%g0,%g0,%g1     /*Call sys_setup */
 	t	0x10
 1:
 #ifdef __PIC__
@@ -79,16 +79,16 @@ ___sxx:
 	call	___syy
 	nop
 ___syy:
-	sethi   %hi(_GLOBAL_OFFSET_TABLE_-(___sxx-.)),%o5
-	or      %o5,%lo(_GLOBAL_OFFSET_TABLE_-(___sxx-.)),%o5
+	sethi	%hi(_GLOBAL_OFFSET_TABLE_-(___sxx-.)),%o5
+	or	%o5,%lo(_GLOBAL_OFFSET_TABLE_-(___sxx-.)),%o5
 	add	%o7,%o5,%o5
 	/* restore return address */
 	mov	%o4,%o7
 	mov	%o5,%o4
 	/* o4 has the GOT pointer */
 #endif
-	sethi	%hi(SYMBOL_NAME(____sig_table)),%o5
-	or	%o5,%lo(SYMBOL_NAME(____sig_table)),%o5
+	sethi	%hi(C_SYMBOL_NAME(____sig_table)),%o5
+	or	%o5,%lo(C_SYMBOL_NAME(____sig_table)),%o5
 #ifdef __PIC__
 	add	%o5,%o4,%o4
 	ld	[%o4],%o5
@@ -97,9 +97,10 @@ ___syy:
 	add	%o5,%o4,%o4
 	ld	[%o4],%o4
 	ld	[%fp + REGWIN_SZ + 4],%o1         /* Load subcode */
-	ld      [%fp + REGWIN_SZ + 8],%o2         /* pointer to sigcontext */
+	ld	[%fp + REGWIN_SZ + 8],%o2         /* pointer to sigcontext */
 	call	%o4
-	ld      [%fp + REGWIN_SZ + 12],%o3        /* Address where signal occurred */
+	ld	[%fp + REGWIN_SZ + 12],%o3        /* Address where signal ocurre
+ */
 
 	/* handler returned, restore state */
 	tst	%l0
@@ -107,23 +108,23 @@ ___syy:
 	wr	%l1,%g0,%y
 
 	/* fpu restoration */
-	ld      [%sp + CCFSZ + 0], %fsr
-        ldd     [%sp + CCFSZ + 8], %f0
-        ldd     [%sp + CCFSZ + 16], %f2
-        ldd     [%sp + CCFSZ + 24], %f4
-        ldd     [%sp + CCFSZ + 32], %f6
-        ldd     [%sp + CCFSZ + 40], %f8
-        ldd     [%sp + CCFSZ + 48], %f10
-        ldd     [%sp + CCFSZ + 56], %f12
-        ldd     [%sp + CCFSZ + 64], %f14
-        ldd     [%sp + CCFSZ + 72], %f16
-        ldd     [%sp + CCFSZ + 80], %f18
-        ldd     [%sp + CCFSZ + 88], %f20
-        ldd     [%sp + CCFSZ + 96], %f22
-        ldd     [%sp + CCFSZ + 104], %f24
-        ldd     [%sp + CCFSZ + 112], %f26
-        ldd     [%sp + CCFSZ + 120], %f28
-        ldd     [%sp + CCFSZ + 128], %f30
+	ld	[%sp + CCFSZ + 0], %fsr
+	ldd	[%sp + CCFSZ + 8], %f0
+	ldd	[%sp + CCFSZ + 16], %f2
+	ldd	[%sp + CCFSZ + 24], %f4
+	ldd	[%sp + CCFSZ + 32], %f6
+	ldd	[%sp + CCFSZ + 40], %f8
+	ldd	[%sp + CCFSZ + 48], %f10
+	ldd	[%sp + CCFSZ + 56], %f12
+	ldd	[%sp + CCFSZ + 64], %f14
+	ldd	[%sp + CCFSZ + 72], %f16
+	ldd	[%sp + CCFSZ + 80], %f18
+	ldd	[%sp + CCFSZ + 88], %f20
+	ldd	[%sp + CCFSZ + 96], %f22
+	ldd	[%sp + CCFSZ + 104], %f24
+	ldd	[%sp + CCFSZ + 112], %f26
+	ldd	[%sp + CCFSZ + 120], %f28
+	ldd	[%sp + CCFSZ + 128], %f30
 
 1:
 	mov	%l2,%g2
@@ -133,10 +134,10 @@ ___syy:
 	mov	%l6,%g6
 	mov	%l7,%g7
 
-	/* call sigreturn */
-	restore	%g0,SYS_sigreturn,%g1 	 /* register back and set syscall */
+       /* call sigreturn */
+	restore	%g0,SYS_ify(sigreturn),%g1	/* register back and set syscal */
 	add	%sp,64+16,%o0
 	t	0x10
 	/* if we return, sysreturn failed */
-	mov	SYS_exit,%g1
+	mov	SYS_ify(exit),%g1
 	t	0x10
diff --git a/sysdeps/unix/sysv/linux/sparc/errno.c b/sysdeps/unix/sysv/linux/sparc/errno.c
new file mode 100644
index 0000000000..663ab33e93
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/errno.c
@@ -0,0 +1 @@
+itn errno;
diff --git a/sysdeps/unix/sysv/linux/sparc/profil-counter.h b/sysdeps/unix/sysv/linux/sparc/profil-counter.h
index 1998c34ed5..258df5ba93 100644
--- a/sysdeps/unix/sysv/linux/sparc/profil-counter.h
+++ b/sysdeps/unix/sysv/linux/sparc/profil-counter.h
@@ -22,14 +22,5 @@
 void
 profil_counter (int signo, __siginfo_t si)
 {
-  extern int __sparc_old_signals;
-
-  if (__sparc_old_signals)
-    {
-      struct sigcontext_struct *s = (void *) &si;
-
-      profil_count ((void *) s->sigc_pc);
-    }
-  else
-    profil_count ((void *) si.si_regs.pc);
+  profil_count ((void *) si.si_regs.pc);
 }
diff --git a/sysdeps/unix/sysv/linux/sparc/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sigaction.c
index e7bda77de2..d39eb7cc76 100644
--- a/sysdeps/unix/sysv/linux/sparc/sigaction.c
+++ b/sysdeps/unix/sysv/linux/sparc/sigaction.c
@@ -22,6 +22,10 @@
 #include <sys/signal.h>
 #include <errno.h>
 
+/* Commented out while I figure out what the fuck goes on */
+long ____sig_table [NSIG];
+#if 0
+
 /* The kernel will deliver signals in the old way if the signal
    number is a positive number.  The kernel will deliver a signal
    with the new stack layout if the signal number is a negative number.
@@ -30,7 +34,6 @@
    using at runtime.  */
 
 extern void ____sparc_signal_trampoline (int);
-long ____sig_table [NSIG];
 
 int
 __trampoline_sigaction (int sig, struct sigaction *new, struct sigaction *old)
@@ -60,7 +63,7 @@ __trampoline_sigaction (int sig, struct sigaction *new, struct sigaction *old)
 	  "1:"
 	  : "=r" (ret), "=r" ((long int) sig), "=r" ((long int) new),
 	    "=r" ((long int) old)
-	  : "0" (SYS_sigaction), "1" (sig), "2" (new), "3" (old)
+	  : "0" (__NR_sigaction), "1" (sig), "2" (new), "3" (old)
 	  : "g1", "o0", "o1", "o2");
 
   if (ret >= 0)
@@ -79,9 +82,12 @@ __trampoline_sigaction (int sig, struct sigaction *new, struct sigaction *old)
   __set_errno (-ret);
   return -1;
 }
+#else
+#    define __new_sigaction __sigaction
+#endif
 
 int
-__new_sigaction (int sig, struct sigaction *new, struct sigaction *old)
+__new_sigaction (int sig, __const struct sigaction *new, struct sigaction *old)
 {
   int ret;
 
@@ -98,7 +104,7 @@ __new_sigaction (int sig, struct sigaction *new, struct sigaction *old)
 	  "1:"
 	  : "=r" (ret), "=r" ((long int) sig), "=r" ((long int) new),
 	    "=r" ((long int) old)
-	  : "0" (SYS_sigaction), "1" (sig), "2" (new), "3" (old)
+	  : "0" (__NR_sigaction), "1" (sig), "2" (new), "3" (old)
 	  : "g1", "o0", "o1", "o2");
   if (ret >= 0)
     return 0;
@@ -106,10 +112,11 @@ __new_sigaction (int sig, struct sigaction *new, struct sigaction *old)
   return -1;
 }
 
+#if 0
 int
-__sigaction (int sig, struct sigaction *new, struct sigaction *old)
+__sigaction (int sig, __const struct sigaction *new, struct sigaction *old)
 {
-  static (*sigact_routine) (int, struct sigaction *, struct sigaction *);
+  static (*sigact_routine) (int, __const struct sigaction *, struct sigaction *);
   int ret;
   struct sigaction sa;
 
@@ -124,4 +131,6 @@ __sigaction (int sig, struct sigaction *new, struct sigaction *old)
 
   return __sigaction (sig, new, old);
 }
+#endif
+
 weak_alias (__sigaction, sigaction);
diff --git a/sysdeps/unix/sysv/linux/sparc/syscall.S b/sysdeps/unix/sysv/linux/sparc/syscall.S
index 4166e4231b..3921ca52dc 100644
--- a/sysdeps/unix/sysv/linux/sparc/syscall.S
+++ b/sysdeps/unix/sysv/linux/sparc/syscall.S
@@ -16,15 +16,26 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define DONT_LOAD_G1
 #include <sysdep.h>
-ENTRY (__libc_syscall)
+	.text
+ENTRY (syscall)
 	or	%o0,%g0,%g1
 	or	%o1,%g0,%o0
 	or	%o2,%g0,%o1
 	or	%o3,%g0,%o2
 	or	%o4,%g0,%o3
 	or	%o5,%g0,%o4
-PSEUDO_NOENT(__libc_syscall, syscall, 5)
+	ta	0x10
+	bcc	1f
+	nop
+	save %sp, -96, %sp
+	call __errno_location
+	nop
+	st %i0,[%o0]
+	restore
+	retl
+	mov -1, %o0
+1:
 	ret
-SYSCALL__POST(syscall,5)
+
+PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/sparc/syscalls.list b/sysdeps/unix/sysv/linux/sparc/syscalls.list
new file mode 100644
index 0000000000..7883d70719
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/syscalls.list
@@ -0,0 +1,3 @@
+# File name	Caller	Syscall name	# args	Strong name	Weak names
+
+s_llseek	llseek	_llseek		5	__sys_llseek
diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.S b/sysdeps/unix/sysv/linux/sparc/sysdep.S
new file mode 100644
index 0000000000..7e9023901b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sysdep.S
@@ -0,0 +1,3 @@
+/* Define errno */
+
+	.common errno,4,4
diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h
index 0251a1f014..5ae440152b 100644
--- a/sysdeps/unix/sysv/linux/sparc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h
@@ -20,6 +20,11 @@
 #ifndef _LINUX_SPARC_SYSDEP_H
 #define _LINUX_SPARC_SYSDEP_H 1
 
+/* Kernel headers use __ASSEMBLY__ */
+#ifdef ASSEMBLER
+#define __ASSEMBLY__
+#endif
+
 #include <sysdeps/unix/sparc/sysdep.h>
 
 #undef SYS_ify
@@ -30,12 +35,34 @@
 #ifdef DONT_LOAD_G1
 # define LOADSYSCALL(x)
 #else
-# define LOADSYSCALL(x) mov SYS_##n, %g1
+# define LOADSYSCALL(x) mov __NR_##x, %g1
 #endif
 
-/* Linux/SPARC uses a different trap number and uses __errno_location always */
+/* Linux/SPARC uses a different trap number */
 #undef PSEUDO
 
+#ifdef PIC
+#define SYSCALL_ERROR_HANDLER \
+	.global C_SYMBOL_NAME(__errno_location);\
+        .type   C_SYMBOL_NAME(__errno_location),@function;\
+	save   %sp,-96,%sp;\
+	call   __errno_location;\
+	nop;\
+	st %i0,[%o0];\
+	restore;\
+	retl;\
+	mov -1,%o0;
+#else
+#define SYSCALL_ERROR_HANDLER \
+	save %sp,-96,%sp;						      \
+	call __errno_location;						      \
+	nop;								      \
+	st %i0,[%o0];							      \
+	restore;							      \
+	retl;								      \
+	mov -1,%o0;
+#endif   /* PIC */
+
 #define PSEUDO(name, syscall_name, args) \
 	.text;								      \
 	ENTRY(name);							      \
@@ -43,14 +70,8 @@
 	ta 0x10;							      \
 	bcc,a 1f;							      \
 	nop;								      \
-	save %sp,96,%sp;						      \
-	call __errno_location;						      \
-	nop;								      \
-	st %i0,[%o0];							      \
-	restore;							      \
-	retl;								      \
-	mov -1,%o0;							      \
-1:
+	SYSCALL_ERROR_HANDLER;						      \
+1:;
 
 #endif	/* ASSEMBLER */