From 92773db48eb6be7bc3ef12f44e4b163a7f5e0af3 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 12 Jun 2001 21:45:10 +0000 Subject: Cleanup the toploevel makefile handing of shared libs. Add weak_alias define, and set things up so nasty old coff toolchains can now compile things and should actually work again. -Erik --- libc/sysdeps/linux/m68k/Makefile | 2 +- libc/sysdeps/linux/m68k/README.m68k | 10 ---------- libc/sysdeps/linux/m68k/bits/vfork.h | 31 ------------------------------- libc/sysdeps/linux/m68k/crt0.S | 5 ++++- libc/sysdeps/linux/m68k/vfork.c | 25 +++++++++++++++++++++++++ 5 files changed, 30 insertions(+), 43 deletions(-) delete mode 100644 libc/sysdeps/linux/m68k/bits/vfork.h create mode 100644 libc/sysdeps/linux/m68k/vfork.c (limited to 'libc/sysdeps/linux/m68k') 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 +#include +#include + +#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); +} + -- cgit v1.2.3