Commits

Ronald Oussoren committed 976139e

- Remove libffi code for platforms that we don't support, that is anything
but x86* and ppc*
- Partial merge with the copy of libffi that is used by ctypes. I haven't
merged x86 support but kept our copy of that, the version of libffi used
by ctypes is different enough from our copy that merging my darwin/x86 patches
into that version of ffi.c would be more work that I want to do right now.

Comments (0)

Files changed (55)

libffi-src/include/fficonfig.h

 /* Version number of package */
 #define VERSION "2.1-pyobjc"
 
+#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
+#ifdef LIBFFI_ASM
+#define FFI_HIDDEN(name) .hidden name
+#else
+#define FFI_HIDDEN __attribute__ ((visibility ("hidden")))
+#endif
+#else
+#ifdef LIBFFI_ASM
+#define FFI_HIDDEN(name)
+#else
+#define FFI_HIDDEN
+#endif
+#endif
+

libffi-src/src/alpha/ffi.c

-/* -----------------------------------------------------------------------
-   ffi.c - Copyright (c) 1998, 2001 Red Hat, Inc.
-   
-   Alpha Foreign Function Interface 
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-   ----------------------------------------------------------------------- */
-
-#include <ffi.h>
-#include <ffi_common.h>
-
-#include <stdlib.h>
-
-extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)());
-extern void ffi_closure_osf(void);
-
-
-ffi_status
-ffi_prep_cif_machdep(ffi_cif *cif)
-{
-  /* Adjust cif->bytes to represent a minimum 6 words for the temporary
-     register argument loading area.  */
-  if (cif->bytes < 6*FFI_SIZEOF_ARG)
-    cif->bytes = 6*FFI_SIZEOF_ARG;
-
-  /* Set the return type flag */
-  switch (cif->rtype->type)
-    {
-    case FFI_TYPE_STRUCT:
-    case FFI_TYPE_FLOAT:
-    case FFI_TYPE_DOUBLE:
-      cif->flags = cif->rtype->type;
-      break;
-
-    default:
-      cif->flags = FFI_TYPE_INT;
-      break;
-    }
-  
-  return FFI_OK;
-}
-
-void
-ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
-{
-  unsigned long *stack, *argp;
-  long i, avn;
-  ffi_type **arg_types;
-  
-  FFI_ASSERT (cif->abi == FFI_OSF);
-
-  /* If the return value is a struct and we don't have a return
-     value address then we need to make one.  */
-  if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT)
-    rvalue = alloca(cif->rtype->size);
-
-  /* Allocate the space for the arguments, plus 4 words of temp
-     space for ffi_call_osf.  */
-  argp = stack = alloca(cif->bytes + 4*FFI_SIZEOF_ARG);
-
-  if (cif->flags == FFI_TYPE_STRUCT)
-    *(void **) argp++ = rvalue;
-
-  i = 0;
-  avn = cif->nargs;
-  arg_types = cif->arg_types;
-
-  while (i < avn)
-    {
-      switch ((*arg_types)->type)
-	{
-	case FFI_TYPE_SINT8:
-	  *(SINT64 *) argp = *(SINT8 *)(* avalue);
-	  break;
-		  
-	case FFI_TYPE_UINT8:
-	  *(SINT64 *) argp = *(UINT8 *)(* avalue);
-	  break;
-		  
-	case FFI_TYPE_SINT16:
-	  *(SINT64 *) argp = *(SINT16 *)(* avalue);
-	  break;
-		  
-	case FFI_TYPE_UINT16:
-	  *(SINT64 *) argp = *(UINT16 *)(* avalue);
-	  break;
-		  
-	case FFI_TYPE_SINT32:
-	case FFI_TYPE_UINT32:
-	  /* Note that unsigned 32-bit quantities are sign extended.  */
-	  *(SINT64 *) argp = *(SINT32 *)(* avalue);
-	  break;
-		  
-	case FFI_TYPE_SINT64:
-	case FFI_TYPE_UINT64:
-	case FFI_TYPE_POINTER:
-	  *(UINT64 *) argp = *(UINT64 *)(* avalue);
-	  break;
-
-	case FFI_TYPE_FLOAT:
-	  if (argp - stack < 6)
-	    {
-	      /* Note the conversion -- all the fp regs are loaded as
-		 doubles.  The in-register format is the same.  */
-	      *(double *) argp = *(float *)(* avalue);
-	    }
-	  else
-	    *(float *) argp = *(float *)(* avalue);
-	  break;
-
-	case FFI_TYPE_DOUBLE:
-	  *(double *) argp = *(double *)(* avalue);
-	  break;
-
-	case FFI_TYPE_STRUCT:
-	  memcpy(argp, *avalue, (*arg_types)->size);
-	  break;
-
-	default:
-	  FFI_ASSERT(0);
-	}
-
-      argp += ALIGN((*arg_types)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
-      i++, arg_types++, avalue++;
-    }
-
-  ffi_call_osf(stack, cif->bytes, cif->flags, rvalue, fn);
-}
-
-
-ffi_status
-ffi_prep_closure (ffi_closure* closure,
-		  ffi_cif* cif,
-		  void (*fun)(ffi_cif*, void*, void**, void*),
-		  void *user_data)
-{
-  unsigned int *tramp;
-
-  FFI_ASSERT (cif->abi == FFI_OSF);
-
-  tramp = (unsigned int *) &closure->tramp[0];
-  tramp[0] = 0x47fb0401;	/* mov $27,$1		*/
-  tramp[1] = 0xa77b0010;	/* ldq $27,16($27)	*/
-  tramp[2] = 0x6bfb0000;	/* jmp $31,($27),0	*/
-  tramp[3] = 0x47ff041f;	/* nop			*/
-  *(void **) &tramp[4] = ffi_closure_osf;
-
-  closure->cif = cif;
-  closure->fun = fun;
-  closure->user_data = user_data;
-
-  /* Flush the Icache.
-
-     Tru64 UNIX as doesn't understand the imb mnemonic, so use call_pal
-     instead, since both Compaq as and gas can handle it.
-
-     0x86 is PAL_imb in Tru64 UNIX <alpha/pal.h>.  */
-  asm volatile ("call_pal 0x86" : : : "memory");
-
-  return FFI_OK;
-}
-
-int
-ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp)
-{
-  ffi_cif *cif;
-  void **avalue;
-  ffi_type **arg_types;
-  long i, avn, argn;
-
-  cif = closure->cif;
-  avalue = alloca(cif->nargs * sizeof(void *));
-
-  argn = 0;
-
-  /* Copy the caller's structure return address to that the closure
-     returns the data directly to the caller.  */
-  if (cif->flags == FFI_TYPE_STRUCT)
-    {
-      rvalue = (void *) argp[0];
-      argn = 1;
-    }
-
-  i = 0;
-  avn = cif->nargs;
-  arg_types = cif->arg_types;
-  
-  /* Grab the addresses of the arguments from the stack frame.  */
-  while (i < avn)
-    {
-      switch (arg_types[i]->type)
-	{
-	case FFI_TYPE_SINT8:
-	case FFI_TYPE_UINT8:
-	case FFI_TYPE_SINT16:
-	case FFI_TYPE_UINT16:
-	case FFI_TYPE_SINT32:
-	case FFI_TYPE_UINT32:
-	case FFI_TYPE_SINT64:
-	case FFI_TYPE_UINT64:
-	case FFI_TYPE_POINTER:
-	case FFI_TYPE_STRUCT:
-	  avalue[i] = &argp[argn];
-	  break;
-
-	case FFI_TYPE_FLOAT:
-	  if (argn < 6)
-	    {
-	      /* Floats coming from registers need conversion from double
-	         back to float format.  */
-	      *(float *)&argp[argn - 6] = *(double *)&argp[argn - 6];
-	      avalue[i] = &argp[argn - 6];
-	    }
-	  else
-	    avalue[i] = &argp[argn];
-	  break;
-
-	case FFI_TYPE_DOUBLE:
-	  avalue[i] = &argp[argn - (argn < 6 ? 6 : 0)];
-	  break;
-
-	default:
-	  FFI_ASSERT(0);
-	}
-
-      argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
-      i++;
-    }
-
-  /* Invoke the closure.  */
-  (closure->fun) (cif, rvalue, avalue, closure->user_data);
-
-  /* Tell ffi_closure_osf how to perform return type promotions.  */
-  return cif->rtype->type;
-}

