@@ -11,6 +11,7 @@
*
*/
+#include <features.h>
#define _ASM
#define _SETJMP_H
#include <bits/setjmp.h>
@@ -45,4 +46,4 @@ __longjmp:
/* return to saved RA */
ret
-
+.size __longjmp,.-__longjmp
@@ -9,18 +9,18 @@
* Written by Wentao Xu <wentao@microtronix.com>
-#include <asm/errno.h>
-#include <asm/unistd.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
-.balign 4
+.global __clone
-.type clone,@function
+.type __clone,%function
-.globl clone;
+.align 4
-clone:
-.type __clone,@function
-.globl __clone;
__clone:
addi sp,sp,-8
mov r8,r4
@@ -64,3 +64,10 @@ CLONE_OK:
ldw r16,0(sp)
addi sp,sp,8
+.size __clone,.-__clone
+.weak clone
+ clone = __clone
+#endif
@@ -47,7 +47,9 @@ _start:
movhi r7, %hi(_init)
ori r7, r7, %lo(_init)
- /* reuse the argc stack slot for the 5th arg */
+ /* Allocate space on the stack for 6-7th arg, reuse 5th space */
+ addi sp,sp,-8
+ /* push 5-7th args on stack */
movhi r8, %hi(_fini)
ori r8, r8, %lo(_fini)
stw r8, 0(sp)
@@ -47,5 +48,4 @@ __sigsetjmp:
jmp r8
#endif
+.size __sigsetjmp,.-__sigsetjmp
@@ -9,23 +9,20 @@
-#ifndef __NR_vfork
-#define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
-#endif
+#ifdef __NR_fork
+.text
+.global __vfork
+.hidden __vfork
+.type __vfork,%function
- .text
- .balign 4
- .globl errno
- .globl vfork
- .globl __libc_vfork
-#if defined __HAVE_ELF__
- .type vfork,@function
- .type __libc_vfork,@function
-vfork:
-__libc_vfork:
movui r2, TRAP_ID_SYSCALL
movui r3, __NR_vfork
trap
@@ -51,3 +48,6 @@ fix_errno:
addi sp, sp, 8
+.size __vfork,.-__vfork
+strong_alias(__vfork,vfork)