# # configure.ac # Add support for UnixWare # # include/ffi.h.in # include/ffi_common.h # src/x86/ffitarget.h # src/x86/ffi.c # src/x86/sysv.S # fixes for usl compilers # # m4/ax_compiler_vendor.m4 # add support for usl compilers # --- libffi-3.0.13/configure.ac.old 2013-03-17 15:36:15.000000000 -0700 +++ libffi-3.0.13/configure.ac 2013-03-17 15:36:15.000000000 -0700 @@ -146,6 +146,10 @@ fi ;; + i?86-*-sysv5*) + TARGET=X86; TARGETDIR=x86 + ;; + x86_64-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; --- libffi-3.0.13/src/x86/ffitarget.h.old 2013-03-16 04:19:39.000000000 -0700 +++ libffi-3.0.13/src/x86/ffitarget.h 2013-06-02 17:36:03.508875008 -0700 @@ -39,6 +39,10 @@ /* For code common to all platforms on x86 and x86_64. */ #define X86_ANY +#if defined(__USLC__) && !defined(__i386__) +#define __i386__ +#endif + #if defined (X86_64) && defined (__i386__) #undef X86_64 #define X86 --- libffi-3.0.13/include/ffi.h.in.old 2013-03-16 04:19:39.000000000 -0700 +++ libffi-3.0.13/include/ffi.h.in 2013-06-02 17:36:03.508875023 -0700 @@ -103,6 +103,9 @@ # undef FFI_64_BIT_MAX # define FFI_64_BIT_MAX 9223372036854775807LL # endif +# ifdef __USLC__ +# define FFI_LONG_LONG_MAX FFI_64_BIT_MAX +# endif # endif #endif --- libffi-3.0.13/include/ffi_common.h.old 2013-03-16 04:19:39.000000000 -0700 +++ libffi-3.0.13/include/ffi_common.h 2013-06-02 17:52:05.878155002 -0700 @@ -87,7 +87,7 @@ } extended_cif; /* Terse sized type definitions. */ -#if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C) +#if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C) || defined(__USLC__) typedef unsigned char UINT8; typedef signed char SINT8; typedef unsigned short UINT16; --- libffi-3.0.13/src/x86/ffi.c.old 2013-03-16 04:25:04.000000000 -0700 +++ libffi-3.0.13/src/x86/ffi.c 2013-06-02 17:36:03.508875062 -0700 @@ -425,6 +425,11 @@ on MSVC or SUNPRO_C -- standard conventions apply. */ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, void** args, ffi_cif* cif); +#if defined(__USLC__) +void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *); +unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *); +void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *); +#else void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) __attribute__ ((regparm(1))); unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *) @@ -439,6 +444,7 @@ void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *) __attribute__ ((regparm(1))); #endif +#endif #ifdef X86_WIN64 void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); #endif @@ -475,7 +481,11 @@ } #else +# if defined(__USLC__) +unsigned int FFI_HIDDEN +# else unsigned int FFI_HIDDEN __attribute__ ((regparm(1))) +# endif ffi_closure_SYSV_inner (ffi_closure *closure, void **respp, void *args) { /* our various things... */ --- libffi-3.0.13/src/x86/sysv.S.old 2013-03-16 04:19:39.000000000 -0700 +++ libffi-3.0.13/src/x86/sysv.S 2013-06-03 09:06:14.929915003 -0700 @@ -72,7 +72,7 @@ /* If the return value pointer is NULL, assume no return value. */ cmpl $0,24(%ebp) - jne 0f + jne .L900 /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ @@ -82,8 +82,8 @@ jmp epilogue -0: - call 1f +.L900: + call .L901 .Lstore_table: .long noretval-.Lstore_table /* FFI_TYPE_VOID */ @@ -102,7 +102,7 @@ .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ .long retint-.Lstore_table /* FFI_TYPE_POINTER */ -1: +.L901: pop %esi add (%esi, %ecx, 4), %esi jmp *%esi @@ -182,7 +182,7 @@ leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx -#ifdef __SUNPRO_C +#if defined(__SUNPRO_C) || defined(__USLC__) /* The SUNPRO compiler doesn't support GCC's regparm function attribute, so we have to pass all three arguments to ffi_closure_SYSV_inner on the stack. */ @@ -200,9 +200,9 @@ #else movl %ebx, 8(%esp) .LCFI7: - call 1f -1: popl %ebx - addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx + call .L911 +.L911: popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.L911], %ebx call ffi_closure_SYSV_inner@PLT movl 8(%esp), %ebx #endif @@ -213,11 +213,11 @@ /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax - jge 0f + jge .L910 cmpl $FFI_TYPE_UINT8, %eax jge .Lcls_retint -0: cmpl $FFI_TYPE_FLOAT, %eax +.L910: cmpl $FFI_TYPE_FLOAT, %eax je .Lcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lcls_retdouble @@ -302,10 +302,10 @@ /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax - jge 0f + jge .L920 cmpl $FFI_TYPE_UINT8, %eax jge .Lrcls_retint -0: +.L920: cmpl $FFI_TYPE_FLOAT, %eax je .Lrcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax --- libffi-3.0.13/m4/ax_compiler_vendor.m4.old 2013-03-16 04:19:39.000000000 -0700 +++ libffi-3.0.13/m4/ax_compiler_vendor.m4 2013-03-16 04:19:39.000000000 -0700 @@ -44,7 +44,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 11 +#serial 12 AC_DEFUN([AX_COMPILER_VENDOR], [AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, @@ -67,6 +67,7 @@ metrowerks: __MWERKS__ watcom: __WATCOMC__ portland: __PGI + usl: __USLC__,__SCO_VERSION__ unknown: UNKNOWN" for ventest in $vendors; do case $ventest in