summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-06-10 18:25:35 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-06-10 18:25:35 +0000
commit569b0e03fb08ea519434d26ee77aeb3a9cdeedf3 (patch)
treece7bae583cdc2d0d15ac3f64f5f4d8ac8c13c2d3 /libc/sysdeps/linux/arm
parent79cdbec85c2c0154c8d5c6abeedee2f088300e0d (diff)
Remove TEXTREL relocations for ARM.
Hide __syscall_error from outside libc. From Peter Mazinger.
Diffstat (limited to 'libc/sysdeps/linux/arm')
-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
7 files changed, 73 insertions, 90 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