summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/clone.S
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/clone.S
parent79cdbec85c2c0154c8d5c6abeedee2f088300e0d (diff)
Remove TEXTREL relocations for ARM.
Hide __syscall_error from outside libc. From Peter Mazinger.
Diffstat (limited to 'libc/sysdeps/linux/arm/clone.S')
-rw-r--r--libc/sysdeps/linux/arm/clone.S45
1 files changed, 20 insertions, 25 deletions
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