summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/arm')
-rw-r--r--libc/sysdeps/linux/arm/Makefile.arch16
-rw-r--r--libc/sysdeps/linux/arm/clone.S23
-rw-r--r--libc/sysdeps/linux/arm/libc-aeabi_read_tp.S1
-rw-r--r--libc/sysdeps/linux/arm/libc-thumb_atomics.S1
-rw-r--r--libc/sysdeps/linux/arm/vfork.S13
5 files changed, 46 insertions, 8 deletions
diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
index c3c55258a..bec06ff44 100644
--- a/libc/sysdeps/linux/arm/Makefile.arch
+++ b/libc/sysdeps/linux/arm/Makefile.arch
@@ -5,14 +5,24 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := brk.c ioperm.c iopl.c mmap.c sigaction.c __syscall_error.c
+CSRC := brk.c ioperm.c iopl.c mmap.c __syscall_error.c
+
+ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+CSRC += sigaction.c
+endif
SSRC := \
- __longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \
+ __longjmp.S setjmp.S bsd-setjmp.S \
bsd-_setjmp.S sigrestorer.S mmap64.S
+ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+SSRC += libc-aeabi_read_tp.S libc-thumb_atomics.S
+else
+SSRC += vfork.S clone.S
+endif
+
ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
- CSRC += posix_fadvise.c posix_fadvise64.c
+CSRC += posix_fadvise.c posix_fadvise64.c
endif
ifeq ($(CONFIG_ARM_EABI),y)
diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
index d9483735d..fdc05b88b 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -30,12 +30,12 @@
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
.text
-.global clone
-.type clone,%function
+.global __clone
+.type __clone,%function
.align 2
#if defined(THUMB1_ONLY)
.thumb_func
-clone:
+__clone:
@ sanity check args
cmp r0, #0
beq __einval
@@ -52,9 +52,15 @@ clone:
@ get flags
mov r0, r2
@ new sp is already in r1
+ @ load remaining arguments off the stack
+ stmfd sp!, {r4}
+ ldr r2, [sp, #4]
+ ldr r3, [sp, #8]
+ ldr r4, [sp, #12]
DO_CALL (clone)
movs a1, a1
blt __error
+ ldmnefd sp!, {r4}
beq 1f
bx lr
1:
@@ -80,7 +86,7 @@ __error:
POP_RET
.pool
#else
-clone:
+__clone:
@ sanity check args
cmp r0, #0
IT(te, ne)
@@ -98,9 +104,15 @@ clone:
@ get flags
mov r0, r2
@ new sp is already in r1
+ @ load remaining arguments off the stack
+ stmfd sp!, {r4}
+ ldr r2, [sp, #4]
+ ldr r3, [sp, #8]
+ ldr r4, [sp, #12]
DO_CALL (clone)
movs a1, a1
blt __error
+ ldmnefd sp!, {r4}
IT(t, ne)
#if defined(__USE_BX__)
bxne lr
@@ -120,6 +132,7 @@ __error:
b __syscall_error
#endif
-.size clone,.-clone
+.size __clone,.-__clone
+weak_alias(__clone, clone)
#endif
diff --git a/libc/sysdeps/linux/arm/libc-aeabi_read_tp.S b/libc/sysdeps/linux/arm/libc-aeabi_read_tp.S
new file mode 100644
index 000000000..3aa135bf2
--- /dev/null
+++ b/libc/sysdeps/linux/arm/libc-aeabi_read_tp.S
@@ -0,0 +1 @@
+#include <ldso/ldso/arm/aeabi_read_tp.S>
diff --git a/libc/sysdeps/linux/arm/libc-thumb_atomics.S b/libc/sysdeps/linux/arm/libc-thumb_atomics.S
new file mode 100644
index 000000000..e7bc8950d
--- /dev/null
+++ b/libc/sysdeps/linux/arm/libc-thumb_atomics.S
@@ -0,0 +1 @@
+#include <ldso/ldso/arm/thumb_atomics.S>
diff --git a/libc/sysdeps/linux/arm/vfork.S b/libc/sysdeps/linux/arm/vfork.S
index 42595b026..17d6a4db0 100644
--- a/libc/sysdeps/linux/arm/vfork.S
+++ b/libc/sysdeps/linux/arm/vfork.S
@@ -12,6 +12,15 @@
#include <bits/errno.h>
#include <sys/syscall.h>
+#ifndef SAVE_PID
+#define SAVE_PID
+#endif
+
+#ifndef RESTORE_PID
+#define RESTORE_PID
+#endif
+
+
#ifdef __NR_fork
.text
.global __vfork
@@ -23,7 +32,9 @@
.thumb_func
__vfork:
#ifdef __NR_vfork
+ SAVE_PID
DO_CALL (vfork)
+ RESTORE_PID
ldr r1, =0xfffff000
cmp r0, r1
bcs 1f
@@ -57,7 +68,9 @@ __error:
__vfork:
#ifdef __NR_vfork
+ SAVE_PID
DO_CALL (vfork)
+ RESTORE_PID
cmn r0, #4096
IT(t, cc)
#if defined(__USE_BX__)