summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/arm/Makefile2
-rw-r--r--libc/sysdeps/linux/arm/bsd-_setjmp.S6
-rw-r--r--libc/sysdeps/linux/arm/bsd-setjmp.S6
-rw-r--r--libc/sysdeps/linux/arm/clone.S45
-rw-r--r--libc/sysdeps/linux/arm/mmap64.S35
-rw-r--r--libc/sysdeps/linux/arm/setjmp.S6
-rw-r--r--libc/sysdeps/linux/arm/vfork.S63
-rw-r--r--libc/sysdeps/linux/mips/__syscall_error.c2
-rw-r--r--libc/sysdeps/linux/powerpc/__syscall_error.c2
-rw-r--r--libc/sysdeps/linux/powerpc/__uClibc_syscall.S10
-rw-r--r--libc/sysdeps/linux/powerpc/brk.S20
-rw-r--r--libc/sysdeps/linux/powerpc/clone.S23
-rw-r--r--libc/sysdeps/linux/powerpc/syscall.S19
13 files changed, 102 insertions, 137 deletions
diff --git a/libc/sysdeps/linux/arm/Makefile b/libc/sysdeps/linux/arm/Makefile
index f25d0b523..77245307a 100644
--- a/libc/sysdeps/linux/arm/Makefile
+++ b/libc/sysdeps/linux/arm/Makefile
@@ -28,7 +28,7 @@ SSRC=__longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \
bsd-_setjmp.S sigrestorer.S mmap64.S
SOBJS=$(patsubst %.S,%.o, $(SSRC))
-CSRC=brk.c syscall.c ioperm.c sigaction.c
+CSRC=brk.c syscall.c ioperm.c sigaction.c __syscall_error.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(SOBJS) $(COBJS)
diff --git a/libc/sysdeps/linux/arm/bsd-_setjmp.S b/libc/sysdeps/linux/arm/bsd-_setjmp.S
index 7f092c18b..83cbd6ecf 100644
--- a/libc/sysdeps/linux/arm/bsd-_setjmp.S
+++ b/libc/sysdeps/linux/arm/bsd-_setjmp.S
@@ -30,5 +30,9 @@
.align 4;
_setjmp:
mov r1, #0
- b __sigsetjmp (PLT)
+#ifdef __PIC__
+ b __sigsetjmp(PLT)
+#else
+ b __sigsetjmp
+#endif
.size _setjmp,.-_setjmp;
diff --git a/libc/sysdeps/linux/arm/bsd-setjmp.S b/libc/sysdeps/linux/arm/bsd-setjmp.S
index 16f077a79..1bbddc53c 100644
--- a/libc/sysdeps/linux/arm/bsd-setjmp.S
+++ b/libc/sysdeps/linux/arm/bsd-setjmp.S
@@ -30,5 +30,9 @@
.align 4;
setjmp:
mov r1, #1
- b __sigsetjmp (PLT)
+#ifdef __PIC__
+ b __sigsetjmp(PLT)
+#else
+ b __sigsetjmp
+#endif
.size setjmp,.-setjmp;
diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
index f417be07f..7b5bf2ee3 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -20,21 +20,23 @@
/* clone() is even more special than fork() as it mucks with stacks
and invokes a function in the right context after its all over. */
-#include <asm/errno.h>
+#define _ERRNO_H
+#include <bits/errno.h>
#include <sys/syscall.h>
+#ifdef __NR_clone
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
-.text
-.globl __clone;
-.type __clone,%function
-.align 4;
+ .text
+ .globl __clone
+ .type __clone,%function
+ .align 4
__clone:
@ sanity check args
cmp r0, #0
cmpne r1, #0
moveq r0, #-EINVAL
- beq __syscall_error (PLT)
+ beq __error
@ insert the args onto the new stack
sub r1, r1, #8
@@ -48,7 +50,7 @@ __clone:
@ new sp is already in r1
swi __NR_clone
movs a1, a1
- blt __syscall_error (PLT)
+ blt __error
movne pc, lr
@ pick the function arg and call address off the stack and execute
@@ -57,25 +59,18 @@ __clone:
ldr pc, [sp]
@ and we are done, passing the return value through r0
- b _exit (PLT)
+#ifdef __PIC__
+ b _exit(PLT)
+#else
+ b _exit
+#endif
-__syscall_error:
- /* Looks like the syscall choked -- set errno */
- ldr r3, .L4
- /* Calculate the - of the syscall result, in case we need it */
- rsb r2, r0, $0
+__error:
+ b __syscall_error
- /* errno = -result */
- str r2, [r9,r3]
+ .size __clone,.-__clone
- /* return -1 */
- mvn r0, $0
- mov pc, lr
-.size __clone,.-__clone;
-
-.L4: .word errno
-
-
-.globl clone;
- clone = __clone
+ .weak clone
+ clone = __clone
+#endif
diff --git a/libc/sysdeps/linux/arm/mmap64.S b/libc/sysdeps/linux/arm/mmap64.S
index 0da4afbb0..310a60c5f 100644
--- a/libc/sysdeps/linux/arm/mmap64.S
+++ b/libc/sysdeps/linux/arm/mmap64.S
@@ -16,20 +16,18 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#define _ERRNO_H 1
#include <features.h>
+#define _ERRNO_H
#include <bits/errno.h>
#include <sys/syscall.h>
#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2
-
/* The mmap2 system call takes six arguments, all in registers. */
.text
- .global mmap64;
+ .global mmap64
.type mmap64,%function
- .align 4;
-
+ .align 4
mmap64:
stmfd sp!, {r4, r5, lr}
ldr r5, [sp, $16]
@@ -47,33 +45,26 @@ mmap64:
ldmccfd sp!, {r4, r5, pc}
cmn r0, $ENOSYS
ldmnefd sp!, {r4, r5, lr}
- bne __syscall_error (PLT)
+ bne __error
/* The current kernel does not support mmap2. Fall back to plain
mmap if the offset is small enough. */
ldr r5, [sp, $20]
mov r0, ip @ first arg was clobbered
teq r5, $0
ldmeqfd sp!, {r4, r5, lr}
- beq mmap (PLT)
+#ifdef __PIC__
+ beq mmap(PLT)
+#else
+ beq mmap
+#endif
.Linval:
mov r0, $-EINVAL
ldmfd sp!, {r4, r5, lr}
- b __syscall_error (PLT)
-
-__syscall_error:
- /* Looks like the syscall choked -- set errno */
- ldr r3, .L4
- /* Calculate the - of the syscall result, in case we need it */
- rsb r2, r0, $0
-
- /* errno = -result */
- str r2, [r9,r3]
+ b __error
- /* return -1 */
- mvn r0, $0
- mov pc, lr
-.size mmap64,.-mmap64;
+__error:
+ b __syscall_error
-.L4: .word errno
+ .size mmap64,.-mmap64
#endif
diff --git a/libc/sysdeps/linux/arm/setjmp.S b/libc/sysdeps/linux/arm/setjmp.S
index 402a66422..47ddf4adb 100644
--- a/libc/sysdeps/linux/arm/setjmp.S
+++ b/libc/sysdeps/linux/arm/setjmp.S
@@ -38,5 +38,9 @@ __sigsetjmp:
sub r0, r0, #48
/* Make a tail call to __sigjmp_save; it takes the same args. */
- B __sigjmp_save (PLT)
+#ifdef __PIC__
+ B __sigjmp_save(PLT)
+#else
+ B __sigjmp_save
+#endif
.size __sigsetjmp,.-__sigsetjmp;
diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S
index 9d18945d1..eecf56b8c 100644
--- a/libc/sysdeps/linux/arm/vfork.S
+++ b/libc/sysdeps/linux/arm/vfork.S
@@ -20,52 +20,37 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <asm/errno.h>
+#define _ERRNO_H
+#include <bits/errno.h>
#include <sys/syscall.h>
-
-
- .text
- .global vfork;
- .type vfork,%function
- .align 4; \
-
-
-
+#ifdef __NR_fork
+ .text
+ .global vfork
+ .type vfork,%function
+ .align 4
vfork:
#ifdef __NR_vfork
- swi __NR_vfork
- cmn r0, #4096
- movcc pc, lr
-
- /* Check if vfork even exists. */
- ldr r1, =-ENOSYS
- teq r0, r1
- bne __syscall_error
+ swi __NR_vfork
+ cmn r0, #4096
+ movcc pc, lr
+
+ /* Check if vfork even exists. */
+ ldr r1, =-ENOSYS
+ teq r0, r1
+ bne __error
#endif
- /* If we don't have vfork, use fork. */
- swi __NR_fork
- cmn r0, #4096
+ /* If we don't have vfork, use fork. */
+ swi __NR_fork
+ cmn r0, #4096
- /* Syscal worked. Return to child/parent */
- movcc pc, lr
-
-__syscall_error:
-
- /* Looks like the syscall choked -- set errno */
- ldr r3, .L4
- /* Calculate the - of the syscall result, in case we need it */
- rsb r2, r0, $0
-
- /* errno = -result */
- str r2, [r9,r3]
-
- /* return -1 */
- mvn r0, $0
- mov pc, lr
-
-.L4: .word errno
+ /* Syscal worked. Return to child/parent */
+ movcc pc, lr
+__error:
+ b __syscall_error
+ .size vfork,.-vfork
+#endif
diff --git a/libc/sysdeps/linux/mips/__syscall_error.c b/libc/sysdeps/linux/mips/__syscall_error.c
index 9ab65ed79..bb998b16a 100644
--- a/libc/sysdeps/linux/mips/__syscall_error.c
+++ b/libc/sysdeps/linux/mips/__syscall_error.c
@@ -21,7 +21,7 @@
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-int __syscall_error (int err_no)
+int attribute_hidden __syscall_error (int err_no)
{
__set_errno (err_no);
return -1;
diff --git a/libc/sysdeps/linux/powerpc/__syscall_error.c b/libc/sysdeps/linux/powerpc/__syscall_error.c
index 9ab65ed79..bb998b16a 100644
--- a/libc/sysdeps/linux/powerpc/__syscall_error.c
+++ b/libc/sysdeps/linux/powerpc/__syscall_error.c
@@ -21,7 +21,7 @@
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-int __syscall_error (int err_no)
+int attribute_hidden __syscall_error (int err_no)
{
__set_errno (err_no);
return -1;
diff --git a/libc/sysdeps/linux/powerpc/__uClibc_syscall.S b/libc/sysdeps/linux/powerpc/__uClibc_syscall.S
index 09bfb89cc..5a14c948c 100644
--- a/libc/sysdeps/linux/powerpc/__uClibc_syscall.S
+++ b/libc/sysdeps/linux/powerpc/__uClibc_syscall.S
@@ -1,14 +1,12 @@
-.section ".text"
+ .text
.align 2
-.globl __uClibc_syscall
+ .globl __uClibc_syscall
.type __uClibc_syscall,@function
__uClibc_syscall:
.Lsize:
sc
bnslr
-#ifdef __PIC__
- b __syscall_error@plt
-#else
+
b __syscall_error
-#endif
+
.size __uClibc_syscall,.Lsize-__uClibc_syscall
diff --git a/libc/sysdeps/linux/powerpc/brk.S b/libc/sysdeps/linux/powerpc/brk.S
index b914ce814..c0b436d96 100644
--- a/libc/sysdeps/linux/powerpc/brk.S
+++ b/libc/sysdeps/linux/powerpc/brk.S
@@ -24,10 +24,10 @@
#ifdef __NR_brk
.comm __curbrk,4,4
- .section ".text"
-.globl __brk;
-.type __brk, @function;
-.align 2;
+ .text
+ .globl __brk
+ .type __brk,@function
+ .align 2
__brk:
stwu r1,-16(r1)
@@ -51,13 +51,11 @@ __brk:
li r3,0
blelr+
li r3,ENOMEM
-#ifdef __PIC__
- b __syscall_error@plt
-#else
+
b __syscall_error
-#endif
-.size __brk,.-__brk
-.weak brk;
-brk=__brk
+ .size __brk,.-__brk
+
+ .weak brk
+ brk=__brk
#endif
diff --git a/libc/sysdeps/linux/powerpc/clone.S b/libc/sysdeps/linux/powerpc/clone.S
index edce8d569..f7c6bd18e 100644
--- a/libc/sysdeps/linux/powerpc/clone.S
+++ b/libc/sysdeps/linux/powerpc/clone.S
@@ -30,10 +30,9 @@
int flags [r5], void *arg [r6]); */
#ifdef __NR_clone
-.globl __clone;
-.type __clone, @function;
-.align 2;
-
+ .globl __clone
+ .type __clone,@function
+ .align 2
__clone:
/* Check for child_stack == NULL || fn == NULL. */
@@ -90,21 +89,15 @@ __clone:
lmw r29,16(r1)
addi r1,r1,32
bnslr+
-#ifdef __PIC__
- b __syscall_error@plt
-#else
+
b __syscall_error
-#endif
.Lbadargs:
li r3,EINVAL
-#ifdef __PIC__
- b __syscall_error@plt
-#else
+
b __syscall_error
-#endif
-.size __clone,.-__clone
-.weak clone;
-clone=__clone
+ .size __clone,.-__clone
+ .weak clone
+ clone=__clone
#endif
diff --git a/libc/sysdeps/linux/powerpc/syscall.S b/libc/sysdeps/linux/powerpc/syscall.S
index 71f711931..b85398416 100644
--- a/libc/sysdeps/linux/powerpc/syscall.S
+++ b/libc/sysdeps/linux/powerpc/syscall.S
@@ -18,14 +18,10 @@
#include <features.h>
- .section ".text"
- .globl syscall;
- .type syscall,@function;
- .align 2;
-
-.globl syscall;
-.type syscall,@function;
-.align 2;
+ .text
+ .globl syscall
+ .type syscall,@function
+ .align 2
syscall:
mr 0,3
@@ -36,10 +32,7 @@ syscall:
mr 7,8
sc
bnslr;
-#ifdef __PIC__
- b __syscall_error@plt
-#else
+
b __syscall_error
-#endif
-.size syscall,.-syscall
+ .size syscall,.-syscall