--- configure.ac.orig 2009-06-19 19:52:36.000000000 +0200 +++ configure.ac 2009-06-19 19:52:43.000000000 +0200 @@ -100,10 +100,10 @@ case "$host" in ;; mips-sgi-irix5.* | mips-sgi-irix6.*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_IRIX; TARGETDIR=mips ;; mips*-*-linux*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_LINUX; TARGETDIR=mips ;; powerpc*-*-linux* | powerpc-*-sysv*) @@ -156,7 +156,8 @@ if test $TARGETDIR = unknown; then AC_MSG_ERROR(["libffi has not been ported to $host."]) fi -AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) +AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS_IRIX) +AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS_LINUX) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) --- configure.orig 2009-06-19 19:52:36.000000000 +0200 +++ configure 2009-06-19 19:52:43.000000000 +0200 @@ -21015,10 +21015,10 @@ case "$host" in ;; mips-sgi-irix5.* | mips-sgi-irix6.*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_IRIX; TARGETDIR=mips ;; mips*-*-linux*) - TARGET=MIPS; TARGETDIR=mips + TARGET=MIPS_LINUX; TARGETDIR=mips ;; powerpc*-*-linux* | powerpc-*-sysv*) @@ -21073,7 +21073,15 @@ echo "$as_me: error: \"libffi has not be { (exit 1); exit 1; }; } fi - if test x$TARGET = xMIPS; then + if test x$TARGET = xMIPS_IRIX; then + MIPS_TRUE= + MIPS_FALSE='#' +else + MIPS_TRUE='#' + MIPS_FALSE= +fi + + if test x$TARGET = xMIPS_LINUX; then MIPS_TRUE= MIPS_FALSE='#' else --- src/mips/n32.S.orig 2009-09-25 10:25:10.835555720 +0100 +++ src/mips/n32.S 2009-09-25 10:26:46.016867360 +0100 @@ -40,7 +40,7 @@ #define SIZEOF_FRAME ( 8 * FFI_SIZEOF_ARG ) - .abicalls +/* .abicalls */ .text .align 2 .globl ffi_call_N32 @@ -474,7 +474,7 @@ cls_epilogue: .LFE2: .end ffi_closure_N32 - .section .eh_frame,"aw",@progbits +/* .section .eh_frame,"aw",@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # length .LSCIE1: @@ -530,5 +530,6 @@ cls_epilogue: .uleb128 (SIZEOF_FRAME2 - RA_OFF2)/4 .align EH_FRAME_ALIGN .LEFDE3: +*/ #endif --- src/mips/ffitarget.h.orig 2009-06-19 19:52:37.000000000 +0200 +++ src/mips/ffitarget.h 2009-06-19 19:52:43.000000000 +0200 @@ -27,8 +27,13 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H -#ifdef linux -#include +#if defined(linux) || defined (__sgi) +# ifdef linux +# include +# endif +# ifdef __sgi +# include +# endif # ifndef _ABIN32 # define _ABIN32 _MIPS_SIM_NABI32 # endif @@ -41,7 +46,7 @@ #endif #if !defined(_MIPS_SIM) --- something is very wrong -- +# error -- something is very wrong -- #else # if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64)) # define FFI_MIPS_N32 @@ -49,7 +54,7 @@ # if (_MIPS_SIM==_ABIO32 && defined(_ABIO32)) # define FFI_MIPS_O32 # else --- this is an unsupported platform -- +# error -- this is an unsupported platform -- # endif # endif #endif @@ -145,14 +150,26 @@ # endif /* _MIPS_SIM==_ABI64 */ #endif /* !FFI_MIPS_O32 */ #else /* !LIBFFI_ASM */ -#ifdef FFI_MIPS_O32 +#ifdef __GNUC__ +# ifdef FFI_MIPS_O32 /* O32 stack frames have 32bit integer args */ typedef unsigned int ffi_arg __attribute__((__mode__(__SI__))); typedef signed int ffi_sarg __attribute__((__mode__(__SI__))); -#else +# else /* N32 and N64 frames have 64bit integer args */ typedef unsigned int ffi_arg __attribute__((__mode__(__DI__))); typedef signed int ffi_sarg __attribute__((__mode__(__DI__))); +# endif +#else +# ifdef FFI_MIPS_O32 +/* O32 stack frames have 32bit integer args */ +typedef __uint32_t ffi_arg; +typedef __int32_t ffi_sarg; +# else +/* N32 and N64 frames have 64bit integer args */ +typedef __uint64_t ffi_arg; +typedef __int64_t ffi_sarg; +# endif #endif typedef enum ffi_abi { --- include/ffi.h.in.orig 2009-06-19 19:52:36.000000000 +0200 +++ include/ffi.h.in 2009-06-19 19:52:43.000000000 +0200 @@ -249,12 +249,22 @@ size_t ffi_java_raw_size (ffi_cif *cif); #if FFI_CLOSURES +#ifdef __sgi +# pragma pack 8 +#endif typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; void (*fun)(ffi_cif*,void*,void**,void*); void *user_data; +#ifdef __GNUC__ } ffi_closure __attribute__((aligned (8))); +#else +} ffi_closure; +# ifdef __sgi +# pragma pack 0 +# endif +#endif void *ffi_closure_alloc (size_t size, void **code); void ffi_closure_free (void *); --- include/ffi_common.h.orig 2009-06-19 19:52:36.000000000 +0200 +++ include/ffi_common.h 2009-06-19 19:53:26.000000000 +0200 @@ -44,6 +44,14 @@ char *alloca (); # endif #endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_SYS_TYPES_H +# include +# endif +#endif + #if defined(FFI_DEBUG) #include #endif @@ -77,6 +85,7 @@ typedef struct } extended_cif; /* Terse sized type definitions. */ +#if defined(__GNUC__) typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); typedef signed int SINT8 __attribute__((__mode__(__QI__))); typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); @@ -85,6 +94,16 @@ typedef unsigned int UINT32 __attribute_ typedef signed int SINT32 __attribute__((__mode__(__SI__))); typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); typedef signed int SINT64 __attribute__((__mode__(__DI__))); +#else +typedef uint8_t UINT8; +typedef int8_t SINT8; +typedef uint16_t UINT16; +typedef int16_t SINT16; +typedef uint32_t UINT32; +typedef int32_t SINT32; +typedef uint64_t UINT64; +typedef int64_t SINT64; +#endif typedef float FLOAT32; --- src/java_raw_api.c.dist 2009-09-29 11:04:56.517219880 +0100 +++ src/java_raw_api.c 2009-09-29 11:05:56.836581720 +0100 @@ -314,7 +314,7 @@ ffi_java_translate_args (ffi_cif *cif, v ffi_raw_closure *cl = (ffi_raw_closure*)user_data; ffi_java_ptrarray_to_raw (cif, avalue, raw); - (*cl->fun) (cif, rvalue, raw, cl->user_data); + (*cl->fun) (cif, rvalue, (ffi_raw*)raw, cl->user_data); ffi_java_raw_to_rvalue (cif, rvalue); }