diff options
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r-- | libc/sysdeps/linux/m68k/Makefile | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/m68k/README.m68k | 10 | ||||
-rw-r--r-- | libc/sysdeps/linux/m68k/bits/vfork.h | 31 | ||||
-rw-r--r-- | libc/sysdeps/linux/m68k/crt0.S | 5 | ||||
-rw-r--r-- | libc/sysdeps/linux/m68k/vfork.c | 25 |
5 files changed, 30 insertions, 43 deletions
diff --git a/libc/sysdeps/linux/m68k/Makefile b/libc/sysdeps/linux/m68k/Makefile index e4346e4c8..5f2b73581 100644 --- a/libc/sysdeps/linux/m68k/Makefile +++ b/libc/sysdeps/linux/m68k/Makefile @@ -32,7 +32,7 @@ CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0)) SSRC=setjmp.S # longjmp.S _start.S clone.S SOBJS=$(patsubst %.S,%.o, $(SSRC)) -CSRC=ptrace.c #errno.c +CSRC=ptrace.c vfork.c COBJS=$(patsubst %.c,%.o, $(CSRC)) OBJS=$(SOBJS) $(MOBJ) $(COBJS) diff --git a/libc/sysdeps/linux/m68k/README.m68k b/libc/sysdeps/linux/m68k/README.m68k index 697413852..f774e6f7a 100644 --- a/libc/sysdeps/linux/m68k/README.m68k +++ b/libc/sysdeps/linux/m68k/README.m68k @@ -40,16 +40,6 @@ Installation: run: make install -Usage: - Any program you compile should have this added to CFLAGS: - - -D__VFORK_MACRO__ -Dconst= -D__const= - - (You need the equal sign so that const and __const are defined - as NULL instead of as '1') The 'const' keyword is broken for - m68k-pic-coff-gcc 2.7.2.3-pic-060999. There _was_ a fix - floating around, but apparently it didn't work. - Problems: I _may_ be able to help if you run into problems. Create a diff --git a/libc/sysdeps/linux/m68k/bits/vfork.h b/libc/sysdeps/linux/m68k/bits/vfork.h deleted file mode 100644 index ceb9af8a6..000000000 --- a/libc/sysdeps/linux/m68k/bits/vfork.h +++ /dev/null @@ -1,31 +0,0 @@ -/* orginally from include/unistd.h, written by ndf@linux.mit.edu> */ - -#ifndef _M68K_VFORK_H -#define _M68K_VFORK_H 1 - -extern int _clone __P ((int (*fn)(void *arg), void *child_stack, int flags, void *arg)); - -#ifndef __NR_vfork -#define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ -#endif - -#define vfork() ({ \ -unsigned long __res; \ -__asm__ __volatile__ ("movel %1,%%d0;" \ - "trap #0;" \ - "movel %%d0,%0" \ - : "=d" (__res) \ - : "0" (__NR_vfork) \ - : "%d0"); \ -if (__res >= (unsigned long)-4096) { \ - errno = -__res; \ - __res = (pid_t)-1; \ -} \ -(pid_t)__res; \ -}) - - -#define clone clone_not_available_use__clone - -#endif /* _M68K_VFORK_H */ - diff --git a/libc/sysdeps/linux/m68k/crt0.S b/libc/sysdeps/linux/m68k/crt0.S index 182e8baea..06b4b54f5 100644 --- a/libc/sysdeps/linux/m68k/crt0.S +++ b/libc/sysdeps/linux/m68k/crt0.S @@ -50,8 +50,11 @@ __exit: */ empty_func: rts +#if defined HAVE_ELF .weak atexit -atexit = empty_func +#else + .set atexit,empty_func +#endif /* * a little bit of stuff to support C++ diff --git a/libc/sysdeps/linux/m68k/vfork.c b/libc/sysdeps/linux/m68k/vfork.c new file mode 100644 index 000000000..9edcb650d --- /dev/null +++ b/libc/sysdeps/linux/m68k/vfork.c @@ -0,0 +1,25 @@ +/* orginally from include/unistd.h, written by ndf@linux.mit.edu> */ +#include <unistd.h> +#include <sys/types.h> +#include <asm/unistd.h> + +#ifndef __NR_vfork +#define __NR_vfork __NR_fork /* uClinux-2.0 only has fork which is vfork */ +#endif + +pid_t vfork(void) +{ + pid_t __res; + __asm__ __volatile__ ("movel %1,%%d0;" + "trap #0;" + "movel %%d0,%0" + : "=d" (__res) + : "0" (__NR_vfork) + : "%d0"); + if (__res >= (unsigned long)-4096) { + errno = -__res; + __res = (pid_t)-1; + } + return(__res); +} + |