From 322fdd37d307a12c913be78cebcc348a77731dd3 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <wbx@openadk.org>
Date: Thu, 12 Feb 2015 14:06:43 -0600
Subject: unbreak support for ARM no MMU case

As suggested on the uCLibc mailing list:
http://lists.uclibc.org/pipermail/uclibc/2014-November/048702.html
http://lists.uclibc.org/pipermail/uclibc/2014-November/048703.html
http://lists.uclibc.org/pipermail/uclibc/2014-November/048704.html
---
 libc/sysdeps/linux/arm/clone.S | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'libc/sysdeps')

diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S
index 29045ef7b..d1c9239da 100644
--- a/libc/sysdeps/linux/arm/clone.S
+++ b/libc/sysdeps/linux/arm/clone.S
@@ -26,7 +26,10 @@
 #include <sys/syscall.h>
 #include <bits/arm_asm.h>
 #include <bits/arm_bx.h>
+
+#if defined __UCLIBC_HAS_THREADS__ && !defined __LINUXTHREADS_OLD__
 #include <sysdep-cancel.h>
+#endif
 
 #define CLONE_VM      0x00000100
 #define CLONE_THREAD  0x00010000
@@ -57,23 +60,22 @@ __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:
 
 	@ pick the function arg and call address off the stack and execute
 	ldr	r0, [sp, #4]
+#if defined(__USE_BX__)
 	ldr	r1, [sp]
 	bl	2f	@ blx r1
+#else
+	mov     lr, pc
+	ldr     pc, [sp]
+#endif
 
 	@ and we are done, passing the return value through r0
 	bl	HIDDEN_JUMPTARGET(_exit)
-- 
cgit v1.2.3