libffi-src/src/alpha/ffitarget.h

-/* -----------------------------------------------------------------*-C-*-
-   ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
-   Target configuration macros for Alpha.
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-
-   ----------------------------------------------------------------------- */
-
-#ifndef LIBFFI_TARGET_H
-#define LIBFFI_TARGET_H
-
-#ifndef LIBFFI_ASM
-typedef unsigned long          ffi_arg;
-typedef signed long            ffi_sarg;
-
-typedef enum ffi_abi {
-  FFI_FIRST_ABI = 0,
-  FFI_OSF,
-  FFI_DEFAULT_ABI = FFI_OSF,
-  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
-} ffi_abi;
-#endif
-
-/* ---- Definitions for closures ----------------------------------------- */
-
-#define FFI_CLOSURES 1
-#define FFI_TRAMPOLINE_SIZE 24
-#define FFI_NATIVE_RAW_API 0
-
-#endif
-

libffi-src/src/alpha/osf.S

-/* -----------------------------------------------------------------------
-   osf.S - Copyright (c) 1998, 2001 Red Hat
-   
-   Alpha/OSF Foreign Function Interface 
-
-   $Id: osf.S,v 1.1.1.1 1998/11/29 16:48:16 green Exp $
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-   ----------------------------------------------------------------------- */
-
-#define LIBFFI_ASM	
-#include <fficonfig.h>
-#include <ffi.h>
-
-	.arch ev6
-	.text
-
-/* ffi_call_osf (void *args, unsigned long bytes, unsigned flags,
-		 void *raddr, void (*fnaddr)());
-
-   Bit o trickiness here -- ARGS+BYTES is the base of the stack frame
-   for this function.  This has been allocated by ffi_call.  We also
-   deallocate some of the stack that has been alloca'd.  */
-
-	.align	3
-	.globl	ffi_call_osf
-	.ent	ffi_call_osf
-ffi_call_osf:
-	.frame	$15, 32, $26, 0
-	.mask   0x4008000, -32
-$LFB1:
-	addq	$16,$17,$1
-	mov	$16, $30
-	stq	$26, 0($1)
-$LCFI0:
-	stq	$15, 8($1)
-$LCFI1:
-	stq	$18, 16($1)
-	mov	$1, $15
-$LCFI2:
-	.prologue 0
-
-	stq	$19, 24($1)
-	mov	$20, $27
-
-	# Load up all of the (potential) argument registers.
-	ldq	$16, 0($30)
-	ldt	$f16, 0($30)
-	ldt	$f17, 8($30)
-	ldq	$17, 8($30)
-	ldt	$f18, 16($30)
-	ldq	$18, 16($30)
-	ldt	$f19, 24($30)
-	ldq	$19, 24($30)
-	ldt	$f20, 32($30)
-	ldq	$20, 32($30)
-	ldt	$f21, 40($30)
-	ldq	$21, 40($30)
-
-	# Deallocate the register argument area.
-	lda	$30, 48($30)
-
-	jsr	$26, ($27), 0
-	ldgp	$29, 0($26)
-
-	# If the return value pointer is NULL, assume no return value.
-	ldq	$19, 24($15)
-	ldq	$18, 16($15)
-	ldq	$26, 0($15)
-	beq	$19, $noretval
-
-	# Store the return value out in the proper type.
-	cmpeq	$18, FFI_TYPE_INT, $1
-	bne	$1, $retint
-	cmpeq	$18, FFI_TYPE_FLOAT, $2
-	bne	$2, $retfloat
-	cmpeq	$18, FFI_TYPE_DOUBLE, $3
-	bne	$3, $retdouble
-
-$noretval:
-	ldq	$15, 8($15)
-	ret
-
-$retint:
-	stq	$0, 0($19)
-	nop
-	ldq	$15, 8($15)
-	ret
-
-$retfloat:
-	sts	$f0, 0($19)
-	nop
-	ldq	$15, 8($15)
-	ret
-
-$retdouble:
-	stt	$f0, 0($19)
-	nop
-	ldq	$15, 8($15)
-	ret
-$LFE1:
-
-	.end	ffi_call_osf
-
-/* ffi_closure_osf(...)
-
-   Receives the closure argument in $1.   */
-
-	.align	3
-	.globl	ffi_closure_osf
-	.ent	ffi_closure_osf
-ffi_closure_osf:
-	.frame	$30, 16*8, $26, 0
-	.mask	0x4000000, -16*8
-$LFB2:
-	ldgp	$29, 0($27)
-	subq	$30, 16*8, $30
-$LCFI5:
-	stq	$26, 0($30)
-$LCFI6:
-	.prologue 1
-
-	# Store all of the potential argument registers in va_list format.
-	stt	$f16, 4*8($30)
-	stt	$f17, 5*8($30)
-	stt	$f18, 6*8($30)
-	stt	$f19, 7*8($30)
-	stt	$f20, 8*8($30)
-	stt	$f21, 9*8($30)
-	stq	$16, 10*8($30)
-	stq	$17, 11*8($30)
-	stq	$18, 12*8($30)
-	stq	$19, 13*8($30)
-	stq	$20, 14*8($30)
-	stq	$21, 15*8($30)
-
-	# Call ffi_closure_osf_inner to do the bulk of the work.
-	mov	$1, $16
-	lda	$17, 2*8($30)
-	lda	$18, 10*8($30)
-	jsr	$26, ffi_closure_osf_inner
-	ldgp	$29, 0($26)
-	ldq	$26, 0($30)
-
-	# Load up the return value in the proper type.
-	lda	$1, $load_table
-	s4addq	$0, $1, $1
-	ldl	$1, 0($1)
-	addq	$1, $29, $1
-	jmp	$31, ($1), $load_32
-
-	.align 4
-$load_none:
-	addq	$30, 16*8, $30
-	ret
-
-	.align 4
-$load_float:
-	lds	$f0, 16($30)
-	nop
-	addq	$30, 16*8, $30
-	ret
-
-	.align 4
-$load_double:
-	ldt	$f0, 16($30)
-	nop
-	addq	$30, 16*8, $30
-	ret
-
-	.align 4
-$load_u8:
-#ifdef __alpha_bwx__
-	ldbu	$0, 16($30)
-	nop
-#else
-	ldq	$0, 16($30)
-	and	$0, 255, $0
-#endif
-	addq	$30, 16*8, $30
-	ret
-
-	.align 4
-$load_s8:
-#ifdef __alpha_bwx__
-	ldbu	$0, 16($30)
-	sextb	$0, $0
-#else
-	ldq	$0, 16($30)
-	sll	$0, 56, $0
-	sra	$0, 56, $0
-#endif
-	addq	$30, 16*8, $30
-	ret
-
-	.align 4
-$load_u16:
-#ifdef __alpha_bwx__
-	ldwu	$0, 16($30)
-	nop
-#else
-	ldq	$0, 16($30)
-	zapnot	$0, 3, $0
-#endif
-	addq	$30, 16*8, $30
-	ret
-
-	.align 4
-$load_s16:
-#ifdef __alpha_bwx__
-	ldwu	$0, 16($30)
-	sextw	$0, $0
-#else
-	ldq	$0, 16($30)
-	sll	$0, 48, $0
-	sra	$0, 48, $0
-#endif
-	addq	$30, 16*8, $30
-	ret
-
-	.align 4
-$load_32:
-	ldl	$0, 16($30)
-	nop
-	addq	$30, 16*8, $30
-	ret
-
-	.align 4
-$load_64:
-	ldq	$0, 16($30)
-	nop
-	addq	$30, 16*8, $30
-	ret
-$LFE2:
-
-	.end	ffi_closure_osf
-
-#ifdef __ELF__
-.section .rodata
-#else
-.rdata
-#endif
-$load_table:
-	.gprel32 $load_none	# FFI_TYPE_VOID
-	.gprel32 $load_32	# FFI_TYPE_INT
-	.gprel32 $load_float	# FFI_TYPE_FLOAT
-	.gprel32 $load_double	# FFI_TYPE_DOUBLE
-	.gprel32 $load_double	# FFI_TYPE_LONGDOUBLE
-	.gprel32 $load_u8	# FFI_TYPE_UINT8
-	.gprel32 $load_s8	# FFI_TYPE_SINT8
-	.gprel32 $load_u16	# FFI_TYPE_UINT16
-	.gprel32 $load_s16	# FFI_TYPE_SINT16
-	.gprel32 $load_32	# FFI_TYPE_UINT32
-	.gprel32 $load_32	# FFI_TYPE_SINT32
-	.gprel32 $load_64	# FFI_TYPE_UINT64
-	.gprel32 $load_64	# FFI_TYPE_SINT64
-	.gprel32 $load_none	# FFI_TYPE_STRUCT
-	.gprel32 $load_64	# FFI_TYPE_POINTER
-
-/* Assert that the table above is in sync with ffi.h.  */
-
-#if	   FFI_TYPE_FLOAT != 2		\
-	|| FFI_TYPE_DOUBLE != 3		\
-	|| FFI_TYPE_UINT8 != 5		\
-	|| FFI_TYPE_SINT8 != 6		\
-	|| FFI_TYPE_UINT16 != 7		\
-	|| FFI_TYPE_SINT16 != 8		\
-	|| FFI_TYPE_UINT32 != 9		\
-	|| FFI_TYPE_SINT32 != 10	\
-	|| FFI_TYPE_UINT64 != 11	\
-	|| FFI_TYPE_SINT64 != 12	\
-	|| FFI_TYPE_STRUCT != 13	\
-	|| FFI_TYPE_POINTER != 14	\
-	|| FFI_TYPE_LAST != 14
-#error "osf.S out of sync with ffi.h"
-#endif
-
-#ifdef __ELF__
-	.section	.eh_frame,EH_FRAME_FLAGS,@progbits
-__FRAME_BEGIN__:
-	.4byte	$LECIE1-$LSCIE1	 # Length of Common Information Entry
-$LSCIE1:
-	.4byte	0x0	 # CIE Identifier Tag
-	.byte	0x1	 # CIE Version
-	.ascii "zR\0"	 # CIE Augmentation
-	.byte	0x1	 # uleb128 0x1; CIE Code Alignment Factor
-	.byte	0x78	 # sleb128 -8; CIE Data Alignment Factor
-	.byte	0x1a	 # CIE RA Column
-	.byte	0x1	 # uleb128 0x1; Augmentation size
-	.byte	0x1b	 # FDE Encoding (pcrel sdata4)
-	.byte	0xc	 # DW_CFA_def_cfa
-	.byte	0x1e	 # uleb128 0x1e
-	.byte	0x0	 # uleb128 0x0
-	.align 3
-$LECIE1:
-$LSFDE1:
-	.4byte	$LEFDE1-$LASFDE1	 # FDE Length
-$LASFDE1:
-	.4byte	$LASFDE1-__FRAME_BEGIN__	 # FDE CIE offset
-	.4byte	$LFB1-.	 # FDE initial location
-	.4byte	$LFE1-$LFB1	 # FDE address range
-	.byte	0x0	 # uleb128 0x0; Augmentation size
-	.byte	0x4	 # DW_CFA_advance_loc4
-	.4byte	$LCFI0-$LFB1
-	.byte	0xe	 # DW_CFA_def_cfa_offset
-	.byte	0x30	 # uleb128 0x30
-	.byte	0x4	 # DW_CFA_advance_loc4
-	.4byte	$LCFI1-$LCFI0
-	.byte	0x9a	 # DW_CFA_offset, column 0x1a
-	.byte	0x6	 # uleb128 0x6
-	.byte	0x8f	 # DW_CFA_offset, column 0xf
-	.byte	0x5	 # uleb128 0x5
-	.byte	0x4	 # DW_CFA_advance_loc4
-	.4byte	$LCFI2-$LCFI1
-	.byte	0xc	 # DW_CFA_def_cfa
-	.byte	0xf	 # uleb128 0xf
-	.byte	0x30	 # uleb128 0x30
-	.align 3
-$LEFDE1:
-
-$LSFDE3:
-	.4byte	$LEFDE3-$LASFDE3	 # FDE Length
-$LASFDE3:
-	.4byte	$LASFDE3-__FRAME_BEGIN__	 # FDE CIE offset
-	.4byte	$LFB2-.	 # FDE initial location
-	.4byte	$LFE2-$LFB2	 # FDE address range
-	.byte	0x0	 # uleb128 0x0; Augmentation size
-	.byte	0x4	 # DW_CFA_advance_loc4
-	.4byte	$LCFI5-$LFB2
-	.byte	0xe	 # DW_CFA_def_cfa_offset
-	.byte	0x90,0x1	 # uleb128 0x90
-	.byte	0x4	 # DW_CFA_advance_loc4
-	.4byte	$LCFI6-$LCFI5
-	.byte	0x9a	 # DW_CFA_offset, column 0x1a
-	.byte	0x12	 # uleb128 0x12
-	.align 3
-$LEFDE3:
-#endif

