On Sat, Jan 18, 2014 at 02:36:13PM +0100, Sebastian Reitenbach wrote: > Hi, > > while playing with GNUstep on my lemote, I found libffi absolute > unusable. Since the GNUstep stuff also supports to link against > ffcall, I tried that. > The patches make ffcall compile with lots of warnings suppressed, > and allow the configure script of gnustep-base to pass the test > (before it didn't) > > Running the regression tests of ffcall there, some tests are still failing. > However, I enabled devel/clisp on mips64, the only consumer for > ffcall, and with that I was at least able to run a simple hello world. > > Is the patch OK? > > Sebastian > >
Hi Sebastian, You got farther then I original did when I attempted to get ffcall and clisp working on mips64el [0]. However, avcall still fails 2 tests, callback/trampoline_r tests fail with a SIGILL and vacall tests core dump. One plus trampoline tests now pass! It's good to here clisp can run a simple hello world, but I believe I was in the same boat. How does make test fair on clisp? I would run into the following error, which seems to relate to ffcall. (TYPE-OF (SETQ CALLBACKF (WITH-C-VAR (X 'IDFUN #'CALLBACK) X))) Bus error (core dumped). [0] http://marc.info/?l=openbsd-ports&m=135718006608319&w=2 > Index: Makefile > =================================================================== > RCS file: /cvs/ports/devel/ffcall/Makefile,v > retrieving revision 1.22 > diff -u -p -u -r1.22 Makefile > --- Makefile 21 Mar 2013 08:45:14 -0000 1.22 > +++ Makefile 18 Jan 2014 13:29:32 -0000 > @@ -7,9 +7,9 @@ ONLY_FOR_ARCHS= alpha amd64 hppa i386 mi > COMMENT= foreign function call libraries > > DISTNAME= ffcall-1.10 > -REVISION = 1 > -SHARED_LIBS= avcall 1.0 \ > - callback 1.0 > +REVISION = 2 > +SHARED_LIBS= avcall 1.1 \ > + callback 1.1 > CATEGORIES= devel > MASTER_SITES= http://www.haible.de/bruno/gnu/ \ > ftp://ftp.ilog.fr/pub/Users/haible/gnu/ > Index: patches/patch-avcall_avcall_h_in > =================================================================== > RCS file: /cvs/ports/devel/ffcall/patches/patch-avcall_avcall_h_in,v > retrieving revision 1.1 > diff -u -p -u -r1.1 patch-avcall_avcall_h_in > --- patches/patch-avcall_avcall_h_in 23 Sep 2010 13:38:33 -0000 1.1 > +++ patches/patch-avcall_avcall_h_in 18 Jan 2014 13:29:32 -0000 > @@ -1,6 +1,54 @@ > $OpenBSD: patch-avcall_avcall_h_in,v 1.1 2010/09/23 13:38:33 joshe Exp $ > ---- avcall/avcall.h.in.orig Mon Jan 26 06:58:41 2004 > -+++ avcall/avcall.h.in Sat Apr 25 16:17:43 2009 > + > +try fix mips64el > + > +--- avcall/avcall.h.in.orig Mon Jan 26 15:58:41 2004 > ++++ avcall/avcall.h.in Tue Jan 14 20:29:21 2014 > +@@ -367,7 +367,7 @@ typedef struct > + __avword* iaptr; > + __avword iargs[6]; > + #endif > +-#if defined(__mips__) && !defined(__mipsn32__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) > + /* store the floating-point arguments in an extra array */ > + int anum; > + double floatarg[2]; > +@@ -447,7 +447,7 @@ typedef struct > + #define __av_start1(LIST) \ > + (LIST).aptr = &(LIST).args[0], > + #endif > +-#if defined(__mips__) && !defined(__mipsn32__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) > + #define __av_start1(LIST) \ > + (LIST).anum = 0, \ > + (LIST).aptr = &(LIST).args[0], > +@@ -606,7 +606,7 @@ typedef struct > + #define __av_start_struct3(LIST) \ > + 0 > + #endif > +-#if defined(__mips__) && !defined(__mipsn32__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) > + #define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ > + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4) > + /* Test __AV_SMALL_STRUCT_RETURN instead of __AV_REGISTER_STRUCT_RETURN. */ > +@@ -840,7 +840,7 @@ typedef struct > + > + #endif > + > +-#if defined(__mips__) && !defined(__mipsn32__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) > + > + /* Up to 2 leading float or double non-varargs args can be passed in > + * float registers, but we also push them into the corresponding int > +@@ -1145,7 +1145,7 @@ typedef struct > + 0))) > + #endif > + /* small structures < 1 word are adjusted depending on compiler */ > +-#if defined(__mips__) && !defined(__mipsn32__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) > + #define __av_struct_leftadjusted(LIST,TYPE,TYPE_SIZE,TYPE_ALIGN,ASSIGN,VAL) > \ > + (((LIST).aptr = \ > + (__avword*)(((__avword)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & > -(long)(TYPE_ALIGN)))\ > @@ -1307,8 +1307,9 @@ typedef struct > ? -1 : > (ASSIGN(TYPE,TYPE_SIZE,TYPE_ALIGN,(void*)((__avword)(LIST).aptr-(TYPE_SIZE)),VAL),\ > (LIST).aptr = > (__avword*)(((__avword)(LIST).aptr+sizeof(__avword)-1) & > -(long)sizeof(__avword)),\ > Index: patches/patch-callback_trampoline_r_test1_c > =================================================================== > RCS file: > /cvs/ports/devel/ffcall/patches/patch-callback_trampoline_r_test1_c,v > retrieving revision 1.1 > diff -u -p -u -r1.1 patch-callback_trampoline_r_test1_c > --- patches/patch-callback_trampoline_r_test1_c 23 Aug 2010 14:16:09 > -0000 1.1 > +++ patches/patch-callback_trampoline_r_test1_c 18 Jan 2014 13:29:32 > -0000 > @@ -1,7 +1,21 @@ > $OpenBSD: patch-callback_trampoline_r_test1_c,v 1.1 2010/08/23 14:16:09 > jasper Exp $ > ---- callback/trampoline_r/test1.c.orig Sun Apr 26 06:46:30 2009 > -+++ callback/trampoline_r/test1.c Sun Apr 26 06:46:30 2009 > -@@ -70,7 +70,7 @@ register void* env __asm__("%r29"); > +--- callback/trampoline_r/test1.c.orig Mon Jan 26 15:59:26 2004 > ++++ callback/trampoline_r/test1.c Fri Jan 17 23:33:22 2014 > +@@ -48,12 +48,9 @@ int f (x) > + #ifdef __m68k__ > + register void* env __asm__("a0"); > + #endif > +-#ifdef __mips__ > ++#if defined(__mips__) || defined(__mips64__) > + register void* env __asm__("$2"); > + #endif > +-#ifdef __mips64__ > +-register void* env __asm__("$2"); > +-#endif > + #if defined(__sparc__) && !defined(__sparc64__) > + register void* env __asm__("%g2"); > + #endif > +@@ -70,7 +67,7 @@ register void* env __asm__("%r29"); > register void* env __asm__("r12"); > #endif > #ifdef __rs6000__ > Index: patches/patch-callback_trampoline_r_trampoline_c > =================================================================== > RCS file: > /cvs/ports/devel/ffcall/patches/patch-callback_trampoline_r_trampoline_c,v > retrieving revision 1.3 > diff -u -p -u -r1.3 patch-callback_trampoline_r_trampoline_c > --- patches/patch-callback_trampoline_r_trampoline_c 23 Sep 2010 13:38:33 > -0000 1.3 > +++ patches/patch-callback_trampoline_r_trampoline_c 18 Jan 2014 13:29:32 > -0000 > @@ -7,8 +7,8 @@ stack instead. > > Also fix powerpc and mips64. > > ---- callback/trampoline_r/trampoline.c.orig Mon Jan 26 07:00:05 2004 > -+++ callback/trampoline_r/trampoline.c Fri Jul 30 14:34:10 2010 > +--- callback/trampoline_r/trampoline.c.orig Mon Jan 26 16:00:05 2004 > ++++ callback/trampoline_r/trampoline.c Wed Jan 15 09:14:02 2014 > @@ -21,7 +21,7 @@ > #endif > #endif > @@ -18,7 +18,7 @@ Also fix powerpc and mips64. > #define __rs6000netbsd__ > #else > #if !defined(_AIX) > -@@ -196,8 +196,12 @@ extern RETGETPAGESIZETYPE getpagesize (); > +@@ -196,12 +196,16 @@ extern RETGETPAGESIZETYPE getpagesize (); > #ifdef linux > #include <asm/cachectl.h> > #else > @@ -27,11 +27,24 @@ Also fix powerpc and mips64. > +#else > #ifdef HAVE_SYS_CACHECTL_H > #include <sys/cachectl.h> > + #endif > + #endif > + #endif > + #endif > +#endif > + #ifdef __m88k__ > + #include <sys/syslocal.h> > #endif > +@@ -242,7 +246,7 @@ extern void __TR_clear_cache(); > + #define TRAMP_LENGTH 14 > + #define TRAMP_ALIGN 16 > #endif > +-#if defined(__mips__) && !defined(__mipsn32__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) > + #define TRAMP_LENGTH 24 > + #define TRAMP_ALIGN 4 > #endif > -@@ -259,11 +259,11 @@ extern void __TR_clear_cache(); > +@@ -259,11 +263,11 @@ extern void __TR_clear_cache(); > #define TRAMP_ALIGN 8 > #endif > #if defined(__sparc__) && !defined(__sparc64__) > @@ -45,7 +58,16 @@ Also fix powerpc and mips64. > #define TRAMP_ALIGN 16 > #endif > #ifdef __alpha__ > -@@ -614,52 +614,64 @@ __TR_function alloc_trampoline_r (address, data0, data > +@@ -459,7 +463,7 @@ __TR_function alloc_trampoline_r (address, data0, data > + #define tramp_data(function) \ > + *(long *) (function + 2) > + #endif > +-#if defined(__mips__) && !defined(__mipsn32__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) > + /* function: > + * li $2,<data>&0xffff0000 3C 02 hi16(<data>) > + * ori $2,$2,<data>&0xffff 34 42 lo16(<data>) > +@@ -614,52 +618,64 @@ __TR_function alloc_trampoline_r (address, data0, data > /* function: > * sethi %hi(<data>),%g2 05000000 | (<data> >> 10) > * sethi %hi(<address>),%g1 03000000 | (<address> >> 10) > Index: patches/patch-callback_vacall_r_vacall_r_h_in > =================================================================== > RCS file: > /cvs/ports/devel/ffcall/patches/patch-callback_vacall_r_vacall_r_h_in,v > retrieving revision 1.1 > diff -u -p -u -r1.1 patch-callback_vacall_r_vacall_r_h_in > --- patches/patch-callback_vacall_r_vacall_r_h_in 23 Feb 2010 20:11:15 > -0000 1.1 > +++ patches/patch-callback_vacall_r_vacall_r_h_in 18 Jan 2014 13:29:32 > -0000 > @@ -3,8 +3,8 @@ $OpenBSD: patch-callback_vacall_r_vacall > On OpenBSD the mips64(el) architectures define both __mips__ and __mips64__, > which leads to confusion and redeclarations here. > > ---- callback/vacall_r/vacall_r.h.in.orig Thu Feb 11 23:44:38 2010 > -+++ callback/vacall_r/vacall_r.h.in Thu Feb 11 23:48:22 2010 > +--- callback/vacall_r/vacall_r.h.in.orig Wed Jun 2 21:18:12 2004 > ++++ callback/vacall_r/vacall_r.h.in Tue Jan 14 20:31:43 2014 > @@ -395,7 +395,7 @@ typedef struct > float farg[4]; > double darg[2]; > @@ -46,7 +46,7 @@ which leads to confusion and redeclarati > #define __va_align_double(LIST) > #endif > -#if defined(__mips__) && !defined(__mipsn32__) || defined(__m88k__) > -+#if defined(__mips__) && !defined(__mipsn32__) || defined(__m88k__) && > !defined(__mips64__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) || > defined(__m88k__) > /* __VA_alignof(double) > sizeof(__vaword) */ > #define __va_align_double(LIST) \ > (LIST)->aptr = ((LIST)->aptr + sizeof(double)-1) & -(long)sizeof(double), > Index: patches/patch-trampoline_trampoline_c > =================================================================== > RCS file: /cvs/ports/devel/ffcall/patches/patch-trampoline_trampoline_c,v > retrieving revision 1.1 > diff -u -p -u -r1.1 patch-trampoline_trampoline_c > --- patches/patch-trampoline_trampoline_c 23 Feb 2010 20:11:15 -0000 > 1.1 > +++ patches/patch-trampoline_trampoline_c 18 Jan 2014 13:29:32 -0000 > @@ -1,7 +1,7 @@ > $OpenBSD: patch-trampoline_trampoline_c,v 1.1 2010/02/23 20:11:15 jasper Exp > $ > ---- trampoline/trampoline.c.orig Thu Feb 11 23:38:13 2010 > -+++ trampoline/trampoline.c Thu Feb 11 23:40:59 2010 > -@@ -192,8 +192,12 @@ extern RETGETPAGESIZETYPE getpagesize (); > +--- trampoline/trampoline.c.orig Mon Jan 26 16:02:10 2004 > ++++ trampoline/trampoline.c Wed Jan 15 08:53:57 2014 > +@@ -192,12 +192,16 @@ extern RETGETPAGESIZETYPE getpagesize (); > #ifdef linux > #include <asm/cachectl.h> > #else > @@ -10,7 +10,29 @@ $OpenBSD: patch-trampoline_trampoline_c, > +#else > #ifdef HAVE_SYS_CACHECTL_H > #include <sys/cachectl.h> > + #endif > + #endif > + #endif > + #endif > +#endif > + #ifdef __m88k__ > + #include <sys/syslocal.h> > + #endif > +@@ -238,7 +242,7 @@ extern void __TR_clear_cache(); > + #define TRAMP_LENGTH 18 > + #define TRAMP_ALIGN 16 > #endif > +-#if defined(__mips__) && !defined(__mipsn32__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) > + #define TRAMP_LENGTH 32 > + #define TRAMP_ALIGN 4 > #endif > +@@ -435,7 +439,7 @@ __TR_function alloc_trampoline (address, variable, dat > + #define tramp_data(function) \ > + *(long *) (function + 2) > #endif > +-#if defined(__mips__) && !defined(__mipsn32__) > ++#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) > + /* function: > + * li $2,<data>&0xffff0000 3C 02 hi16(<data>) > + * ori $2,$2,<data>&0xffff 34 42 lo16(<data>) > -- James Turner