summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/nios2/__longjmp.S3
-rw-r--r--libc/sysdeps/linux/nios2/clone.S23
-rw-r--r--libc/sysdeps/linux/nios2/crt1.S4
-rw-r--r--libc/sysdeps/linux/nios2/setjmp.S4
-rw-r--r--libc/sysdeps/linux/nios2/vfork.S30
5 files changed, 37 insertions, 27 deletions
diff --git a/libc/sysdeps/linux/nios2/__longjmp.S b/libc/sysdeps/linux/nios2/__longjmp.S
index d15f040cd..96eeaadc0 100644
--- a/libc/sysdeps/linux/nios2/__longjmp.S
+++ b/libc/sysdeps/linux/nios2/__longjmp.S
@@ -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
diff --git a/libc/sysdeps/linux/nios2/clone.S b/libc/sysdeps/linux/nios2/clone.S
index 4dd8745cd..ba514c40b 100644
--- a/libc/sysdeps/linux/nios2/clone.S
+++ b/libc/sysdeps/linux/nios2/clone.S
@@ -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
-.type clone,@function
-.globl clone;
-clone:
-.type __clone,@function
-.globl __clone;
+.global __clone
+.type __clone,%function
+.align 4
__clone:
addi sp,sp,-8
mov r8,r4
@@ -64,3 +64,10 @@ CLONE_OK:
ldw r16,0(sp)
addi sp,sp,8
ret
+
+.size __clone,.-__clone
+
+.weak clone
+ clone = __clone
+
+#endif
diff --git a/libc/sysdeps/linux/nios2/crt1.S b/libc/sysdeps/linux/nios2/crt1.S
index 948eeb1ed..bcb8a26db 100644
--- a/libc/sysdeps/linux/nios2/crt1.S
+++ b/libc/sysdeps/linux/nios2/crt1.S
@@ -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)
diff --git a/libc/sysdeps/linux/nios2/setjmp.S b/libc/sysdeps/linux/nios2/setjmp.S
index b2ff52162..8acd22044 100644
--- a/libc/sysdeps/linux/nios2/setjmp.S
+++ b/libc/sysdeps/linux/nios2/setjmp.S
@@ -11,6 +11,7 @@
*
*/
+#include <features.h>
#define _ASM
#define _SETJMP_H
#include <bits/setjmp.h>
@@ -47,5 +48,4 @@ __sigsetjmp:
jmp r8
#endif
-
-
+.size __sigsetjmp,.-__sigsetjmp
diff --git a/libc/sysdeps/linux/nios2/vfork.S b/libc/sysdeps/linux/nios2/vfork.S
index a19a90023..d75edcec9 100644
--- a/libc/sysdeps/linux/nios2/vfork.S
+++ b/libc/sysdeps/linux/nios2/vfork.S
@@ -9,23 +9,20 @@
*
* Written by Wentao Xu <wentao@microtronix.com>
*/
-#include <asm/unistd.h>
-#ifndef __NR_vfork
-#define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */
-#endif
+#include <features.h>
+
+#define _ERRNO_H
+#include <bits/errno.h>
+#include <sys/syscall.h>
+
+#ifdef __NR_fork
+.text
+.global __vfork
+.hidden __vfork
+.type __vfork,%function
+.align 4
- .text
- .balign 4
- .globl errno
- .globl vfork
- .globl __libc_vfork
-#if defined __HAVE_ELF__
- .type vfork,@function
- .type __libc_vfork,@function
-#endif
-vfork:
-__libc_vfork:
movui r2, TRAP_ID_SYSCALL
movui r3, __NR_vfork
trap
@@ -51,3 +48,6 @@ fix_errno:
addi sp, sp, 8
ret
+.size __vfork,.-__vfork
+strong_alias(__vfork,vfork)
+#endif