libffi-src/src/arm/ffi.c

-/* -----------------------------------------------------------------------
-   ffi.c - Copyright (c) 1998  Red Hat, Inc.
-   
-   ARM Foreign Function Interface 
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-   ----------------------------------------------------------------------- */
-
-#include <ffi.h>
-#include <ffi_common.h>
-
-#include <stdlib.h>
-
-/* ffi_prep_args is called by the assembly routine once stack space
-   has been allocated for the function's arguments */
-
-/*@-exportheader@*/
-void ffi_prep_args(char *stack, extended_cif *ecif)
-/*@=exportheader@*/
-{
-  register unsigned int i;
-  register void **p_argv;
-  register char *argp;
-  register ffi_type **p_arg;
-
-  argp = stack;
-
-  if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) {
-    *(void **) argp = ecif->rvalue;
-    argp += 4;
-  }
-
-  p_argv = ecif->avalue;
-
-  for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
-       (i != 0);
-       i--, p_arg++)
-    {
-      size_t z;
-
-      /* Align if necessary */
-      if (((*p_arg)->alignment - 1) & (unsigned) argp) {
-	argp = (char *) ALIGN(argp, (*p_arg)->alignment);
-      }
-
-	  z = (*p_arg)->size;
-	  if (z < sizeof(int))
-	    {
-	      z = sizeof(int);
-	      switch ((*p_arg)->type)
-		{
-		case FFI_TYPE_SINT8:
-		  *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
-		  break;
-		  
-		case FFI_TYPE_UINT8:
-		  *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
-		  break;
-		  
-		case FFI_TYPE_SINT16:
-		  *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
-		  break;
-		  
-		case FFI_TYPE_UINT16:
-		  *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
-		  break;
-		  
-		case FFI_TYPE_STRUCT:
-		  *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
-		  break;
-
-		default:
-		  FFI_ASSERT(0);
-		}
-	    }
-	  else if (z == sizeof(int))
-	    {
-	      *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
-	    }
-	  else
-	    {
-	      memcpy(argp, *p_argv, z);
-	    }
-	  p_argv++;
-	  argp += z;
-    }
-  
-  return;
-}
-
-/* Perform machine dependent cif processing */
-ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
-{
-  /* Set the return type flag */
-  switch (cif->rtype->type)
-    {
-    case FFI_TYPE_VOID:
-    case FFI_TYPE_STRUCT:
-    case FFI_TYPE_FLOAT:
-    case FFI_TYPE_DOUBLE:
-      cif->flags = (unsigned) cif->rtype->type;
-      break;
-
-    default:
-      cif->flags = FFI_TYPE_INT;
-      break;
-    }
-
-  return FFI_OK;
-}
-
-/*@-declundef@*/
-/*@-exportheader@*/
-extern void ffi_call_SYSV(void (*)(char *, extended_cif *), 
-			  /*@out@*/ extended_cif *, 
-			  unsigned, unsigned, 
-			  /*@out@*/ unsigned *, 
-			  void (*fn)());
-/*@=declundef@*/
-/*@=exportheader@*/
-
-void ffi_call(/*@dependent@*/ ffi_cif *cif, 
-	      void (*fn)(), 
-	      /*@out@*/ void *rvalue, 
-	      /*@dependent@*/ void **avalue)
-{
-  extended_cif ecif;
-
-  ecif.cif = cif;
-  ecif.avalue = avalue;
-  
-  /* If the return value is a struct and we don't have a return	*/
-  /* value address then we need to make one		        */
-
-  if ((rvalue == NULL) && 
-      (cif->rtype->type == FFI_TYPE_STRUCT))
-    {
-      /*@-sysunrecog@*/
-      ecif.rvalue = alloca(cif->rtype->size);
-      /*@=sysunrecog@*/
-    }
-  else
-    ecif.rvalue = rvalue;
-    
-  
-  switch (cif->abi) 
-    {
-    case FFI_SYSV:
-      /*@-usedef@*/
-      ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, 
-		    cif->flags, ecif.rvalue, fn);
-      /*@=usedef@*/
-      break;
-    default:
-      FFI_ASSERT(0);
-      break;
-    }
-}

