aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/sparc')
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S10
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/socket.S7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S28
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h52
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/socket.S6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S10
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h50
8 files changed, 95 insertions, 75 deletions
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
index 0136026be6..27ea9f8912 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/pipe.S
@@ -18,19 +18,19 @@
02111-1307 USA. */
#include <sysdep.h>
+
.globl __libc_pipe
ENTRY (__libc_pipe)
mov %o0, %o2 /* Save PIPEDES. */
mov SYS_ify(pipe),%g1
ta 0x10
- bcc,a 2f
- nop
- SYSCALL_ERROR_HANDLER
-2:
+ bcs __syscall_error_handler
+ nop
st %o0, [%o2] /* PIPEDES[0] = %o0; */
st %o1, [%o2 + 4] /* PIPEDES[1] = %o1; */
retl
- clr %o0
+ clr %o0
+ SYSCALL_ERROR_HANDLER
PSEUDO_END (__libc_pipe)
weak_alias (__libc_pipe, __pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
index 449d537340..7bc734e38a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, 1997.
@@ -67,13 +67,12 @@ ENTRY (__socket)
add %sp, 68, %o1 /* arg 2: parameter block */
LOADSYSCALL(socketcall)
t 0x10
-
- bcs,a 1f
+ bcs __syscall_error_handler
nop
retl
nop
-1: SYSCALL_ERROR_HANDLER
+ SYSCALL_ERROR_HANDLER
END (__socket)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
index 08378aba88..3b135c8e86 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1997, 2002 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,23 +19,17 @@
#include <sysdep.h>
.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
+ mov %o0, %g1
+ mov %o1, %o0
+ mov %o2, %o1
+ mov %o3, %o2
+ mov %o4, %o3
+ mov %o5, %o4
ta 0x10
- bcc 1f
- nop
- save %sp, -96, %sp
- call __errno_location
- nop
- st %i0,[%o0]
- restore
+ bcs __syscall_error_handler
+ nop
retl
- mov -1, %o0
-1:
- ret
+ nop
+ SYSCALL_ERROR_HANDLER
PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
index e3573fd454..e362894e17 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
@@ -31,11 +31,7 @@
#ifdef __ASSEMBLER__
-#ifdef DONT_LOAD_G1
-# define LOADSYSCALL(x)
-#else
-# define LOADSYSCALL(x) mov __NR_##x, %g1
-#endif
+#define LOADSYSCALL(x) mov __NR_##x, %g1
/* Linux/SPARC uses a different trap number */
#undef PSEUDO
@@ -54,6 +50,21 @@
#define LOC(name) .L##name
+#ifdef LINKER_HANDLES_R_SPARC_WDISP22
+/* Unfortunately, we cannot do this yet. Linker doesn't seem to
+ handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly . */
+# define SYSCALL_ERROR_HANDLER_ENTRY(handler) \
+ .section .gnu.linkonce.t.handler,"ax",@progbits; \
+ .globl handler; \
+ .hidden handler; \
+ .type handler,@function; \
+handler:
+#else
+# define SYSCALL_ERROR_HANDLER_ENTRY(handler) \
+ .subsection 3; \
+handler:
+#endif
+
#if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER \
.section .gnu.linkonce.t.__sparc.get_pic.l7,"ax",@progbits; \
@@ -64,6 +75,7 @@ __sparc.get_pic.l7: \
retl; \
add %o7, %l7, %l7; \
.previous; \
+SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \
save %sp,-96,%sp; \
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7; \
call __sparc.get_pic.l7; \
@@ -71,17 +83,20 @@ __sparc.get_pic.l7: \
ld [%l7 + errno], %l0; \
st %i0, [%l0]; \
jmpl %i7+8, %g0; \
- restore %g0, -1, %o0;
+ restore %g0, -1, %o0; \
+ .previous;
#else
-# define SYSCALL_ERROR_HANDLER \
- .global __errno_location; \
- .type __errno_location,@function; \
- save %sp, -96, %sp; \
- call __errno_location; \
- nop; \
- st %i0, [%o0]; \
- jmpl %i7+8, %g0; \
- restore %g0, -1, %o0;
+# define SYSCALL_ERROR_HANDLER \
+SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \
+ .global __errno_location; \
+ .type __errno_location,@function; \
+ save %sp, -96, %sp; \
+ call __errno_location; \
+ nop; \
+ st %i0, [%o0]; \
+ jmpl %i7+8, %g0; \
+ restore %g0, -1, %o0; \
+ .previous;
#endif
#define PSEUDO(name, syscall_name, args) \
@@ -89,10 +104,9 @@ __sparc.get_pic.l7: \
ENTRY(name); \
LOADSYSCALL(syscall_name); \
ta 0x10; \
- bcc,a 9000f; \
- nop; \
- SYSCALL_ERROR_HANDLER; \
-9000:;
+ bcs __syscall_error_handler; \
+ nop; \
+ SYSCALL_ERROR_HANDLER
#else /* __ASSEMBLER__ */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
index 5c800316d5..5ccedff21a 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/pipe.S
@@ -23,14 +23,13 @@ ENTRY (__libc_pipe)
mov %o0, %o2 /* Save PIPEDES. */
LOADSYSCALL(pipe)
ta 0x6d
- bcc,pt %xcc, 2f
+ bcs,pn %xcc, __syscall_error_handler
nop
- SYSCALL_ERROR_HANDLER
-
-2: st %o0, [%o2] /* PIPEDES[0] = %o0; */
+ st %o0, [%o2] /* PIPEDES[0] = %o0; */
st %o1, [%o2 + 4] /* PIPEDES[1] = %o1; */
retl
clr %o0
+ SYSCALL_ERROR_HANDLER
PSEUDO_END (__libc_pipe)
weak_alias (__libc_pipe, __pipe)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
index ed490fbaa3..750c1258ed 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/socket.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, 1997.
@@ -68,12 +68,12 @@ ENTRY (__socket)
LOADSYSCALL(socketcall)
ta 0x6d
- bcs,pn %xcc, 1f
+ bcs,pn %xcc, __syscall_error_handler
nop
retl
nop
-1: SYSCALL_ERROR_HANDLER
+ SYSCALL_ERROR_HANDLER
END (__socket)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S b/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
index 792a3a34da..27bd086206 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscall.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -30,11 +30,11 @@ ENTRY (syscall)
ta 0x6d
- bcc,pt %xcc,1f
+ bcs,pn %xcc,__syscall_error_handler
nop
- SYSCALL_ERROR_HANDLER
-
-1: retl
+ retl
nop
+ SYSCALL_ERROR_HANDLER
+
PSEUDO_END (syscall)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
index 10b764712b..a64da1a223 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h
@@ -31,11 +31,7 @@
#ifdef __ASSEMBLER__
-#ifdef DONT_LOAD_G1
-# define LOADSYSCALL(x)
-#else
-# define LOADSYSCALL(x) mov __NR_##x, %g1
-#endif
+#define LOADSYSCALL(x) mov __NR_##x, %g1
/* Linux/SPARC uses a different trap number */
#undef PSEUDO
@@ -47,6 +43,21 @@
C_LABEL(name); \
.type name,@function;
+#ifdef LINKER_HANDLES_R_SPARC_WDISP22
+/* Unfortunately, we cannot do this yet. Linker doesn't seem to
+ handle R_SPARC_WDISP22 against non-STB_LOCAL symbols properly . */
+# define SYSCALL_ERROR_HANDLER_ENTRY(handler) \
+ .section .gnu.linkonce.t.handler,"ax",@progbits; \
+ .globl handler; \
+ .hidden handler; \
+ .type handler,@function; \
+handler:
+#else
+# define SYSCALL_ERROR_HANDLER_ENTRY(handler) \
+ .subsection 3; \
+handler:
+#endif
+
#if RTLD_PRIVATE_ERRNO
# define SYSCALL_ERROR_HANDLER \
.section .gnu.linkonce.t.__sparc64.get_pic.l7,"ax",@progbits; \
@@ -57,6 +68,7 @@ __sparc64.get_pic.l7: \
retl; \
add %o7, %l7, %l7; \
.previous; \
+SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \
save %sp, -192, %sp; \
sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7; \
call __sparc64.get_pic.l7; \
@@ -64,17 +76,20 @@ __sparc64.get_pic.l7: \
ldx [%l7 + errno], %l0; \
st %i0, [%l0]; \
jmpl %i7+8, %g0; \
- restore %g0, -1, %o0;
+ restore %g0, -1, %o0; \
+ .previous;
#else
-# define SYSCALL_ERROR_HANDLER \
- .global __errno_location; \
- .type __errno_location,@function; \
- save %sp, -192, %sp; \
- call __errno_location; \
- nop; \
- st %i0, [%o0]; \
- jmpl %i7+8, %g0; \
- restore %g0, -1, %o0;
+# define SYSCALL_ERROR_HANDLER \
+SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \
+ .global __errno_location; \
+ .type __errno_location,@function; \
+ save %sp, -192, %sp; \
+ call __errno_location; \
+ nop; \
+ st %i0, [%o0]; \
+ jmpl %i7+8, %g0; \
+ restore %g0, -1, %o0; \
+ .previous;
#endif
#define PSEUDO(name, syscall_name, args) \
@@ -82,10 +97,9 @@ __sparc64.get_pic.l7: \
ENTRY(name); \
LOADSYSCALL(syscall_name); \
ta 0x6d; \
- bcc,pt %xcc, 1f; \
+ bcs,pn %xcc, __syscall_error_handler; \
nop; \
- SYSCALL_ERROR_HANDLER; \
-1:
+ SYSCALL_ERROR_HANDLER
#undef PSEUDO_END
#define PSEUDO_END(name) \