diff options
author | jmc <jmc> | 2003-03-06 23:50:51 +0000 |
---|---|---|
committer | jmc <jmc> | 2003-03-06 23:50:51 +0000 |
commit | 4c6f4bbab225db6c6839c4abdfb9396fc4e7c67e (patch) | |
tree | 09c08c8a3b162d7625eaf8bd4f1cd77b3b9cb2dd | |
parent | 6f88d50370a75dc187820247fad8088965308615 (diff) | |
download | pkgsrc-4c6f4bbab225db6c6839c4abdfb9396fc4e7c67e.tar.gz |
Port this to powerpc. Already did it once based on lang/clisp including this
code so base the port off of those patches. Passes all tests via make check
-rw-r--r-- | devel/ffcall/Makefile | 14 | ||||
-rw-r--r-- | devel/ffcall/distinfo | 8 | ||||
-rw-r--r-- | devel/ffcall/files/tramp-rs6000-netbsd.s | 29 | ||||
-rw-r--r-- | devel/ffcall/files/vacall-rs6000-netbsd.s | 159 | ||||
-rw-r--r-- | devel/ffcall/patches/patch-aa | 20 | ||||
-rw-r--r-- | devel/ffcall/patches/patch-ab | 13 | ||||
-rw-r--r-- | devel/ffcall/patches/patch-ac | 16 | ||||
-rw-r--r-- | devel/ffcall/patches/patch-ad | 79 | ||||
-rw-r--r-- | devel/ffcall/patches/patch-ae | 19 | ||||
-rw-r--r-- | devel/ffcall/patches/patch-af | 18 |
10 files changed, 372 insertions, 3 deletions
diff --git a/devel/ffcall/Makefile b/devel/ffcall/Makefile index d9d02765e99..2ec64502729 100644 --- a/devel/ffcall/Makefile +++ b/devel/ffcall/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.9 2002/10/10 08:23:05 wiz Exp $ +# $NetBSD: Makefile,v 1.10 2003/03/06 23:50:51 jmc Exp $ DISTNAME= ffcall-1.8d PKGNAME= ffcall-1.8.4 @@ -11,9 +11,19 @@ COMMENT= foreign function call libraries # the file ${WRKDIR}/ffcall-1.8/avcall/avcall-${MACHINE_ARCH}.c needs to # be added for additional port support. -ONLY_FOR_PLATFORM= *-*-alpha *-*-arm *-*-i386 *-*-m68k *-*-sparc *-*-sparc64 +ONLY_FOR_PLATFORM= *-*-alpha *-*-arm *-*-i386 *-*-m68k *-*-sparc *-*-sparc64 *-*-powerpc GNU_CONFIGURE= yes USE_BUILDLINK2= yes +post-patch: + ${CP} files/tramp-rs6000-netbsd.s ${WRKSRC}/callback/trampoline_r + ${CP} files/vacall-rs6000-netbsd.s ${WRKSRC}/callback/vacall_r + +# +# Run the supplied tests to sanity check everything +# +post-build: + cd ${WRKSRC} && ${MAKE} check + .include "../../mk/bsd.pkg.mk" diff --git a/devel/ffcall/distinfo b/devel/ffcall/distinfo index 1993a108cd1..6642510f022 100644 --- a/devel/ffcall/distinfo +++ b/devel/ffcall/distinfo @@ -1,4 +1,10 @@ -$NetBSD: distinfo,v 1.3 2002/09/09 18:28:27 wiz Exp $ +$NetBSD: distinfo,v 1.4 2003/03/06 23:50:51 jmc Exp $ SHA1 (ffcall-1.8d.tar.gz) = 41362ce04ba43acbee0083f85077601f41acaf25 Size (ffcall-1.8d.tar.gz) = 587897 bytes +SHA1 (patch-aa) = e4ad5a65ab22c638dcf64764d3a54960f65564f1 +SHA1 (patch-ab) = b6bce2134149ed72cb4b4eca4d9eb517d58e80fb +SHA1 (patch-ac) = 1b8aabb3ec5d26246d583a32e43abad964b9a7e5 +SHA1 (patch-ad) = 8202dd37542ece1a18afcc104cb2fb9ced01cfaa +SHA1 (patch-ae) = b4a57c3f92e0a032af026ee11635f7ad20886ab0 +SHA1 (patch-af) = 1633a460515f202d117a2ad6652950e14c549742 diff --git a/devel/ffcall/files/tramp-rs6000-netbsd.s b/devel/ffcall/files/tramp-rs6000-netbsd.s new file mode 100644 index 00000000000..758fe31f916 --- /dev/null +++ b/devel/ffcall/files/tramp-rs6000-netbsd.s @@ -0,0 +1,29 @@ +/* Trampoline for rs6000 CPU with SysV.4 ABI */ + +/* + * Copyright 1995-1999 Bruno Haible, <haible@clisp.cons.org> + * + * This is free software distributed under the GNU General Public Licence + * described in the file COPYING. Contact the author if you don't have this + * or can't live with it. There is ABSOLUTELY NO WARRANTY, explicit or implied, + * on this software. + */ + +/* Available registers: r0, r12, r11, r10, r9, r8, r7, r6, r5, r4, r3. */ +/* However, r0 is special in that it cannot be used as a base register. */ +/* And r3...r10 should not be clobbered because they contain the first 8 + * integer arguments to the function being called. + * Use r13 as it's the last possible register allocated with gcc and r11/12 + * get used during dynamic linkage. + */ + + .globl tramp +tramp: +/* Move <data> into register r13 */ + lis 13,0x7355 + ori 13,13,0x4711 +/* Get <function> */ + lis 0,0xbabe + ori 0,0,0xbec0 + mtctr 0 + bctr diff --git a/devel/ffcall/files/vacall-rs6000-netbsd.s b/devel/ffcall/files/vacall-rs6000-netbsd.s new file mode 100644 index 00000000000..3486025a314 --- /dev/null +++ b/devel/ffcall/files/vacall-rs6000-netbsd.s @@ -0,0 +1,159 @@ + .file "vacall-rs6000.c" +gcc2_compiled.: + .section ".text" + .align 2 + .globl __vacall_r + .type __vacall_r,@function +__vacall_r: + stwu 1,-208(1) + mflr 0 + stw 0,212(1) + stw 3,152(1) + stw 4,156(1) + stw 5,160(1) + stw 6,164(1) + stw 7,168(1) + stw 8,172(1) + stw 9,176(1) + stw 10,180(1) + stfd 1,48(1) + stfd 2,56(1) + stfd 3,64(1) + stfd 4,72(1) + stfd 5,80(1) + stfd 6,88(1) + stfd 7,96(1) + stfd 8,104(1) + li 9,0 + stw 9,8(1) + addi 0,1,152 + stw 0,12(1) + addi 0,1,216 + stw 0,184(1) + stw 9,188(1) + stw 9,16(1) + stw 9,20(1) + addi 0,1,48 + stw 0,40(1) + lwz 9,0(13) + lwz 3,4(13) + addi 4,1,8 + mtlr 9 + blrl + lwz 0,20(1) + cmpwi 0,0,0 + bc 12,2,.L4 + cmpwi 0,0,1 + bc 12,2,.L42 + lwz 0,20(1) + cmpwi 0,0,2 + bc 4,2,.L7 + lbz 0,32(1) + extsb 3,0 + b .L4 +.L7: + lwz 0,20(1) + cmpwi 0,0,3 + bc 4,2,.L9 +.L42: + lbz 3,32(1) + b .L4 +.L9: + lwz 0,20(1) + cmpwi 0,0,4 + bc 4,2,.L11 + lha 3,32(1) + b .L4 +.L11: + lwz 0,20(1) + cmpwi 0,0,5 + bc 4,2,.L13 + lhz 3,32(1) + b .L4 +.L13: + lwz 0,20(1) + cmpwi 0,0,6 + bc 12,2,.L43 + lwz 0,20(1) + cmpwi 0,0,7 + bc 12,2,.L43 + lwz 0,20(1) + cmpwi 0,0,8 + bc 12,2,.L43 + lwz 0,20(1) + cmpwi 0,0,9 + bc 12,2,.L43 + lwz 9,20(1) + addi 9,9,-10 + cmplwi 0,9,1 + bc 12,1,.L23 + lwz 3,32(1) + lwz 4,36(1) + b .L4 +.L23: + lwz 0,20(1) + cmpwi 0,0,12 + bc 4,2,.L25 + lfs 1,32(1) + b .L4 +.L25: + lwz 0,20(1) + cmpwi 0,0,13 + bc 4,2,.L27 + lfd 1,32(1) + b .L4 +.L27: + lwz 0,20(1) + cmpwi 0,0,14 + bc 4,2,.L29 +.L43: + lwz 3,32(1) + b .L4 +.L29: + lwz 0,20(1) + cmpwi 0,0,15 + bc 4,2,.L4 + lwz 0,8(1) + andi. 9,0,1 + bc 12,2,.L32 + lwz 3,16(1) + b .L4 +.L32: + lwz 0,8(1) + andi. 9,0,1024 + bc 12,2,.L4 + lwz 0,24(1) + cmpwi 0,0,1 + bc 4,2,.L35 + lwz 9,16(1) + lbz 3,0(9) + b .L4 +.L35: + lwz 0,24(1) + cmpwi 0,0,2 + bc 4,2,.L37 + lwz 9,16(1) + lhz 3,0(9) + b .L4 +.L37: + lwz 0,24(1) + cmpwi 0,0,4 + bc 4,2,.L39 + lwz 9,16(1) + lwz 3,0(9) + b .L4 +.L39: + lwz 0,24(1) + cmpwi 0,0,8 + bc 4,2,.L4 + lwz 9,16(1) + lwz 3,0(9) + lwz 4,4(9) +.L4: + lwz 0,212(1) + mtlr 0 + la 1,208(1) + blr +.Lfe1: + .size __vacall_r,.Lfe1-__vacall_r + .ident "GCC: (GNU) 2.95.2 19991024 (release/franzo)" diff --git a/devel/ffcall/patches/patch-aa b/devel/ffcall/patches/patch-aa new file mode 100644 index 00000000000..eacb0b7ee18 --- /dev/null +++ b/devel/ffcall/patches/patch-aa @@ -0,0 +1,20 @@ +$NetBSD: patch-aa,v 1.1 2003/03/06 23:50:52 jmc Exp $ + +--- ./avcall/Makefile.in.orig Thu Mar 6 23:11:35 2003 ++++ ./avcall/Makefile.in Thu Mar 6 23:15:52 2003 +@@ -116,12 +116,12 @@ + case "$(OS)" in \ + aix3*) syntax=aix.old;; \ + aix*) syntax=aix.new;; \ +- linux*) syntax=linux;; \ ++ linux* | netbsd* ) syntax=linux;; \ + *) syntax=sysv4;; \ + esac; \ + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/avcall-rs6000-$${syntax}.s ; \ +- cp avcall-rs6000-$${syntax}.lo avcall-rs6000.lo ; rm -f avcall-rs6000-$${syntax}.lo ; \ +- if test -f avcall-rs6000-$${syntax}.o; then mv avcall-rs6000-$${syntax}.o avcall-rs6000.o; fi ++ cp avcall-rs6000-$${syntax}.lo avcall-rs6000.lo ; \ ++ if test -f avcall-rs6000-$${syntax}.o; then cp avcall-rs6000-$${syntax}.o avcall-rs6000.o; fi + + avcall-m88k.lo : $(srcdir)/avcall-m88k.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/avcall-m88k.s diff --git a/devel/ffcall/patches/patch-ab b/devel/ffcall/patches/patch-ab new file mode 100644 index 00000000000..bbfccb96cdc --- /dev/null +++ b/devel/ffcall/patches/patch-ab @@ -0,0 +1,13 @@ +$NetBSD: patch-ab,v 1.1 2003/03/06 23:50:52 jmc Exp $ + +--- ./callback/trampoline_r/Makefile.in.orig Thu Mar 6 23:16:08 2003 ++++ ./callback/trampoline_r/Makefile.in Thu Mar 6 23:17:08 2003 +@@ -90,7 +90,7 @@ + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/cache-hppa.s + + cache-rs6000.lo : $(srcdir)/cache-rs6000-sysv4.s +- $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/cache-rs6000-sysv4.s ; mv -f cache-rs6000-sysv4.o cache-rs6000.o ; mv -f cache-rs6000-sysv4.lo cache-rs6000.lo ++ $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/cache-rs6000-sysv4.s ; cp cache-rs6000-sysv4.o cache-rs6000.o ; mv -f cache-rs6000-sysv4.lo cache-rs6000.lo + + cache-convex.lo : $(srcdir)/cache-convex.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/cache-convex.s diff --git a/devel/ffcall/patches/patch-ac b/devel/ffcall/patches/patch-ac new file mode 100644 index 00000000000..3a96cd1a13d --- /dev/null +++ b/devel/ffcall/patches/patch-ac @@ -0,0 +1,16 @@ +$NetBSD: patch-ac,v 1.1 2003/03/06 23:50:52 jmc Exp $ + +--- ./callback/trampoline_r/test1.c.orig Thu Mar 6 23:18:14 2003 ++++ ./callback/trampoline_r/test1.c Thu Mar 6 23:18:50 2003 +@@ -69,7 +69,11 @@ + register void* env __asm__("r12"); + #endif + #ifdef __rs6000__ ++#ifdef __NetBSD__ ++register void* env __asm__("r13"); ++#else + register void* env __asm__("r11"); ++#endif + #endif + #ifdef __m88k__ + register void* env __asm__("r11"); diff --git a/devel/ffcall/patches/patch-ad b/devel/ffcall/patches/patch-ad new file mode 100644 index 00000000000..046c77d0bd8 --- /dev/null +++ b/devel/ffcall/patches/patch-ad @@ -0,0 +1,79 @@ +$NetBSD: patch-ad,v 1.1 2003/03/06 23:50:53 jmc Exp $ + +--- ./callback/trampoline_r/trampoline.c.orig Thu Mar 6 23:19:30 2003 ++++ ./callback/trampoline_r/trampoline.c Thu Mar 6 23:35:53 2003 +@@ -21,12 +21,16 @@ + #endif + #endif + #if defined(__rs6000__) ++#if defined(__NetBSD__) ++#define __powerpcnetbsd__ ++#else + #if !defined(_AIX) + #define __rs6000sysv4__ /* SysV.4 ABI, real machine code. */ + #else + #define __rs6000aix__ /* AIX ABI, just a closure. */ + #endif + #endif ++#endif + #if defined(__hppanew__) + /* + * A function pointer is a biased pointer to a data area whose first word +@@ -259,7 +263,7 @@ + #include <sys/syslocal.h> + #endif + /* Inline assembly function for instruction cache flush. */ +-#if defined(__sparc__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppaold__) || defined(__rs6000sysv4__) || defined(__convex__) ++#if defined(__sparc__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppaold__) || defined(__rs6000sysv4__) || defined(__convex__) || defined(__powerpcnetbsd__) + #ifdef __GNUC__ + extern inline + #if defined(__sparc__) || defined(__sparc64__) +@@ -336,7 +340,7 @@ + #define TRAMP_LENGTH 32 + #define TRAMP_ALIGN 4 + #endif +-#ifdef __rs6000sysv4__ ++#if defined(__rs6000sysv4__) || defined(__powerpcnetbsd__) + #define TRAMP_LENGTH 24 + #define TRAMP_ALIGN 4 + #endif +@@ -876,6 +880,39 @@ + #define tramp_data(function) \ + hilo(*(unsigned short *) (function + 2), *(unsigned short *) (function + 6)) + #endif ++#ifdef __powerpcnetbsd__ ++ /* function: ++ * {liu|lis} 13,hi16(<data>) 3D A0 hi16(<data>) ++ * {oril|ori} 13,13,lo16(<data>) 61 AD lo16(<data>) ++ * {liu|lis} 0,hi16(<address>) 3C 00 hi16(<address>) ++ * {oril|ori} 0,0,lo16(<address>) 60 00 lo16(<address>) ++ * mtctr 0 7C 09 03 A6 ++ * bctr 4E 80 04 20 ++ */ ++ *(short *) (function + 0) = 0x3DA0; ++ *(short *) (function + 2) = (unsigned long) data >> 16; ++ *(short *) (function + 4) = 0x61AD; ++ *(short *) (function + 6) = (unsigned long) data & 0xffff; ++ *(short *) (function + 8) = 0x3C00; ++ *(short *) (function +10) = (unsigned long) address >> 16; ++ *(short *) (function +12) = 0x6000; ++ *(short *) (function +14) = (unsigned long) address & 0xffff; ++ *(long *) (function +16) = 0x7C0903A6; ++ *(long *) (function +20) = 0x4E800420; ++#define is_tramp(function) \ ++ *(unsigned short *) (function + 0) == 0x3DA0 && \ ++ *(unsigned short *) (function + 4) == 0x61AD && \ ++ *(unsigned short *) (function + 8) == 0x3C00 && \ ++ *(unsigned short *) (function +12) == 0x6000 && \ ++ *(unsigned long *) (function +16) == 0x7C0903A6 && \ ++ *(unsigned long *) (function +20) == 0x4E800420 ++#define hilo(hiword,loword) \ ++ (((unsigned long) (hiword) << 16) | (unsigned long) (loword)) ++#define tramp_address(function) \ ++ hilo(*(unsigned short *) (function +10), *(unsigned short *) (function +14)) ++#define tramp_data(function) \ ++ hilo(*(unsigned short *) (function + 2), *(unsigned short *) (function + 6)) ++#endif + #ifdef __rs6000aix__ + /* function: + * .long .tramp_r diff --git a/devel/ffcall/patches/patch-ae b/devel/ffcall/patches/patch-ae new file mode 100644 index 00000000000..e8b6a49ae57 --- /dev/null +++ b/devel/ffcall/patches/patch-ae @@ -0,0 +1,19 @@ +$NetBSD: patch-ae,v 1.1 2003/03/06 23:50:53 jmc Exp $ + +--- ./callback/vacall_r/Makefile.in.orig Thu Mar 6 23:14:38 2003 ++++ ./callback/vacall_r/Makefile.in Thu Mar 6 23:15:37 2003 +@@ -118,11 +118,12 @@ + aix3*) syntax=aix.old;; \ + aix*) syntax=aix.new;; \ + linux*) syntax=linux;; \ ++ netbsd*) syntax=netbsd;; \ + *) syntax=sysv4;; \ + esac; \ + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-rs6000-$${syntax}.s ; \ +- cp vacall-rs6000-$${syntax}.lo vacall-rs6000.lo ; rm -f vacall-rs6000-$${syntax}.lo ; \ +- if test -f vacall-rs6000-$${syntax}.o; then mv vacall-rs6000-$${syntax}.o vacall-rs6000.o; fi ++ cp vacall-rs6000-$${syntax}.lo vacall-rs6000.lo ; \ ++ if test -f vacall-rs6000-$${syntax}.o; then cp vacall-rs6000-$${syntax}.o vacall-rs6000.o; fi + + vacall-m88k.lo : $(srcdir)/vacall-m88k.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-m88k.s diff --git a/devel/ffcall/patches/patch-af b/devel/ffcall/patches/patch-af new file mode 100644 index 00000000000..0d2e6e757ed --- /dev/null +++ b/devel/ffcall/patches/patch-af @@ -0,0 +1,18 @@ +$NetBSD: patch-af,v 1.1 2003/03/06 23:50:53 jmc Exp $ + +--- ./vacall/Makefile.in.orig Thu Mar 6 23:13:48 2003 ++++ ./vacall/Makefile.in Thu Mar 6 23:14:07 2003 +@@ -108,11 +108,11 @@ + case "$(OS)" in \ + aix3*) syntax=aix.old;; \ + aix*) syntax=aix.new;; \ +- linux*) syntax=linux;; \ ++ linux* | netbsd*) syntax=linux;; \ + *) syntax=sysv4;; \ + esac; \ + $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-rs6000-$${syntax}.s ; \ +- mv vacall-rs6000-$${syntax}.o vacall-rs6000.o ++ cp vacall-rs6000-$${syntax}.o vacall-rs6000.o + + vacall-m88k.o : $(srcdir)/vacall-m88k.s + $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-m88k.s |