libffi-src/src/arm/ffitarget.h

-/* -----------------------------------------------------------------*-C-*-
-   ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
-   Target configuration macros for ARM.
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-
-   ----------------------------------------------------------------------- */
-
-#ifndef LIBFFI_TARGET_H
-#define LIBFFI_TARGET_H
-
-#ifndef LIBFFI_ASM
-typedef unsigned long          ffi_arg;
-typedef signed long            ffi_sarg;
-
-typedef enum ffi_abi {
-  FFI_FIRST_ABI = 0,
-  FFI_SYSV,
-  FFI_DEFAULT_ABI = FFI_SYSV,
-  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
-} ffi_abi;
-#endif
-
-/* ---- Definitions for closures ----------------------------------------- */
-
-#define FFI_CLOSURES 0
-#define FFI_NATIVE_RAW_API 0
-
-#endif
-

libffi-src/src/arm/sysv.S

-/* -----------------------------------------------------------------------
-   sysv.S - Copyright (c) 1998 Red Hat, Inc.
-   
-   ARM Foreign Function Interface 
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-   ----------------------------------------------------------------------- */
-
-#define LIBFFI_ASM	
-#include <fficonfig.h>
-#include <ffi.h>
-#ifdef HAVE_MACHINE_ASM_H
-#include <machine/asm.h>
-#else
-#ifdef __USER_LABEL_PREFIX__
-#define CONCAT1(a, b) CONCAT2(a, b)
-#define CONCAT2(a, b) a ## b
-
-/* Use the right prefix for global labels.  */
-#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
-#else
-#define CNAME(x) x
-#endif
-#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x):
-#endif
-	
-.text
-
-	# a1:   ffi_prep_args
-	# a2:   &ecif
-	# a3:   cif->bytes
-	# a4:   fig->flags
-	# sp+0: ecif.rvalue
-	# sp+4: fn
-
-	# This assumes we are using gas.
-ENTRY(ffi_call_SYSV)
-	# Save registers
-        stmfd sp!, {a1-a4, fp, lr}
-	mov   fp, sp
-
-	# Make room for all of the new args.
-	sub   sp, fp, a3
-
-	# Place all of the ffi_prep_args in position
-	mov   ip, a1
-	mov   a1, sp
-	#     a2 already set
-
-	# And call
-	mov   lr, pc
-	mov   pc, ip
-
-	# move first 4 parameters in registers
-	ldr   a1, [sp, #0]
-	ldr   a2, [sp, #4]
-	ldr   a3, [sp, #8]
-        ldr   a4, [sp, #12]
-
-	# and adjust stack
-	ldr   ip, [fp, #8]
-        cmp   ip, #16
-	movge ip, #16
-        add   sp, sp, ip
-
-	# call function
-	mov   lr, pc
-	ldr   pc, [fp, #28]
-
-	# Remove the space we pushed for the args
-	mov   sp, fp
-
-	# Load a3 with the pointer to storage for the return value
-	ldr   a3, [sp, #24]
-
-	# Load a4 with the return type code 
-	ldr   a4, [sp, #12]
-
-	# If the return value pointer is NULL, assume no return value.
-	cmp   a3, #0
-	beq   epilogue
-
-# return INT
-	cmp   a4, #FFI_TYPE_INT
-	streq a1, [a3]
-	beq   epilogue
-
-# return FLOAT
-	cmp     a4, #FFI_TYPE_FLOAT
-#ifdef __SOFTFP__
-	streq	a1, [a3]
-#else
-	stfeqs  f0, [a3]
-#endif
-	beq     epilogue
-
-# return DOUBLE or LONGDOUBLE
-	cmp     a4, #FFI_TYPE_DOUBLE
-#ifdef __SOFTFP__
-	stmeqia	a3, {a1, a2}
-#else
-	stfeqd  f0, [a3]
-#endif
-
-epilogue:
-        ldmfd sp!, {a1-a4, fp, pc}
-
-.ffi_call_SYSV_end:
-        .size    CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
-

libffi-src/src/debug.c

-/* -----------------------------------------------------------------------
-   debug.c - Copyright (c) 1996 Red Hat, Inc.
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-   ----------------------------------------------------------------------- */
-
-#include <ffi.h>
-#include <ffi_common.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/* General debugging routines */
-
-void ffi_stop_here(void)
-{
-  /* This function is only useful for debugging purposes.
-     Place a breakpoint on ffi_stop_here to be notified of 
-     significant events. */
-}
-
-/* This function should only be called via the FFI_ASSERT() macro */
-
-void ffi_assert(char *expr, char *file, int line)
-{
-  fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line);
-  ffi_stop_here();
-  abort();
-}
-
-/* Perform a sanity check on an ffi_type structure */
-
-void ffi_type_test(ffi_type *a, char *file, int line)
-{
-  FFI_ASSERT_AT(a != NULL, file, line);
-
-  /*@-usedef@*/
-  FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line);
-  FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line);
-  FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line);
-  FFI_ASSERT_AT(a->type != FFI_TYPE_STRUCT || a->elements != NULL, file, line);
-  /*@=usedef@*/
-}

libffi-src/src/ffitest.c

-/* -----------------------------------------------------------------------
-   ffitest.c - Copyright (c) 1996, 1997, 1998, 2002, 2003  Red Hat, Inc.
-
-   Permission is hereby granted, free of charge, to any person obtaining
-   a copy of this software and associated documentation files (the
-   ``Software''), to deal in the Software without restriction, including
-   without limitation the rights to use, copy, modify, merge, publish,
-   distribute, sublicense, and/or sell copies of the Software, and to
-   permit persons to whom the Software is furnished to do so, subject to
-   the following conditions:
-
-   The above copyright notice and this permission notice shall be included
-   in all copies or substantial portions of the Software.
-
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
-   ----------------------------------------------------------------------- */
-
-#include <ffi.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <float.h>
-
-/* This is lame. Long double support is barely there under SunOS 4.x  */
-#if defined(SPARC) && (SIZEOF_LONG_DOUBLE != 16)
-#define BROKEN_LONG_DOUBLE
-#endif
-
-#define CHECK(x) !(x) ? fail(__FILE__, __LINE__) : 0 
-
-static int fail(char *file, int line)
-{
-  fprintf(stderr, "Test failure: %s line %d\n", file, line);
-  exit(EXIT_FAILURE);
-  /*@notreached@*/
-  return 0;
-}
-
-#define MAX_ARGS 256
-
-static size_t my_strlen(char *s)
-{
-  return (strlen(s));
-}
-
-#ifdef X86_WIN32
-static size_t __attribute__((stdcall)) my_stdcall_strlen(char *s)
-{
-  return (strlen(s));
-}
-#endif /* X86_WIN32 */
-
-static int promotion(signed char sc, signed short ss, 
-		     unsigned char uc, unsigned short us)
-{
-  int r = (int) sc + (int) ss + (int) uc + (int) us;
-
-  return r;
-}
-
-static signed char return_sc(signed char sc)
-{
-  return sc;
-}
-
-static unsigned char return_uc(unsigned char uc)
-{
-  return uc;
-}
-
-static long long return_ll(long long ll)
-{
-  return ll;
-}
-
-static int floating(int a, float b, double c, long double d, int e)
-{
-  int i;
-
-#if 0
-  /* This is ifdef'd out for now. long double support under SunOS/gcc
-     is pretty much non-existent.  You'll get the odd bus error in library
-     routines like printf().  */
-  printf("%d %f %f %Lf %d\n", a, (double)b, c, d, e);
-#endif
-
-  i = (int) ((float)a/b + ((float)c/(float)d));
-
-  return i;
-}
-
-static float many(float f1,
-		  float f2,
-		  float f3,
-		  float f4,
-		  float f5,
-		  float f6,
-		  float f7,
-		  float f8,
-		  float f9,
-		  float f10,
-		  float f11,
-		  float f12,
-		  float f13)
-{
-#if 0
-  printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n",
-	 (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, 
-	 (double) f6, (double) f7, (double) f8, (double) f9, (double) f10,
-	 (double) f11, (double) f12, (double) f13);
-#endif
-
-  return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13);
-}
-
-#ifdef X86_WIN32
-static float __attribute__((stdcall)) stdcall_many(float f1,
-						   float f2,
-						   float f3,
-						   float f4,
-						   float f5,
-						   float f6,
-						   float f7,
-						   float f8,
-						   float f9,
-						   float f10,
-						   float f11,
-						   float f12,
-						   float f13)
-{
-  return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13);
-}
-#endif /* X86_WIN32 */
-
-static double dblit(float f)
-{
-  return f/3.0;
-}
-
-static long double ldblit(float f)
-{
-  return (long double) (((long double) f)/ (long double) 3.0);
-}
-
-typedef struct
-{
-  unsigned char uc;
-  double d;
-  unsigned int ui;
-} test_structure_1;
-
-typedef struct
-{
-  double d1;
-  double d2;
-} test_structure_2;
-
-typedef struct
-{
-  int si;
-} test_structure_3;
-
-typedef struct
-{
-  unsigned ui1;
-  unsigned ui2;
-  unsigned ui3;
-} test_structure_4;
-
-typedef struct
-{
-  char c1;
-  char c2;
-} test_structure_5;
-
-typedef struct
-{
-  float f;
-  double d;
-} test_structure_6;
-
-typedef struct
-{
-  float f1;
-  float f2;
-  double d;
-} test_structure_7;
-
-typedef struct
-{
-  float f1;
-  float f2;
-  float f3;
-  float f4;
-} test_structure_8;
-
-typedef struct
-{
-  float f;
-  int i;
-} test_structure_9;
-
-static test_structure_1 struct1(test_structure_1 ts)
-{
-  /*@-type@*/
-  ts.uc++;
-  /*@=type@*/
-  ts.d--;
-  ts.ui++;
-
-  return ts;
-}
-
-static test_structure_2 struct2(test_structure_2 ts)
-{
-  ts.d1--;
-  ts.d2--;
-
-  return ts;
-}
-
-static test_structure_3 struct3(test_structure_3 ts)
-{
-  ts.si = -(ts.si*2);
-
-  return ts;
-}
-
-static test_structure_4 struct4(test_structure_4 ts)
-{
-  ts.ui3 = ts.ui1 * ts.ui2 * ts.ui3;
-
-  return ts;
-}
-
-static test_structure_5 struct5(test_structure_5 ts1, test_structure_5 ts2)
-{
-  ts1.c1 += ts2.c1;
-  ts1.c2 -= ts2.c2;
-
-  return ts1;
-}
-
-static test_structure_6 struct6 (test_structure_6 ts)
-{
-  ts.f += 1;
-  ts.d += 1;
-
-  return ts;
-}
-
-static test_structure_7 struct7 (test_structure_7 ts)
-{
-  ts.f1 += 1;
-  ts.f2 += 1;
-  ts.d += 1;
-
-  return ts;
-}
-
-static test_structure_8 struct8 (test_structure_8 ts)
-{
-  ts.f1 += 1;
-  ts.f2 += 1;
-  ts.f3 += 1;
-  ts.f4 += 1;
-
-  return ts;
-}
-
-static test_structure_9 struct9 (test_structure_9 ts)
-{
-  ts.f += 1;
-  ts.i += 1;
-
-  return ts;
-}
-
-/* Take an int and a float argument, together with int userdata, and 	*/
-/* return the sum.							*/
-#if FFI_CLOSURES
-static void
-closure_test_fn(ffi_cif* cif,void* resp,void** args, void* userdata)
-{
-  *(ffi_arg*)resp =
-    (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) +
-    (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] +
-    (int)(*(signed short *)args[4]) +
-    (int)(*(unsigned long long *)args[5]) +
-    (int)*(int *)args[6] + (int)(*(int *)args[7]) +
-    (int)(*(double *)args[8]) + (int)*(int *)args[9] +
-    (int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
-    (int)*(int *)args[12] + (int)(*(int *)args[13]) +
-    (int)(*(int *)args[14]) +  *(int *)args[15] + (int)(long)userdata;
-
-    	printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
-	       (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]), 
-	       (int)(*(unsigned long long *)args[2]),
-	       (int)*(int *)args[3], (int)(*(signed short *)args[4]), 
-	       (int)(*(unsigned long long *)args[5]),
-	       (int)*(int *)args[6], (int)(*(int *)args[7]), 
-	       (int)(*(double *)args[8]), (int)*(int *)args[9],
-	       (int)(*(int *)args[10]), (int)(*(float *)args[11]),
-	       (int)*(int *)args[12], (int)(*(int *)args[13]), 
-	       (int)(*(int *)args[14]),*(int *)args[15],
-	       (int)(long)userdata, (int)*(ffi_arg *)resp);
-}
-
-typedef int (*closure_test_type)(unsigned long long, int, unsigned long long, 
-				 int, signed short, unsigned long long, int, 
-				 int, double, int, int, float, int, int, 
-				 int, int);
-
-static void closure_test_fn1(ffi_cif* cif,void* resp,void** args, 
-			     void* userdata)
- {
-    *(ffi_arg*)resp =
-      (int)*(float *)args[0] +(int)(*(float *)args[1]) + 
-      (int)(*(float *)args[2]) + (int)*(float *)args[3] +
-      (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) +
-      (int)*(float *)args[6] + (int)(*(int *)args[7]) + 
-      (int)(*(double*)args[8]) + (int)*(int *)args[9] + 
-      (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + 
-      (int)*(int *)args[12] + (int)(*(int *)args[13]) + 
-      (int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
-
-    printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
-	   (int)*(float *)args[0], (int)(*(float *)args[1]), 
-	   (int)(*(float *)args[2]), (int)*(float *)args[3], 
-	   (int)(*(signed short *)args[4]), (int)(*(float *)args[5]),
-	   (int)*(float *)args[6], (int)(*(int *)args[7]),
-	   (int)(*(double *)args[8]), (int)*(int *)args[9],
-	   (int)(*(int *)args[10]), (int)(*(float *)args[11]),
-	   (int)*(int *)args[12], (int)(*(int *)args[13]),
-	   (int)(*(int *)args[14]), *(int *)args[15],
-	   (int)(long)userdata, (int)*(ffi_arg *)resp);
-}
-
-typedef int (*closure_test_type1)(float, float, float, float, signed short, 
-				  float, float, int, double, int, int, float,
-				  int, int, int, int);
-
-static void closure_test_fn2(ffi_cif* cif,void* resp,void** args, 
-			     void* userdata)
- {
-    *(ffi_arg*)resp =
-      (int)*(double *)args[0] +(int)(*(double *)args[1]) + 
-      (int)(*(double *)args[2]) + (int)*(double *)args[3] +
-      (int)(*(signed short *)args[4]) + (int)(*(double *)args[5]) +
-      (int)*(double *)args[6] + (int)(*(int *)args[7]) + 
-      (int)(*(double *)args[8]) + (int)*(int *)args[9] +
-      (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + 
-      (int)*(int *)args[12] + (int)(*(float *)args[13]) +
-      (int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
-
-    printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
-	   (int)*(double *)args[0], (int)(*(double *)args[1]), 
-	   (int)(*(double *)args[2]), (int)*(double *)args[3], 
-	   (int)(*(signed short *)args[4]), (int)(*(double *)args[5]),
-	   (int)*(double *)args[6], (int)(*(int *)args[7]), 
-	   (int)(*(double*)args[8]), (int)*(int *)args[9], 
-	   (int)(*(int *)args[10]), (int)(*(float *)args[11]),
-	   (int)*(int *)args[12], (int)(*(float *)args[13]), 
-	   (int)(*(int *)args[14]), *(int *)args[15], (int)(long)userdata, 
-	   (int)*(ffi_arg *)resp);
- }
-
-typedef int (*closure_test_type2)(double, double, double, double, signed short,
-				  double, double, int, double, int, int, float,
-				  int, float, int, int);
-
-static void closure_test_fn3(ffi_cif* cif,void* resp,void** args,
-			     void* userdata)
- {
-    *(ffi_arg*)resp =
-      (int)*(float *)args[0] +(int)(*(float *)args[1]) + 
-      (int)(*(float *)args[2]) + (int)*(float *)args[3] +
-      (int)(*(float *)args[4]) + (int)(*(float *)args[5]) +
-      (int)*(float *)args[6] + (int)(*(float *)args[7]) + 
-      (int)(*(double *)args[8]) + (int)*(int *)args[9] +
-      (int)(*(float *)args[10]) + (int)(*(float *)args[11]) + 
-      (int)*(int *)args[12] + (int)(*(float *)args[13]) +
-      (int)(*(float *)args[14]) +  *(int *)args[15] + (int)(long)userdata;
-
-    printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
-	   (int)*(float *)args[0], (int)(*(float *)args[1]), 
-	   (int)(*(float *)args[2]), (int)*(float *)args[3], 
-	   (int)(*(float *)args[4]), (int)(*(float *)args[5]),
-	   (int)*(float *)args[6], (int)(*(float *)args[7]), 
-	   (int)(*(double *)args[8]), (int)*(int *)args[9], 
-	   (int)(*(float *)args[10]), (int)(*(float *)args[11]),
-	   (int)*(int *)args[12], (int)(*(float *)args[13]), 
-	   (int)(*(float *)args[14]), *(int *)args[15], (int)(long)userdata,
-	   (int)*(ffi_arg *)resp);
- }
-
-typedef int (*closure_test_type3)(float, float, float, float, float, float,
-				  float, float, double, int, float, float, int,
-				  float, float, int);
-#endif
-
-int main(/*@unused@*/ int argc, /*@unused@*/ char *argv[])
-{
-  ffi_cif cif;
-  ffi_type *args[MAX_ARGS];
-  void *values[MAX_ARGS];
-  char *s;
-  signed char sc;
-  unsigned char uc;
-  signed short ss;
-  unsigned short us;
-  unsigned long ul;
-  long long ll;
-  float f;
-  double d;
-  long double ld;
-  signed int si1;
-  signed int si2;
-
-  ffi_arg rint;
-  long long rlonglong;
-
-# if FFI_CLOSURES
-  /* The closure must not be an automatic variable on
-     platforms (Solaris) that forbid stack execution by default. */
-  static ffi_closure cl;
-  ffi_closure *pcl = &cl;
-#endif
-
-  ffi_type * cl_arg_types[17];
-
-  ffi_type ts1_type;
-  ffi_type ts2_type;
-  ffi_type ts3_type;
-  ffi_type ts4_type;  
-  ffi_type ts5_type;
-  ffi_type ts6_type;
-  ffi_type ts7_type;
-  ffi_type ts8_type;
-  ffi_type ts9_type;
-  ffi_type *ts1_type_elements[4];
-  ffi_type *ts2_type_elements[3];
-  ffi_type *ts3_type_elements[2];
-  ffi_type *ts4_type_elements[4];
-  ffi_type *ts5_type_elements[3];
-  ffi_type *ts6_type_elements[3];
-  ffi_type *ts7_type_elements[4];
-  ffi_type *ts8_type_elements[5];
-  ffi_type *ts9_type_elements[3];
-
-  ts1_type.size = 0;
-  ts1_type.alignment = 0;
-  ts1_type.type = FFI_TYPE_STRUCT;
-
-  ts2_type.size = 0;
-  ts2_type.alignment = 0;
-  ts2_type.type = FFI_TYPE_STRUCT;
-
-  ts3_type.size = 0;
-  ts3_type.alignment = 0;
-  ts3_type.type = FFI_TYPE_STRUCT;
-
-  ts4_type.size = 0;
-  ts4_type.alignment = 0;
-  ts4_type.type = FFI_TYPE_STRUCT;
-
-  ts5_type.size = 0;
-  ts5_type.alignment = 0;
-  ts5_type.type = FFI_TYPE_STRUCT;
-
-  ts6_type.size = 0;
-  ts6_type.alignment = 0;
-  ts6_type.type = FFI_TYPE_STRUCT;
-
-  ts7_type.size = 0;
-  ts7_type.alignment = 0;
-  ts7_type.type = FFI_TYPE_STRUCT;
-
-  ts8_type.size = 0;
-  ts8_type.alignment = 0;
-  ts8_type.type = FFI_TYPE_STRUCT;
-
-  ts9_type.size = 0;
-  ts9_type.alignment = 0;
-  ts9_type.type = FFI_TYPE_STRUCT;
-
-  /*@-immediatetrans@*/
-  ts1_type.elements = ts1_type_elements;
-  ts2_type.elements = ts2_type_elements;
-  ts3_type.elements = ts3_type_elements;
-  ts4_type.elements = ts4_type_elements;
-  ts5_type.elements = ts5_type_elements;
-  ts6_type.elements = ts6_type_elements;
-  ts7_type.elements = ts7_type_elements;
-  ts8_type.elements = ts8_type_elements;
-  ts9_type.elements = ts9_type_elements;
-  /*@=immediatetrans@*/
-  
-  ts1_type_elements[0] = &ffi_type_uchar;
-  ts1_type_elements[1] = &ffi_type_double;
-  ts1_type_elements[2] = &ffi_type_uint;
-  ts1_type_elements[3] = NULL;
-  
-  ts2_type_elements[0] = &ffi_type_double;
-  ts2_type_elements[1] = &ffi_type_double;
-  ts2_type_elements[2] = NULL;
-
-  ts3_type_elements[0] = &ffi_type_sint;
-  ts3_type_elements[1] = NULL;
-
-  ts4_type_elements[0] = &ffi_type_uint;
-  ts4_type_elements[1] = &ffi_type_uint;
-  ts4_type_elements[2] = &ffi_type_uint;
-  ts4_type_elements[3] = NULL;
-
-  ts5_type_elements[0] = &ffi_type_schar;
-  ts5_type_elements[1] = &ffi_type_schar;
-  ts5_type_elements[2] = NULL;
-
-  ts6_type_elements[0] = &ffi_type_float;
-  ts6_type_elements[1] = &ffi_type_double;
-  ts6_type_elements[2] = NULL;
-
-  ts7_type_elements[0] = &ffi_type_float;
-  ts7_type_elements[1] = &ffi_type_float;
-  ts7_type_elements[2] = &ffi_type_double;
-  ts7_type_elements[3] = NULL;
-
-  ts8_type_elements[0] = &ffi_type_float;
-  ts8_type_elements[1] = &ffi_type_float;
-  ts8_type_elements[2] = &ffi_type_float;
-  ts8_type_elements[3] = &ffi_type_float;
-  ts8_type_elements[4] = NULL;
-
-  ts9_type_elements[0] = &ffi_type_float;
-  ts9_type_elements[1] = &ffi_type_sint;
-  ts9_type_elements[2] = NULL;
-
-  ul = 0;
-
-  /* return value tests */
-  {
-#if defined(MIPS) /* || defined(ARM) */
-    puts ("long long tests not run. This is a known bug on this architecture.");
-#else
-    args[0] = &ffi_type_sint64;
-    values[0] = &ll;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
-		       &ffi_type_sint64, args) == FFI_OK);
-
-    for (ll = 0LL; ll < 100LL; ll++)
-      {
-	ul++;
-	ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
-	CHECK(rlonglong == ll);
-      }
-
-    for (ll = 55555555555000LL; ll < 55555555555100LL; ll++)
-      {
-	ul++;
-	ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
-	CHECK(rlonglong == ll);
-      }
-#endif
-
-    args[0] = &ffi_type_schar;
-    values[0] = &sc;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
-		       &ffi_type_schar, args) == FFI_OK);
-
-    for (sc = (signed char) -127; 
-	 sc < (signed char) 127; /*@-type@*/ sc++ /*@=type@*/)
-      {
-	ul++;
-	ffi_call(&cif, FFI_FN(return_sc), &rint, values);
-	CHECK(rint == (ffi_arg) sc);
-      }
-
-    args[0] = &ffi_type_uchar;
-    values[0] = &uc;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
-		       &ffi_type_uchar, args) == FFI_OK);
-
-    for (uc = (unsigned char) '\x00'; 
-	 uc < (unsigned char) '\xff'; /*@-type@*/ uc++ /*@=type@*/)
-      {
-	ul++;
-	ffi_call(&cif, FFI_FN(return_uc), &rint, values);
-	CHECK(rint == (signed int) uc);
-      }
-
-    printf("%lu return value tests run\n", ul);
-  }
-
-#ifdef BROKEN_LONG_DOUBLE
-  printf ("This architecture has broken `long double' support. No floating point\ntests have been run.\n");
-#else
-  /* float arg tests */
-  {
-    args[0] = &ffi_type_float;
-    values[0] = &f;
-
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
-		       &ffi_type_longdouble, args) == FFI_OK);
-
-    f = 3.14159;
-
-#if 0
-  /* This is ifdef'd out for now. long double support under SunOS/gcc
-     is pretty much non-existent.  You'll get the odd bus error in library
-     routines like printf().  */
-    printf ("%Lf\n", ldblit(f));
-#endif
-    ld = 666;
-    ffi_call(&cif, FFI_FN(ldblit), &ld, values);
-
-#if 0
-  /* This is ifdef'd out for now. long double support under SunOS/gcc
-     is pretty much non-existent.  You'll get the odd bus error in library
-     routines like printf().  */
-    printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON);
-#endif
-
-    /* These are not always the same!! Check for a reasonable delta */
-    /*@-realcompare@*/
-    if (ld - ldblit(f) < LDBL_EPSILON)
-    /*@=realcompare@*/
-	puts("long double return value tests ok!");
-    else
-        CHECK(0);
-  }
-
-  /* float arg tests */
-  {
-    args[0] = &ffi_type_sint;
-    values[0] = &si1;
-    args[1] = &ffi_type_float;
-    values[1] = &f;
-    args[2] = &ffi_type_double;
-    values[2] = &d;
-    args[3] = &ffi_type_longdouble;
-    values[3] = &ld;
-    args[4] = &ffi_type_sint;
-    values[4] = &si2;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 5,
-		       &ffi_type_sint, args) == FFI_OK);
-
-    si1 = 6;
-    f = 3.14159;
-    d = (double)1.0/(double)3.0;
-    ld = 2.71828182846L;
-    si2 = 10;
-
-    floating (si1, f, d, ld, si2);
-
-    ffi_call(&cif, FFI_FN(floating), &rint, values);
-
-    printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld, si2));
-
-    CHECK(rint == floating(si1, f, d, ld, si2));
-
-    printf("float arg tests ok!\n");
-  }
-#endif
-
-  /* strlen tests */
-  {
-    args[0] = &ffi_type_pointer;
-    values[0] = (void*) &s;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
-		       &ffi_type_sint, args) == FFI_OK);
-
-    s = "a";
-    ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
-    CHECK(rint == 1);
-
-    s = "1234567";
-    ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
-    CHECK(rint == 7);
-
-    s = "1234567890123456789012345";
-    ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
-    CHECK(rint == 25);
-
-    printf("strlen tests passed\n");
-  }
-
-  /* float arg tests */
-  {
-    args[0] = &ffi_type_float;
-    values[0] = &f;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
-		       &ffi_type_double, args) == FFI_OK);
-
-    f = 3.14159;
-
-    ffi_call(&cif, FFI_FN(dblit), &d, values);
-
-    /* These are not always the same!! Check for a reasonable delta */
-    /*@-realcompare@*/
-    CHECK(d - dblit(f) < DBL_EPSILON);
-    /*@=realcompare@*/
-
-    printf("double return value tests ok!\n");
-  }
-
-  /* many arg tests */
-  {
-    float ff;
-    float fa[13];
-    
-    for (ul = 0; ul < 13; ul++)
-      {
-	args[ul] = &ffi_type_float;
-	values[ul] = &fa[ul];
-	fa[ul] = (float) ul;
-      }
-
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, 
-		       &ffi_type_float, args) == FFI_OK);
-
-    /*@-usedef@*/
-    ff = many (fa[0], fa[1],
-	       fa[2], fa[3],
-	       fa[4], fa[5],
-	       fa[6], fa[7],
-	       fa[8], fa[9],
-	       fa[10],fa[11],fa[12]);
-    /*@=usedef@*/
-
-    ffi_call(&cif, FFI_FN(many), &f, values);
-
-    /*@-realcompare@*/
-    if (f - ff < FLT_EPSILON)
-    /*@=realcompare@*/
-	printf("many arg tests ok!\n");
-    else
-#ifdef POWERPC
-	printf("many arg tests failed!  This is a gcc bug.\n");
-#else
-        CHECK(0);
-#endif
-  }
-
-  /* promotion tests */
-  {
-    args[0] = &ffi_type_schar;
-    args[1] = &ffi_type_sshort;
-    args[2] = &ffi_type_uchar;
-    args[3] = &ffi_type_ushort;
-    values[0] = &sc;
-    values[1] = &ss;
-    values[2] = &uc;
-    values[3] = &us;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, 
-		       &ffi_type_sint, args) == FFI_OK);
-
-    us = 0;
-    ul = 0;
-
-    for (sc = (signed char) -127; 
-	 sc <= (signed char) 120; /*@-type@*/ sc += 1 /*@=type@*/)
-      for (ss = -30000; ss <= 30000; ss += 10000)
-	for (uc = (unsigned char) 0; 
-	     uc <= (unsigned char) 200; /*@-type@*/ uc += 20 /*@=type@*/)
-	  for (us = 0; us <= 60000; us += 10000)
-	    {
-	      ul++;
-	      ffi_call(&cif, FFI_FN(promotion), &rint, values);
-	      CHECK((int)rint == (signed char) sc + (signed short) ss +
-		    (unsigned char) uc + (unsigned short) us);
-	    }
-    printf("%lu promotion tests run\n", ul);
-  }
-
-#ifndef X86_WIN32 /* Structures dont work on Win32 */
-
-  /* struct tests */
-  {
-    test_structure_1 ts1_arg;
-    /* This is a hack to get a properly aligned result buffer */
-    test_structure_1 *ts1_result = 
-      (test_structure_1 *) malloc (sizeof(test_structure_1));
-
-    args[0] = &ts1_type;
-    values[0] = &ts1_arg;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
-		       &ts1_type, args) == FFI_OK);
-
-    ts1_arg.uc = '\x01';
-    ts1_arg.d = 3.14159;
-    ts1_arg.ui = 555;
-
-    ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
-
-    CHECK(ts1_result->ui == 556);
-    CHECK(ts1_result->d == 3.14159 - 1);
-
-    puts ("structure test 1 ok!\n");
-
-    free (ts1_result);
-  }
-
-  /* struct tests */
-  {
-    test_structure_2 ts2_arg;
-
-    /* This is a hack to get a properly aligned result buffer */
-    test_structure_2 *ts2_result = 
-      (test_structure_2 *) malloc (sizeof(test_structure_2));
-
-    args[0] = &ts2_type;
-    values[0] = &ts2_arg;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts2_type, args) == FFI_OK);
-
-    ts2_arg.d1 = 5.55;
-    ts2_arg.d2 = 6.66;
-
-    printf ("%g\n", ts2_arg.d1);
-    printf ("%g\n", ts2_arg.d2);
-
-    ffi_call(&cif, FFI_FN(struct2), ts2_result, values);
-
-    printf ("%g\n", ts2_result->d1);
-    printf ("%g\n", ts2_result->d2);
-    
-    CHECK(ts2_result->d1 == 5.55 - 1);
-    CHECK(ts2_result->d2 == 6.66 - 1);
-
-    printf("structure test 2 ok!\n");
-
-    free (ts2_result);
-  }
-
-  /* struct tests */
-  {
-    int compare_value;
-    test_structure_3 ts3_arg;
-    test_structure_3 *ts3_result = 
-      (test_structure_3 *) malloc (sizeof(test_structure_3));
-
-    args[0] = &ts3_type;
-    values[0] = &ts3_arg;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
-		       &ts3_type, args) == FFI_OK);
-
-    ts3_arg.si = -123;
-    compare_value = ts3_arg.si;
-
-    ffi_call(&cif, FFI_FN(struct3), ts3_result, values);
-
-    printf ("%d %d\n", ts3_result->si, -(compare_value*2));
-
-    if (ts3_result->si == -(ts3_arg.si*2))
-	puts ("structure test 3 ok!");
-    else
-      {
-	puts ("Structure test 3 found structure passing bug.");
-	puts ("  Current versions of GCC are not 100% compliant with the");
-	puts ("  n32 ABI.  There is a known problem related to passing");
-	puts ("  small structures.  Send a bug report to the gcc maintainers.");
-      }
-
-    free (ts3_result);
-  }
-
-  /* struct tests */
-  {
-    test_structure_4 ts4_arg;
-
-    /* This is a hack to get a properly aligned result buffer */
-    test_structure_4 *ts4_result = 
-      (test_structure_4 *) malloc (sizeof(test_structure_4));
-
-    args[0] = &ts4_type;
-    values[0] = &ts4_arg;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts4_type, args) == FFI_OK);
-
-    ts4_arg.ui1 = 2;
-    ts4_arg.ui2 = 3;
-    ts4_arg.ui3 = 4;
-
-    ffi_call (&cif, FFI_FN(struct4), ts4_result, values);
-    
-    if (ts4_result->ui3 == 2U * 3U * 4U)
-      puts ("structure test 4 ok!");
-    else
-      puts ("Structure test 4 found GCC's structure passing bug.");
-
-    free (ts4_result);
-  }
-
-  /* struct tests */
-  {
-    test_structure_5 ts5_arg1, ts5_arg2;
-
-    /* This is a hack to get a properly aligned result buffer */
-    test_structure_5 *ts5_result = 
-      (test_structure_5 *) malloc (sizeof(test_structure_5));
-
-    args[0] = &ts5_type;
-    args[1] = &ts5_type;
-    values[0] = &ts5_arg1;
-    values[1] = &ts5_arg2;
-    
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ts5_type, args) == FFI_OK);
-
-    ts5_arg1.c1 = 2;
-    ts5_arg1.c2 = 6;
-    ts5_arg2.c1 = 5;
-    ts5_arg2.c2 = 3;
-
-    ffi_call (&cif, FFI_FN(struct5), ts5_result, values);
-    
-    if (ts5_result->c1 == 7 
-	&& ts5_result->c2 == 3)
-      puts ("structure test 5 ok!");
-    else
-      puts ("Structure test 5 found GCC's structure passing bug.");
-
-    free (ts5_result);
-  }
-
-  /* struct tests */
-  {
-    test_structure_6 ts6_arg;
-
-    /* This is a hack to get a properly aligned result buffer */
-    test_structure_6 *ts6_result = 
-      (test_structure_6 *) malloc (sizeof(test_structure_6));
-
-    args[0] = &ts6_type;
-    values[0] = &ts6_arg;
-
-    /* Initialize the cif */
-    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts6_type, args) == FFI_OK);
-
-    ts6_arg.f = 5.55f;
-    ts6_arg.d = 6.66;
-
-    printf ("%g\n", ts6_arg.f);
-    printf ("%g\n", ts6_arg.d);
-
-    ffi_call(&cif, FFI_FN(struct6), ts6_result, values);
-
-    printf ("%g\n", ts6_result->f);
-    printf ("%g\n", ts6_result->d);
-
-    CHECK(ts6_result->f == 5.55f + 1);
-    CHECK(ts6_result->d == 6.66 + 1);
-
-    printf("structure test 6 ok!\n");
-
-    free (ts6_result);
-  }
-
-  /* struct tests */
-  {
-    test_structure_7 ts7_arg;
-
-    /* This is a hack to get a properly aligned result buffer */
-    test_structure_7 *ts7_result = 
-      (test_structure_7 *) malloc (sizeof(test_structure_7));
-
-    args[0] = &ts7_type;