* libffi merge @ 2009-06-02 17:10 Andrew Haley 2009-06-03 11:03 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-02 17:10 UTC (permalink / raw) To: libffi-discuss, gcc-patches, Java Patch List libffi upstream and gcc libffi are out of sync. I'm doing a two-way merge. Please don't commit patches to either repo for the next few days. Thanks, Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-02 17:10 libffi merge Andrew Haley @ 2009-06-03 11:03 ` Andrew Haley 2009-06-03 11:54 ` Anthony Green 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-03 11:03 UTC (permalink / raw) To: libffi-discuss; +Cc: gcc-patches, Java Patch List [-- Attachment #1: Type: text/plain, Size: 255 bytes --] Andrew Haley wrote: > libffi upstream and gcc libffi are out of sync. > > I'm doing a two-way merge. Please don't commit patches to either repo for > the next few days. Here is the first tranche of changes, being the merge from gcc to libffi. Andrew. [-- Attachment #2: patch --] [-- Type: text/plain, Size: 16887 bytes --] 2009-05-22 Dave Korn <dave.korn.cygwin@gmail.com> * src/x86/win32.S (_ffi_closure_STDCALL): New function. (.eh_frame): Add FDE for it. 2009-05-22 Dave Korn <dave.korn.cygwin@gmail.com> * configure.ac: Also check if assembler supports pc-relative relocs on X86_WIN32 targets. * configure: Regenerate. * src/x86/win32.S (ffi_prep_args): Declare extern, not global. (_ffi_call_SYSV): Add missing function type symbol .def and add EH markup labels. (_ffi_call_STDCALL): Likewise. (_ffi_closure_SYSV): Likewise. (_ffi_closure_raw_SYSV): Likewise. (.eh_frame): Add hand-crafted EH data. 2008-11-21 Eric Botcazou <ebotcazou@adacore.com> * src/sparc/ffi.c (ffi_prep_cif_machdep): Add support for signed/unsigned int8/16 return values. * src/sparc/v8.S (ffi_call_v8): Likewise. (ffi_closure_v8): Likewise. 2008-08-25 Andreas Tobler <a.tobler@schweiz.org> * src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum. Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT. Adjust copyright notice. * src/powerpc/ffi.c: Add two new flags to indicate if we have one register or two register to use for FFI_SYSV structs. (ffi_prep_cif_machdep): Pass the right register flag introduced above. (ffi_closure_helper_SYSV): Fix the return type for FFI_SYSV_TYPE_SMALL_STRUCT. Comment. Adjust copyright notice. 2008-07-16 Kaz Kojima <kkojima@gcc.gnu.org> * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned int. 2008-03-26 Kaz Kojima <kkojima@gcc.gnu.org> * src/sh/sysv.S: Add .note.GNU-stack on Linux. * src/sh64/sysv.S: Likewise. 2008-03-26 Daniel Jacobowitz <dan@debian.org> * src/arm/sysv.S: Fix ARM comment marker. 2008-02-12 Bjoern Koenig <bkoenig@alpha-tierchen.de> Andreas Tobler <a.tobler@schweiz.org> * configure.ac: Add amd64-*-freebsd* target. * configure: Regenerate. 2008-01-30 H.J. Lu <hongjiu.lu@intel.com> PR libffi/34612 * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when returning struct. 2006-03-15 Kaz Kojima <kkojima@gcc.gnu.org> * src/sh64/ffi.c (ffi_prep_cif_machdep): Handle float arguments passed with FP registers correctly. (ffi_closure_helper_SYSV): Likewise. * src/sh64/sysv.S: Likewise. Index: configure.ac =================================================================== RCS file: /cvs/libffi/libffi/configure.ac,v retrieving revision 1.24 diff -u -r1.24 configure.ac --- configure.ac 19 Dec 2008 16:13:45 -0000 1.24 +++ configure.ac 3 Jun 2009 10:49:17 -0000 @@ -53,6 +53,10 @@ TARGET=X86_64; TARGETDIR=x86 ;; + amd64-*-freebsd*) + TARGET=X86_64; TARGETDIR=x86 + ;; + cris-*-*) TARGET=LIBFFI_CRIS; TARGETDIR=cris ;; @@ -245,7 +249,7 @@ fi fi -if test x$TARGET = xX86 || test x$TARGET = xX86_64; then +if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then AC_CACHE_CHECK([assembler supports pc related relocs], libffi_cv_as_x86_pcrel, [ libffi_cv_as_x86_pcrel=yes Index: src/sh64/ffi.c =================================================================== RCS file: /cvs/libffi/libffi/src/sh64/ffi.c,v retrieving revision 1.4 diff -u -r1.4 ffi.c --- src/sh64/ffi.c 26 Feb 2008 17:34:36 -0000 1.4 +++ src/sh64/ffi.c 3 Jun 2009 10:49:17 -0000 @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2003, 2004 Kaz Kojima + ffi.c - Copyright (c) 2003, 2004, 2006 Kaz Kojima Copyright (c) 2008 Anthony Green SuperH SHmedia Foreign Function Interface @@ -162,6 +162,7 @@ int n, m; int greg; int freg; + int fpair = -1; greg = (return_type (cif->rtype) == FFI_TYPE_STRUCT ? 1 : 0); freg = 0; @@ -177,7 +178,13 @@ cif->bytes += sizeof (UINT64) - sizeof (float); if (freg >= NFREGARG - 1) continue; - freg++; + if (fpair < 0) + { + fpair = freg; + freg += 2; + } + else + fpair = -1; cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); break; @@ -186,7 +193,6 @@ continue; if ((freg + 1) < NFREGARG) { - freg = (freg + 1) & ~1; freg += 2; cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); } @@ -352,6 +358,7 @@ int i, avn; int greg, freg; ffi_cif *cif; + int fpair = -1; cif = closure->cif; avalue = alloca (cif->nargs * sizeof (void *)); @@ -360,7 +367,7 @@ returns the data directly to the caller. */ if (return_type (cif->rtype) == FFI_TYPE_STRUCT) { - rvalue = *pgr; + rvalue = (UINT64 *) *pgr; greg = 1; } else @@ -404,11 +411,24 @@ if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg < NFREGARG - 1) + { + if (fpair >= 0) + { + avalue[i] = (UINT32 *) pfr + fpair; + fpair = -1; + } + else + { #ifdef __LITTLE_ENDIAN__ - avalue[i] = (UINT32 *) pfr + (1 ^ freg++); + fpair = freg; + avalue[i] = (UINT32 *) pfr + (1 ^ freg); #else - avalue[i] = (UINT32 *) pfr + freg++; + fpair = 1 ^ freg; + avalue[i] = (UINT32 *) pfr + freg; #endif + freg += 2; + } + } else #ifdef __LITTLE_ENDIAN__ avalue[i] = pgr + greg; @@ -430,7 +450,6 @@ avalue[i] = pgr + greg; else { - freg = (freg + 1) & ~1; avalue[i] = pfr + (freg >> 1); freg += 2; } Index: src/sh64/sysv.S =================================================================== RCS file: /cvs/libffi/libffi/src/sh64/sysv.S,v retrieving revision 1.4 diff -u -r1.4 sysv.S --- src/sh64/sysv.S 17 Jul 2008 13:13:52 -0000 1.4 +++ src/sh64/sysv.S 3 Jun 2009 10:49:17 -0000 @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2003, 2004, 2008 Kaz Kojima + sysv.S - Copyright (c) 2003, 2004, 2006, 2008 Kaz Kojima SuperH SHmedia Foreign Function Interface @@ -85,6 +85,7 @@ addi r15, 64, r22 movi 0, r0 movi 0, r1 + movi -1, r23 pt/l 1f, tr1 bnei/l r29, FFI_TYPE_STRUCT, tr1 @@ -107,9 +108,6 @@ .L_pass_d: addi r0, 1, r0 - addi r1, 1, r1 - andi r1, ~1, r1 - pt/l 3f, tr0 movi 12, r20 bge/l r1, r20, tr0 @@ -159,13 +157,23 @@ addi.l r15, 8, r15 3: pt/l .L_pass, tr0 - addi r1, 1, r1 blink tr0, r63 .L_pop_f: pt/l .L_pop_f_tbl, tr1 + pt/l 5f, tr2 gettr tr1, r20 + bge/l r23, r63, tr2 + add r1, r63, r23 shlli r1, 3, r21 + addi r1, 2, r1 + add r20, r21, r20 + ptabs/l r20, tr1 + blink tr1, r63 +5: + addi r23, 1, r21 + movi -1, r23 + shlli r21, 3, r21 add r20, r21, r20 ptabs/l r20, tr1 blink tr1, r63 Index: src/sparc/ffi.c =================================================================== RCS file: /cvs/libffi/libffi/src/sparc/ffi.c,v retrieving revision 1.7 diff -u -r1.7 ffi.c --- src/sparc/ffi.c 26 Feb 2008 17:34:36 -0000 1.7 +++ src/sparc/ffi.c 3 Jun 2009 10:49:17 -0000 @@ -308,14 +308,24 @@ cif->flags = FFI_TYPE_STRUCT; break; + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + if (cif->abi == FFI_V9) + cif->flags = FFI_TYPE_INT; + else + cif->flags = cif->rtype->type; + break; + case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: - if (cif->abi != FFI_V9) - { - cif->flags = FFI_TYPE_SINT64; - break; - } - /* FALLTHROUGH */ + if (cif->abi == FFI_V9) + cif->flags = FFI_TYPE_INT; + else + cif->flags = FFI_TYPE_SINT64; + break; + default: cif->flags = FFI_TYPE_INT; break; Index: src/sparc/v8.S =================================================================== RCS file: /cvs/libffi/libffi/src/sparc/v8.S,v retrieving revision 1.6 diff -u -r1.6 v8.S --- src/sparc/v8.S 26 Feb 2008 19:01:53 -0000 1.6 +++ src/sparc/v8.S 3 Jun 2009 10:49:17 -0000 @@ -73,21 +73,63 @@ be,a done st %f0, [%i4+0] ! (delay) + cmp %i3, FFI_TYPE_DOUBLE + be,a double + st %f0, [%i4+0] ! (delay) + + cmp %i3, FFI_TYPE_SINT8 + be,a sint8 + sll %o0, 24, %o0 ! (delay) + + cmp %i3, FFI_TYPE_UINT8 + be,a uint8 + sll %o0, 24, %o0 ! (delay) + + cmp %i3, FFI_TYPE_SINT16 + be,a sint16 + sll %o0, 16, %o0 ! (delay) + + cmp %i3, FFI_TYPE_UINT16 + be,a uint16 + sll %o0, 16, %o0 ! (delay) + cmp %i3, FFI_TYPE_SINT64 - be longlong + be,a longlong + st %o0, [%i4+0] ! (delay) +done: + ret + restore - cmp %i3, FFI_TYPE_DOUBLE - bne done - nop - st %f0, [%i4+0] +double: st %f1, [%i4+4] - -done: ret restore -longlong: +sint8: + sra %o0, 24, %o0 + st %o0, [%i4+0] + ret + restore + +uint8: + srl %o0, 24, %o0 + st %o0, [%i4+0] + ret + restore + +sint16: + sra %o0, 16, %o0 + st %o0, [%i4+0] + ret + restore + +uint16: + srl %o0, 16, %o0 st %o0, [%i4+0] + ret + restore + +longlong: st %o1, [%i4+4] ret restore @@ -148,7 +190,8 @@ be done1 cmp %o0, FFI_TYPE_INT - be integer + be done1 + ld [%fp-8], %i0 cmp %o0, FFI_TYPE_FLOAT be,a done1 @@ -166,13 +209,11 @@ cmp %o0, FFI_TYPE_STRUCT be done2 - ! FFI_TYPE_SINT64 - ! FFI_TYPE_UINT64 - ld [%fp-4], %i1 + cmp %o0, FFI_TYPE_SINT64 + be,a done1 + ldd [%fp-8], %i0 -integer: ld [%fp-8], %i0 - done1: jmp %i7+8 restore Index: src/x86/win32.S =================================================================== RCS file: /cvs/libffi/libffi/src/x86/win32.S,v retrieving revision 1.5 diff -u -r1.5 win32.S --- src/x86/win32.S 15 Feb 2008 01:24:06 -0000 1.5 +++ src/x86/win32.S 3 Jun 2009 10:49:17 -0000 @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - win32.S - Copyright (c) 1996, 1998, 2001, 2002 Red Hat, Inc. + win32.S - Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. Copyright (c) 2001 John Beniton Copyright (c) 2002 Ranjit Mathew @@ -31,18 +31,20 @@ #include <fficonfig.h> #include <ffi.h> -.text + .text -.globl ffi_prep_args + .extern ffi_prep_args # This assumes we are using gas. .balign 16 -.globl _ffi_call_SYSV - + .globl _ffi_call_SYSV + .def _ffi_call_SYSV; .scl 2; .type 32; .endef _ffi_call_SYSV: +.LFB1: pushl %ebp +.LCFI0: movl %esp,%ebp - +.LCFI1: # Make room for all of the new args. movl 16(%ebp),%ecx subl %ecx,%esp @@ -145,17 +147,19 @@ movl %ebp,%esp popl %ebp ret - .ffi_call_SYSV_end: +.LFE1: # This assumes we are using gas. .balign 16 -.globl _ffi_call_STDCALL - + .globl _ffi_call_STDCALL + .def _ffi_call_STDCALL; .scl 2; .type 32; .endef _ffi_call_STDCALL: +.LFB2: pushl %ebp +.LCFI2: movl %esp,%ebp - +.LCFI3: # Make room for all of the new args. movl 16(%ebp),%ecx subl %ecx,%esp @@ -256,8 +260,8 @@ movl %ebp,%esp popl %ebp ret - .ffi_call_STDCALL_end: +.LFE2: .globl _ffi_closure_STDCALL _ffi_closure_STDCALL: @@ -275,10 +279,16 @@ jmp .Lcls_return_result .ffi_closure_STDCALL_end: - .globl _ffi_closure_SYSV + # This assumes we are using gas. + .balign 16 + .globl _ffi_closure_SYSV + .def _ffi_closure_SYSV; .scl 2; .type 32; .endef _ffi_closure_SYSV: +.LFB3: pushl %ebp +.LCFI4: movl %esp, %ebp +.LCFI5: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ @@ -330,6 +340,7 @@ movswl (%ecx), %eax jmp .Lcls_epilogue .ffi_closure_SYSV_end: +.LFE3: #if !FFI_NO_RAW_API @@ -338,12 +349,18 @@ #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 - .balign 16 - .globl _ffi_closure_raw_SYSV + # This assumes we are using gas. + .balign 16 + .globl _ffi_closure_raw_SYSV + .def _ffi_closure_raw_SYSV; .scl 2; .type 32; .endef _ffi_closure_raw_SYSV: +.LFB4: pushl %ebp +.LCFI6: movl %esp, %ebp +.LCFI7: pushl %esi +.LCFI8: subl $36, %esp movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ @@ -387,5 +404,169 @@ movl -20(%ebp), %edx jmp .Lrcls_epilogue .ffi_closure_raw_SYSV_end: +.LFE4: + +#endif /* !FFI_NO_RAW_API */ + + .section .eh_frame,"w" +.Lframe1: +.LSCIE1: + .long .LECIE1-.LASCIE1 /* Length of Common Information Entry */ +.LASCIE1: + .long 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ +#ifdef __PIC__ + .ascii "zR\0" /* CIE Augmentation */ +#else + .ascii "\0" /* CIE Augmentation */ +#endif + .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ + .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ + .byte 0x8 /* CIE RA Column */ +#ifdef __PIC__ + .byte 0x1 /* .uleb128 0x1; Augmentation size */ + .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif + .byte 0xc /* DW_CFA_def_cfa CFA = r4 + 4 = 4(%esp) */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x88 /* DW_CFA_offset, column 0x8 %eip at CFA + 1 * -4 */ + .byte 0x1 /* .uleb128 0x1 */ + .align 4 +.LECIE1: + +.LSFDE1: + .long .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .long .LASFDE1-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB1-. /* FDE initial location */ +#else + .long .LFB1 +#endif + .long .LFE1-.LFB1 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI0-.LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI1-.LCFI0 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE1: + + +.LSFDE2: + .long .LEFDE2-.LASFDE2 /* FDE Length */ +.LASFDE2: + .long .LASFDE2-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB2-. /* FDE initial location */ +#else + .long .LFB2 +#endif + .long .LFE2-.LFB2 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI2-.LFB2 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI3-.LCFI2 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE2: + + +.LSFDE3: + .long .LEFDE3-.LASFDE3 /* FDE Length */ +.LASFDE3: + .long .LASFDE3-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB3-. /* FDE initial location */ +#else + .long .LFB3 +#endif + .long .LFE3-.LFB3 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI4-.LFB3 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI5-.LCFI4 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE3: + +#if !FFI_NO_RAW_API + +.LSFDE4: + .long .LEFDE4-.LASFDE4 /* FDE Length */ +.LASFDE4: + .long .LASFDE4-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB4-. /* FDE initial location */ +#else + .long .LFB4 +#endif + .long .LFE4-.LFB4 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI6-.LFB4 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI7-.LCFI6 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI8-.LCFI7 + .byte 0x86 /* DW_CFA_offset, column 0x6 %esi at CFA + 3 * -4 */ + .byte 0x3 /* .uleb128 0x3 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE4: + +#endif /* !FFI_NO_RAW_API */ ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-03 11:03 ` Andrew Haley @ 2009-06-03 11:54 ` Anthony Green 2009-06-03 19:53 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Anthony Green @ 2009-06-03 11:54 UTC (permalink / raw) To: Andrew Haley; +Cc: libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Andrew Haley wrote: > >> libffi upstream and gcc libffi are out of sync. >> >> I'm doing a two-way merge. Please don't commit patches to either repo for >> the next few days. >> > > Here is the first tranche of changes, being the merge from gcc to libffi. > > Andrew. > Thanks Andrew. This set of changes were already in libffi... 2008-08-25 Andreas Tobler <a.tobler@schweiz.org> * src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum. Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT. Adjust copyright notice. * src/powerpc/ffi.c: Add two new flags to indicate if we have one register or two register to use for FFI_SYSV structs. (ffi_prep_cif_machdep): Pass the right register flag introduced above. (ffi_closure_helper_SYSV): Fix the return type for FFI_SYSV_TYPE_SMALL_STRUCT. Comment. Adjust copyright notice. 2008-07-16 Kaz Kojima <kkojima@gcc.gnu.org> * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned int. 2008-03-26 Kaz Kojima <kkojima@gcc.gnu.org> * src/sh/sysv.S: Add .note.GNU-stack on Linux. * src/sh64/sysv.S: Likewise. 2008-02-12 Bjoern Koenig <bkoenig@alpha-tierchen.de> Andreas Tobler <a.tobler@schweiz.org> * configure.ac: Add amd64-*-freebsd* target. * configure: Regenerate. The most difficult part of the merge is the configury, which is why I have been selectively cross merging for the past while. AG ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-03 11:54 ` Anthony Green @ 2009-06-03 19:53 ` Andrew Haley 2009-06-03 20:26 ` Anthony Green 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-03 19:53 UTC (permalink / raw) To: Anthony Green; +Cc: libffi-discuss, gcc-patches, Java Patch List Anthony Green wrote: > Andrew Haley wrote: >> Andrew Haley wrote: >> >>> libffi upstream and gcc libffi are out of sync. >>> >>> I'm doing a two-way merge. Please don't commit patches to either >>> repo for >>> the next few days. >>> >> >> Here is the first tranche of changes, being the merge from gcc to libffi. > Thanks Andrew. This set of changes were already in libffi... Mostly, but the ChangeLog entries were missing. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-03 19:53 ` Andrew Haley @ 2009-06-03 20:26 ` Anthony Green 2009-06-04 10:35 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Anthony Green @ 2009-06-03 20:26 UTC (permalink / raw) To: Andrew Haley; +Cc: Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Anthony Green wrote: > >> Andrew Haley wrote: >> >>> Andrew Haley wrote: >>> >>> >>>> libffi upstream and gcc libffi are out of sync. >>>> >>>> I'm doing a two-way merge. Please don't commit patches to either >>>> repo for >>>> the next few days. >>>> >>>> >>> Here is the first tranche of changes, being the merge from gcc to libffi. >>> > > >> Thanks Andrew. This set of changes were already in libffi... >> > > Mostly, but the ChangeLog entries were missing. > They were in ChangeLog.libffi because they were added manually. I will delete them from ChangeLog.libffi once you've completed the two way merge. Thanks, AG > Andrew. > ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-03 20:26 ` Anthony Green @ 2009-06-04 10:35 ` Andrew Haley 2009-06-04 10:42 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-04 10:35 UTC (permalink / raw) To: Anthony Green; +Cc: Anthony Green, libffi-discuss, gcc-patches, Java Patch List Anthony Green wrote: > Andrew Haley wrote: >> Anthony Green wrote: >> >>> Andrew Haley wrote: >>> >>>> Andrew Haley wrote: >>>> >>>> >>>>> libffi upstream and gcc libffi are out of sync. >>>>> >>>>> I'm doing a two-way merge. Please don't commit patches to either >>>>> repo for >>>>> the next few days. >>>>> >>>> Here is the first tranche of changes, being the merge from gcc to >>>> libffi. >>>> >> >> >>> Thanks Andrew. This set of changes were already in libffi... >>> >> >> Mostly, but the ChangeLog entries were missing. libffi was missing one hunk of AOliva's big change. Andrew. Index: src/sh64/ffi.c =================================================================== RCS file: /cvs/libffi/libffi/src/sh64/ffi.c,v retrieving revision 1.5 diff -u -r1.5 ffi.c --- src/sh64/ffi.c 3 Jun 2009 17:42:56 -0000 1.5 +++ src/sh64/ffi.c 4 Jun 2009 10:32:42 -0000 @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2003, 2004, 2006 Kaz Kojima + ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima Copyright (c) 2008 Anthony Green SuperH SHmedia Foreign Function Interface @@ -300,10 +300,11 @@ extern void __ic_invalidate (void *line); ffi_status -ffi_prep_closure (ffi_closure *closure, - ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data) +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif *cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) { unsigned int *tramp; @@ -327,8 +328,8 @@ tramp[2] = 0xcc000010 | (((UINT32) ffi_closure_SYSV) >> 16) << 10; tramp[3] = 0xc8000010 | (((UINT32) ffi_closure_SYSV) & 0xffff) << 10; tramp[4] = 0x6bf10600; - tramp[5] = 0xcc000010 | (((UINT32) closure) >> 16) << 10; - tramp[6] = 0xc8000010 | (((UINT32) closure) & 0xffff) << 10; + tramp[5] = 0xcc000010 | (((UINT32) codeloc) >> 16) << 10; + tramp[6] = 0xc8000010 | (((UINT32) codeloc) & 0xffff) << 10; tramp[7] = 0x4401fff0; closure->cif = cif; @@ -336,7 +337,8 @@ closure->user_data = user_data; /* Flush the icache. */ - asm volatile ("ocbwb %0,0; synco; icbi %0,0; synci" : : "r" (tramp)); + asm volatile ("ocbwb %0,0; synco; icbi %1,0; synci" : : "r" (tramp), + "r"(codeloc)); return FFI_OK; } ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 10:35 ` Andrew Haley @ 2009-06-04 10:42 ` Andrew Haley 2009-06-04 10:57 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-04 10:42 UTC (permalink / raw) To: Anthony Green; +Cc: Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Anthony Green wrote: >> Andrew Haley wrote: >>> Anthony Green wrote: >>> >>>> Andrew Haley wrote: >>>> >>>>> Andrew Haley wrote: >>>>> >>>>> >>>>>> libffi upstream and gcc libffi are out of sync. >>>>>> >>>>>> I'm doing a two-way merge. Please don't commit patches to either >>>>>> repo for >>>>>> the next few days. There's a big cleanup in gcc but not libffi that makes merging very hard: http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00724.html I'm going to have to apply this to libffi to get any further with the merge. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 10:42 ` Andrew Haley @ 2009-06-04 10:57 ` Andrew Haley 2009-06-04 12:39 ` Anthony Green 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-04 10:57 UTC (permalink / raw) To: Anthony Green; +Cc: Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Andrew Haley wrote: >> Anthony Green wrote: >>> Andrew Haley wrote: >>>> Anthony Green wrote: >>>> >>>>> Andrew Haley wrote: >>>>> >>>>>> Andrew Haley wrote: >>>>>> >>>>>> >>>>>>> libffi upstream and gcc libffi are out of sync. >>>>>>> >>>>>>> I'm doing a two-way merge. Please don't commit patches to either >>>>>>> repo for >>>>>>> the next few days. > > There's a big cleanup in gcc but not libffi that makes merging very hard: > http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00724.html > > I'm going to have to apply this to libffi to get any further with the > merge. A correction: a small part of it is not in libffi. A big chunk of the formatting diffs are now due to this change: 2008-02-14 Anthony Green <green@redhat.com> * configure.ac: Bump version to 2.99.7. * configure, doc/stamp-vti, doc/version.texi: Rebuilt. * include/ffi.h.in LICENSE src/debug.c src/closures.c src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S src/x86/unix64.S src/x86/win32.S src/x86/ffitarget.h src/x86/ffi64.c src/x86/darwin.S src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h src/ia64/unix.S src/sparc/ffi.c src/sparc/v9.S src/sparc/ffitarget.h src/sparc/v8.S src/alpha/ffi.c src/alpha/ffitarget.h src/alpha/osf.S src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h src/mips/ffi.c src/mips/ffitarget.h src/mips/n32.S src/mips/o32.S src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h src/prep_cif.c: Update license text. This change isn't in gcc's libffi, but I don't know why. Anthony? Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 10:57 ` Andrew Haley @ 2009-06-04 12:39 ` Anthony Green 2009-06-04 12:49 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Anthony Green @ 2009-06-04 12:39 UTC (permalink / raw) To: Andrew Haley; +Cc: Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Andrew Haley wrote: > >> Andrew Haley wrote: >> >>> Anthony Green wrote: >>> >>>> Andrew Haley wrote: >>>> >>>>> Anthony Green wrote: >>>>> >>>>> >>>>>> Andrew Haley wrote: >>>>>> >>>>>> >>>>>>> Andrew Haley wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> libffi upstream and gcc libffi are out of sync. >>>>>>>> >>>>>>>> I'm doing a two-way merge. Please don't commit patches to either >>>>>>>> repo for >>>>>>>> the next few days. >>>>>>>> >> There's a big cleanup in gcc but not libffi that makes merging very hard: >> http://gcc.gnu.org/ml/gcc-patches/2006-04/msg00724.html >> >> I'm going to have to apply this to libffi to get any further with the >> merge. >> > > A correction: a small part of it is not in libffi. A big chunk of the > formatting diffs are now due to this change: > > 2008-02-14 Anthony Green <green@redhat.com> > > * configure.ac: Bump version to 2.99.7. > * configure, doc/stamp-vti, doc/version.texi: Rebuilt. > * include/ffi.h.in LICENSE src/debug.c src/closures.c > src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h > src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c > src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S > src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c > src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c > src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S > src/x86/unix64.S src/x86/win32.S src/x86/ffitarget.h > src/x86/ffi64.c src/x86/darwin.S src/ia64/ffi.c > src/ia64/ffitarget.h src/ia64/ia64_flags.h src/ia64/unix.S > src/sparc/ffi.c src/sparc/v9.S src/sparc/ffitarget.h > src/sparc/v8.S src/alpha/ffi.c src/alpha/ffitarget.h > src/alpha/osf.S src/sh64/ffi.c src/sh64/sysv.S > src/sh64/ffitarget.h src/mips/ffi.c src/mips/ffitarget.h > src/mips/n32.S src/mips/o32.S src/arm/ffi.c src/arm/sysv.S > src/arm/ffitarget.h src/prep_cif.c: Update license text. > > This change isn't in gcc's libffi, but I don't know why. Anthony? > > Andrew. > > No particular reason. I haven't done a libffi to gcc merge since cleaning this up. Do you want me to do this patch now, or is it easier for you to bring it over? AG ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 12:39 ` Anthony Green @ 2009-06-04 12:49 ` Andrew Haley 2009-06-04 14:09 ` Dave Korn 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-04 12:49 UTC (permalink / raw) To: Anthony Green; +Cc: Anthony Green, libffi-discuss, gcc-patches, Java Patch List Anthony Green wrote: > Andrew Haley wrote: >> A big chunk of the >> formatting diffs are now due to this change: >> >> 2008-02-14 Anthony Green <green@redhat.com> >> >> * configure.ac: Bump version to 2.99.7. >> * configure, doc/stamp-vti, doc/version.texi: Rebuilt. >> * include/ffi.h.in LICENSE src/debug.c src/closures.c >> src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h >> src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c >> src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S >> src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c >> src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c >> src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S >> src/x86/unix64.S src/x86/win32.S src/x86/ffitarget.h >> src/x86/ffi64.c src/x86/darwin.S src/ia64/ffi.c >> src/ia64/ffitarget.h src/ia64/ia64_flags.h src/ia64/unix.S >> src/sparc/ffi.c src/sparc/v9.S src/sparc/ffitarget.h >> src/sparc/v8.S src/alpha/ffi.c src/alpha/ffitarget.h >> src/alpha/osf.S src/sh64/ffi.c src/sh64/sysv.S >> src/sh64/ffitarget.h src/mips/ffi.c src/mips/ffitarget.h >> src/mips/n32.S src/mips/o32.S src/arm/ffi.c src/arm/sysv.S >> src/arm/ffitarget.h src/prep_cif.c: Update license text. >> >> This change isn't in gcc's libffi, but I don't know why. Anthony? > No particular reason. I haven't done a libffi to gcc merge since > cleaning this up. Do you want me to do this patch now, or is it easier > for you to bring it over? Let me do it, I was just a bit baffled. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 12:49 ` Andrew Haley @ 2009-06-04 14:09 ` Dave Korn 2009-06-04 14:43 ` Andrew Haley 2009-06-04 15:07 ` Andrew Haley 0 siblings, 2 replies; 91+ messages in thread From: Dave Korn @ 2009-06-04 14:09 UTC (permalink / raw) To: Andrew Haley Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Anthony Green wrote: >> Andrew Haley wrote: >>> A big chunk of the >>> formatting diffs are now due to this change: >>> * include/ffi.h.in LICENSE src/debug.c src/closures.c >>> src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h >>> src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c >>> src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S >>> src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c >>> src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c >>> src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S >>> src/x86/unix64.S src/x86/win32.S ^^^^^^^^^^^^^^^ >> No particular reason. I haven't done a libffi to gcc merge since >> cleaning this up. Do you want me to do this patch now, or is it easier >> for you to bring it over? > > Let me do it, I was just a bit baffled. Keep an eye out for that one; last time I checked, the license header in the libffi version was a bit mangled, you don't want to inadvertently bring that across. cheers, DaveK ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 14:09 ` Dave Korn @ 2009-06-04 14:43 ` Andrew Haley 2009-06-04 15:07 ` Andrew Haley 1 sibling, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-04 14:43 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Dave Korn wrote: > Andrew Haley wrote: >> Anthony Green wrote: >>> Andrew Haley wrote: >>>> A big chunk of the >>>> formatting diffs are now due to this change: > >>>> * include/ffi.h.in LICENSE src/debug.c src/closures.c >>>> src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h >>>> src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c >>>> src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S >>>> src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c >>>> src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c >>>> src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S >>>> src/x86/unix64.S src/x86/win32.S > ^^^^^^^^^^^^^^^ > >>> No particular reason. I haven't done a libffi to gcc merge since >>> cleaning this up. Do you want me to do this patch now, or is it easier >>> for you to bring it over? >> Let me do it, I was just a bit baffled. > > Keep an eye out for that one; last time I checked, the license header in the > libffi version was a bit mangled, you don't want to inadvertently bring that > across. 2009-06-04 Andrew Haley <aph@redhat.com> * src/x86/darwin.S: Fix licence formatting. src/x86/win32.S: Likewise. src/sh64/sysv.S: Likewise. src/sh/sysv.S: Likewise. Index: src/sh/sysv.S =================================================================== RCS file: /cvs/libffi/libffi/src/sh/sysv.S,v retrieving revision 1.5 diff -c -2 -p -r1.5 sysv.S *** src/sh/sysv.S 17 Jul 2008 13:13:52 -0000 1.5 --- src/sh/sysv.S 4 Jun 2009 14:42:04 -0000 *************** *** 15,26 **** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. ----------------------------------------------------------------------- */ --- 15,26 ---- 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 THE AUTHORS OR COPYRIGHT ! HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/sh64/sysv.S =================================================================== RCS file: /cvs/libffi/libffi/src/sh64/sysv.S,v retrieving revision 1.5 diff -c -2 -p -r1.5 sysv.S *** src/sh64/sysv.S 3 Jun 2009 17:42:56 -0000 1.5 --- src/sh64/sysv.S 4 Jun 2009 14:42:04 -0000 *************** *** 15,26 **** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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. ----------------------------------------------------------------------- */ --- 15,27 ---- 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 THE AUTHORS OR COPYRIGHT ! HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/x86/darwin.S =================================================================== RCS file: /cvs/libffi/libffi/src/x86/darwin.S,v retrieving revision 1.3 diff -c -2 -p -r1.3 darwin.S *** src/x86/darwin.S 15 Feb 2008 01:24:06 -0000 1.3 --- src/x86/darwin.S 4 Jun 2009 14:42:04 -0000 *************** *** 16,28 **** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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 __x86_64__ --- 16,29 ---- 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 THE AUTHORS OR COPYRIGHT ! HOLDERS 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 __x86_64__ Index: src/x86/win32.S =================================================================== RCS file: /cvs/libffi/libffi/src/x86/win32.S,v retrieving revision 1.6 diff -c -2 -p -r1.6 win32.S *** src/x86/win32.S 3 Jun 2009 17:42:56 -0000 1.6 --- src/x86/win32.S 4 Jun 2009 14:42:04 -0000 *************** *** 18,30 **** 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 THE AUTHORS OR COPYRIGHT HOLDERS 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 --- 18,31 ---- 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 THE AUTHORS OR COPYRIGHT ! HOLDERS 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 ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 14:09 ` Dave Korn 2009-06-04 14:43 ` Andrew Haley @ 2009-06-04 15:07 ` Andrew Haley 2009-06-04 15:41 ` Andrew Haley 1 sibling, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-04 15:07 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Dave Korn wrote: > Andrew Haley wrote: >> Anthony Green wrote: >>> Andrew Haley wrote: >>>> A big chunk of the >>>> formatting diffs are now due to this change: > >>>> * include/ffi.h.in LICENSE src/debug.c src/closures.c >>>> src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h >>>> src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c >>>> src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S >>>> src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c >>>> src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c >>>> src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S >>>> src/x86/unix64.S src/x86/win32.S > ^^^^^^^^^^^^^^^ > >>> No particular reason. I haven't done a libffi to gcc merge since >>> cleaning this up. Do you want me to do this patch now, or is it easier >>> for you to bring it over? >> Let me do it, I was just a bit baffled. > > Keep an eye out for that one; last time I checked, the license header in the > libffi version was a bit mangled, you don't want to inadvertently bring that > across. OK, I fixed the libffi end, and this is the fix for gcc. Andrew. Index: include/ffi.h.in =================================================================== --- include/ffi.h.in (revision 148089) +++ include/ffi.h.in (working copy) @@ -12,13 +12,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/arm/ffitarget.h =================================================================== --- src/arm/ffitarget.h (revision 148089) +++ src/arm/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/arm/ffi.c =================================================================== --- src/arm/ffi.c (revision 148089) +++ src/arm/ffi.c (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/arm/sysv.S =================================================================== --- src/arm/sysv.S (revision 148089) +++ src/arm/sysv.S (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/powerpc/ffitarget.h =================================================================== --- src/powerpc/ffitarget.h (revision 148089) +++ src/powerpc/ffitarget.h (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/powerpc/sysv.S =================================================================== --- src/powerpc/sysv.S (revision 148089) +++ src/powerpc/sysv.S (working copy) @@ -15,13 +15,14 @@ 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 THE AUTHOR 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/powerpc/linux64.S =================================================================== --- src/powerpc/linux64.S (revision 148089) +++ src/powerpc/linux64.S (working copy) @@ -14,13 +14,14 @@ 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 THE AUTHOR 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/closures.c =================================================================== --- src/closures.c (revision 148089) +++ src/closures.c (working copy) @@ -15,13 +15,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ #if defined __linux__ && !defined _GNU_SOURCE Index: src/sh64/ffitarget.h =================================================================== --- src/sh64/ffitarget.h (revision 148089) +++ src/sh64/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/sh64/ffi.c =================================================================== --- src/sh64/ffi.c (revision 148089) +++ src/sh64/ffi.c (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/sh64/sysv.S =================================================================== --- src/sh64/sysv.S (revision 148089) +++ src/sh64/sysv.S (working copy) @@ -14,13 +14,15 @@ 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. + + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/types.c =================================================================== --- src/types.c (revision 148089) +++ src/types.c (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ /* Hide the basic type definitions from the header file, so that we Index: src/x86/ffi64.c =================================================================== --- src/x86/ffi64.c (revision 148089) +++ src/x86/ffi64.c (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/x86/ffitarget.h =================================================================== --- src/x86/ffitarget.h (revision 148089) +++ src/x86/ffitarget.h (working copy) @@ -15,13 +15,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/x86/win32.S =================================================================== --- src/x86/win32.S (revision 148089) +++ src/x86/win32.S (working copy) @@ -17,14 +17,16 @@ 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. - ----------------------------------------------------------------------- */ + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/x86/darwin.S =================================================================== --- src/x86/darwin.S (revision 148089) +++ src/x86/darwin.S (working copy) @@ -15,14 +15,16 @@ 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. - ----------------------------------------------------------------------- */ + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 __x86_64__ Index: src/x86/ffi.c =================================================================== --- src/x86/ffi.c (revision 148089) +++ src/x86/ffi.c (working copy) @@ -18,13 +18,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 __x86_64__ Index: src/x86/sysv.S =================================================================== --- src/x86/sysv.S (revision 148089) +++ src/x86/sysv.S (working copy) @@ -15,13 +15,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 __x86_64__ Index: src/x86/unix64.S =================================================================== --- src/x86/unix64.S (revision 148089) +++ src/x86/unix64.S (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ #ifdef __x86_64__ Index: src/alpha/ffitarget.h =================================================================== --- src/alpha/ffitarget.h (revision 148089) +++ src/alpha/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/alpha/ffi.c =================================================================== --- src/alpha/ffi.c (revision 148089) +++ src/alpha/ffi.c (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/alpha/osf.S =================================================================== --- src/alpha/osf.S (revision 148089) +++ src/alpha/osf.S (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/m68k/ffitarget.h =================================================================== --- src/m68k/ffitarget.h (revision 148089) +++ src/m68k/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/frv/ffitarget.h =================================================================== --- src/frv/ffitarget.h (revision 148089) +++ src/frv/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/frv/ffi.c =================================================================== --- src/frv/ffi.c (revision 148089) +++ src/frv/ffi.c (working copy) @@ -15,13 +15,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/s390/ffitarget.h =================================================================== --- src/s390/ffitarget.h (revision 148089) +++ src/s390/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/s390/sysv.S =================================================================== --- src/s390/sysv.S (revision 148089) +++ src/s390/sysv.S (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/cris/ffitarget.h =================================================================== --- src/cris/ffitarget.h (revision 148089) +++ src/cris/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/pa/linux.S =================================================================== --- src/pa/linux.S (revision 148089) +++ src/pa/linux.S (working copy) @@ -17,7 +17,7 @@ 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 + IN NO EVENT SHALL RENESAS TECHNOLOGY 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. Index: src/pa/ffitarget.h =================================================================== --- src/pa/ffitarget.h (revision 148089) +++ src/pa/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/pa/ffi.c =================================================================== --- src/pa/ffi.c (revision 148089) +++ src/pa/ffi.c (working copy) @@ -15,13 +15,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/raw_api.c =================================================================== --- src/raw_api.c (revision 148089) +++ src/raw_api.c (working copy) @@ -16,13 +16,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ /* This file defines generic functions for use with the raw api. */ Index: src/ia64/ffitarget.h =================================================================== --- src/ia64/ffitarget.h (revision 148089) +++ src/ia64/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/ia64/unix.S =================================================================== --- src/ia64/unix.S (revision 148089) +++ src/ia64/unix.S (working copy) @@ -19,13 +19,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/ia64/ffi.c =================================================================== --- src/ia64/ffi.c (revision 148089) +++ src/ia64/ffi.c (working copy) @@ -15,13 +15,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/ia64/ia64_flags.h =================================================================== --- src/ia64/ia64_flags.h (revision 148089) +++ src/ia64/ia64_flags.h (working copy) @@ -16,13 +16,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ /* "Type" codes used between assembly and C. When used as a part of Index: src/java_raw_api.c =================================================================== --- src/java_raw_api.c (revision 148089) +++ src/java_raw_api.c (working copy) @@ -19,13 +19,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ /* This defines a Java- and 64-bit specific variant of the raw API. */ Index: src/debug.c =================================================================== --- src/debug.c (revision 148089) +++ src/debug.c (working copy) @@ -12,13 +12,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/sparc/v9.S =================================================================== --- src/sparc/v9.S (revision 148089) +++ src/sparc/v9.S (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/sparc/ffitarget.h =================================================================== --- src/sparc/ffitarget.h (revision 148089) +++ src/sparc/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/sparc/ffi.c =================================================================== --- src/sparc/ffi.c (revision 148089) +++ src/sparc/ffi.c (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/sparc/v8.S =================================================================== --- src/sparc/v8.S (revision 148089) +++ src/sparc/v8.S (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/mips/ffitarget.h =================================================================== --- src/mips/ffitarget.h (revision 148089) +++ src/mips/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/mips/n32.S =================================================================== --- src/mips/n32.S (revision 148089) +++ src/mips/n32.S (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/mips/o32.S =================================================================== --- src/mips/o32.S (revision 148089) +++ src/mips/o32.S (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/mips/ffi.c =================================================================== --- src/mips/ffi.c (revision 148089) +++ src/mips/ffi.c (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/prep_cif.c =================================================================== --- src/prep_cif.c (revision 148089) +++ src/prep_cif.c (working copy) @@ -12,13 +12,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/sh/ffitarget.h =================================================================== --- src/sh/ffitarget.h (revision 148089) +++ src/sh/ffitarget.h (working copy) @@ -13,13 +13,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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. ----------------------------------------------------------------------- */ Index: src/sh/ffi.c =================================================================== --- src/sh/ffi.c (revision 148089) +++ src/sh/ffi.c (working copy) @@ -15,13 +15,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/sh/sysv.S =================================================================== --- src/sh/sysv.S (revision 148089) +++ src/sh/sysv.S (working copy) @@ -14,13 +14,14 @@ 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. + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 15:07 ` Andrew Haley @ 2009-06-04 15:41 ` Andrew Haley 2009-06-04 16:04 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-04 15:41 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Merge from libffi -> gcc. Mostly trivial changes to declarations and licence text, but also includes the change that uses __builtin___clear_cache on MIPS. Andrew. 2009-06-04 Andrew Haley <aph@redhat.com> * src/powerpc/ppc_closure.S: Insert licence header. * src/powerpc/linux64_closure.S: Likewise. * src/m68k/sysv.S: Likewise. * src/sh64/ffi.c: Change void (*)() to void (*)(void). * src/powerpc/ffi.c: Likewise. * src/powerpc/ffi_darwin.c: Likewise. * src/m32r/ffi.c: Likewise. * src/sh64/ffi.c: Likewise. * src/x86/ffi64.c: Likewise. * src/alpha/ffi.c: Likewise. * src/alpha/osf.S: Likewise. * src/frv/ffi.c: Likewise. * src/s390/ffi.c: Likewise. * src/pa/ffi.c: Likewise. * src/pa/hpux32.S: Likewise. * src/ia64/unix.S: Likewise. * src/ia64/ffi.c: Likewise. * src/sparc/ffi.c: Likewise. * src/mips/ffi.c: Likewise. * src/sh/ffi.c: Likewise. 2008-02-15 David Daney <ddaney@avtrex.com> * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE): Define (conditionally), and use it to include cachectl.h. (ffi_prep_closure_loc): Fix cache flushing. * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define. Index: src/arm/ffi.c =================================================================== --- src/arm/ffi.c (revision 148171) +++ src/arm/ffi.c (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998 Red Hat, Inc. + ffi.c - Copyright (c) 1998, 2008 Red Hat, Inc. ARM Foreign Function Interface @@ -149,9 +149,9 @@ } extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)()); + unsigned, unsigned, unsigned *, void (*fn)(void)); -void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; Index: src/arm/sysv.S =================================================================== --- src/arm/sysv.S (revision 148171) +++ src/arm/sysv.S (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1998 Red Hat, Inc. + sysv.S - Copyright (c) 1998, 2008 Red Hat, Inc. ARM Foreign Function Interface Index: src/powerpc/ppc_closure.S =================================================================== --- src/powerpc/ppc_closure.S (revision 148170) +++ src/powerpc/ppc_closure.S (working copy) @@ -1,3 +1,29 @@ +/* ----------------------------------------------------------------------- + sysv.h - Copyright (c) 2003 Jakub Jelinek <jakub@redhat.com> + Copyright (c) 2008 Red Hat, Inc. + + PowerPC Assembly glue. + + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> Index: src/powerpc/ffi.c =================================================================== --- src/powerpc/ffi.c (revision 148170) +++ src/powerpc/ffi.c (working copy) @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Geoffrey Keating Copyright (C) 2007, 2008 Free Software Foundation, Inc + Copyright (C) 2008 Red Hat, Inc PowerPC Foreign Function Interface @@ -875,13 +876,13 @@ } extern void ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *, - void (*fn)()); + void (*fn)(void)); extern void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long, unsigned long, unsigned long *, - void (*fn)()); + void (*fn)(void)); void -ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; Index: src/powerpc/linux64_closure.S =================================================================== --- src/powerpc/linux64_closure.S (revision 148170) +++ src/powerpc/linux64_closure.S (working copy) @@ -1,3 +1,29 @@ +/* ----------------------------------------------------------------------- + sysv.h - Copyright (c) 2003 Jakub Jelinek <jakub@redhat.com> + Copyright (c) 2008 Red Hat, Inc. + + PowerPC64 Assembly glue. + + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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> @@ -204,3 +230,7 @@ .align 3 .LEFDE1: #endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif Index: src/powerpc/ffi_darwin.c =================================================================== --- src/powerpc/ffi_darwin.c (revision 148170) +++ src/powerpc/ffi_darwin.c (working copy) @@ -425,11 +425,11 @@ } extern void ffi_call_AIX(extended_cif *, unsigned, unsigned, unsigned *, - void (*fn)(), void (*fn2)()); + void (*fn)(void), void (*fn2)(void)); extern void ffi_call_DARWIN(extended_cif *, unsigned, unsigned, unsigned *, - void (*fn)(), void (*fn2)()); + void (*fn)(void), void (*fn2)(void)); -void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; Index: src/powerpc/linux64.S =================================================================== --- src/powerpc/linux64.S (revision 148171) +++ src/powerpc/linux64.S (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- sysv.h - Copyright (c) 2003 Jakub Jelinek <jakub@redhat.com> + Copyright (c) 2008 Red Hat, Inc. PowerPC64 Assembly glue. @@ -180,3 +181,7 @@ .align 3 .LEFDE1: #endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif Index: src/m32r/ffi.c =================================================================== --- src/m32r/ffi.c (revision 148170) +++ src/m32r/ffi.c (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2004 Renesas Technology + Copyright (c) 2008 Red Hat, Inc. M32R Foreign Function Interface @@ -172,9 +173,9 @@ } extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)()); + unsigned, unsigned, unsigned *, void (*fn)(void)); -void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; Index: src/sh64/ffi.c =================================================================== --- src/sh64/ffi.c (revision 148171) +++ src/sh64/ffi.c (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima + Copyright (c) 2008 Anthony Green SuperH SHmedia Foreign Function Interface @@ -237,11 +238,20 @@ return FFI_OK; } -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, long long, unsigned *, - void (*fn)()); - -void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +/*@-declundef@*/ +/*@-exportheader@*/ +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), + /*@out@*/ extended_cif *, + unsigned, unsigned, long long, + /*@out@*/ unsigned *, + void (*fn)(void)); +/*@=declundef@*/ +/*@=exportheader@*/ + +void ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(void), + /*@out@*/ void *rvalue, + /*@dependent@*/ void **avalue) { extended_cif ecif; UINT64 trvalue; Index: src/x86/darwin64.S =================================================================== --- src/x86/darwin64.S (revision 148170) +++ src/x86/darwin64.S (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- darwin64.S - Copyright (c) 2006 Free Software Foundation, Inc. + Copyright (c) 2008 Red Hat, Inc. derived from unix64.S x86-64 Foreign Function Interface for Darwin. @@ -33,7 +34,7 @@ .text /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, - void *raddr, void (*fnaddr)()); + void *raddr, void (*fnaddr)(void)); 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 Index: src/x86/ffi64.c =================================================================== --- src/x86/ffi64.c (revision 148171) +++ src/x86/ffi64.c (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2002, 2007 Bo Thorsen <bo@suse.de> + Copyright (c) 2008 Red Hat, Inc. x86-64 Foreign Function Interface @@ -43,7 +44,7 @@ }; extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, - void *raddr, void (*fnaddr)(), unsigned ssecount); + void *raddr, void (*fnaddr)(void), unsigned ssecount); /* All reference to register classes here is identical to the code in gcc/config/i386/i386.c. Do *not* change one without the other. */ @@ -340,7 +341,7 @@ } void -ffi_call (ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { enum x86_64_reg_class classes[MAX_CLASSES]; char *stack, *argp; Index: src/x86/sysv.S =================================================================== --- src/x86/sysv.S (revision 148171) +++ src/x86/sysv.S (working copy) @@ -1,6 +1,5 @@ /* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005, 2008 - Red Hat, Inc. + sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008 Red Hat, Inc. X86 Foreign Function Interface Index: src/x86/unix64.S =================================================================== --- src/x86/unix64.S (revision 148171) +++ src/x86/unix64.S (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - unix64.S - Copyright (c) 2002, 2008 Bo Thorsen <bo@suse.de> + unix64.S - Copyright (c) 2002 Bo Thorsen <bo@suse.de> + Copyright (c) 2008 Red Hat, Inc x86-64 Foreign Function Interface @@ -32,7 +33,7 @@ .text /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, - void *raddr, void (*fnaddr)()); + void *raddr, void (*fnaddr)(void)); 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 Index: src/alpha/ffi.c =================================================================== --- src/alpha/ffi.c (revision 148171) +++ src/alpha/ffi.c (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2001, 2007 Red Hat, Inc. + ffi.c - Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. Alpha Foreign Function Interface @@ -39,7 +39,7 @@ # define FFI_TYPE_LONGDOUBLE 4 #endif -extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)()) +extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)(void)) FFI_HIDDEN; extern void ffi_closure_osf(void) FFI_HIDDEN; @@ -76,7 +76,7 @@ void -ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { unsigned long *stack, *argp; long i, avn; Index: src/alpha/osf.S =================================================================== --- src/alpha/osf.S (revision 148171) +++ src/alpha/osf.S (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - osf.S - Copyright (c) 1998, 2001, 2007 Red Hat + osf.S - Copyright (c) 1998, 2001, 2007, 2008 Red Hat Alpha/OSF Foreign Function Interface @@ -32,7 +32,7 @@ .text /* ffi_call_osf (void *args, unsigned long bytes, unsigned flags, - void *raddr, void (*fnaddr)()); + void *raddr, void (*fnaddr)(void)); 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 Index: src/m68k/sysv.S =================================================================== --- src/m68k/sysv.S (revision 148170) +++ src/m68k/sysv.S (working copy) @@ -1,7 +1,28 @@ /* ----------------------------------------------------------------------- - sysv.S + sysv.S - Copyright (c) 1998 Andreas Schwab + Copyright (c) 2008 Red Hat, Inc. m68k 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 Index: src/frv/ffi.c =================================================================== --- src/frv/ffi.c (revision 148171) +++ src/frv/ffi.c (working copy) @@ -1,6 +1,7 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2004 Anthony Green + ffi.c - Copyright (C) 2004 Anthony Green Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2008 Red Hat, Inc. FR-V Foreign Function Interface @@ -126,10 +127,10 @@ extended_cif *, unsigned, unsigned, unsigned *, - void (*fn)()); + void (*fn)(void)); void ffi_call(ffi_cif *cif, - void (*fn)(), + void (*fn)(void), void *rvalue, void **avalue) { Index: src/s390/ffi.c =================================================================== --- src/s390/ffi.c (revision 148170) +++ src/s390/ffi.c (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2000, 2007 Software AG + Copyright (c) 2008 Red Hat, Inc S390 Foreign Function Interface @@ -88,7 +89,7 @@ void (*)(unsigned char *, extended_cif *), unsigned, void *, - void (*fn)()); + void (*fn)(void)); extern void ffi_closure_SYSV(void); @@ -498,7 +499,7 @@ void ffi_call(ffi_cif *cif, - void (*fn)(), + void (*fn)(void), void *rvalue, void **avalue) { Index: src/s390/sysv.S =================================================================== --- src/s390/sysv.S (revision 148171) +++ src/s390/sysv.S (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2000 Software AG + Copyright (c) 2008 Red Hat, Inc. S390 Foreign Function Interface Index: src/pa/linux.S =================================================================== --- src/pa/linux.S (revision 148171) +++ src/pa/linux.S (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- linux.S - (c) 2003-2004 Randolph Chung <tausq@debian.org> + (c) 2008 Red Hat, Inc. HPPA Foreign Function Interface @@ -36,7 +37,7 @@ unsigned bytes, unsigned flags, unsigned *rvalue, - void (*fn)()); + void (*fn)(void)); */ .export ffi_call_pa32,code Index: src/pa/ffi.c =================================================================== --- src/pa/ffi.c (revision 148171) +++ src/pa/ffi.c (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- ffi.c - (c) 2003-2004 Randolph Chung <tausq@debian.org> + (c) 2008 Red Hat, Inc. HPPA Foreign Function Interface HP-UX PA ABI support (c) 2006 Free Software Foundation, Inc. @@ -368,9 +369,9 @@ extern void ffi_call_pa32(void (*)(UINT32 *, extended_cif *, unsigned), extended_cif *, unsigned, unsigned, unsigned *, - void (*fn)()); + void (*fn)(void)); -void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; Index: src/pa/hpux32.S =================================================================== --- src/pa/hpux32.S (revision 148170) +++ src/pa/hpux32.S (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- hpux32.S - Copyright (c) 2006 Free Software Foundation, Inc. + (c) 2008 Red Hat, Inc. based on src/pa/linux.S HP-UX PA Foreign Function Interface @@ -40,7 +41,7 @@ unsigned bytes, unsigned flags, unsigned *rvalue, - void (*fn)()); + void (*fn)(void)); */ .export ffi_call_pa32,ENTRY,PRIV_LEV=3 Index: src/raw_api.c =================================================================== --- src/raw_api.c (revision 148171) +++ src/raw_api.c (working copy) @@ -1,10 +1,8 @@ /* ----------------------------------------------------------------------- - raw_api.c - Copyright (c) 1999 Red Hat, Inc. + raw_api.c - Copyright (c) 1999, 2008 Red Hat, Inc. Author: Kresten Krab Thorup <krab@gnu.org> - $Id $ - 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 @@ -190,7 +188,7 @@ * these following couple of functions will handle the translation forth * and back automatically. */ -void ffi_raw_call (ffi_cif *cif, void (*fn)(), void *rvalue, ffi_raw *raw) +void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *raw) { void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); ffi_raw_to_ptrarray (cif, raw, avalue); Index: src/ia64/unix.S =================================================================== --- src/ia64/unix.S (revision 148171) +++ src/ia64/unix.S (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - unix.S - Copyright (c) 1998 Red Hat, Inc. + unix.S - Copyright (c) 1998, 2008 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company IA64/unix Foreign Function Interface @@ -38,7 +38,7 @@ .text /* int ffi_call_unix (struct ia64_args *stack, PTR64 rvalue, - void (*fn)(), int flags); + void (*fn)(void), int flags); */ .align 16 @@ -554,3 +554,7 @@ data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif Index: src/ia64/ffi.c =================================================================== --- src/ia64/ffi.c (revision 148171) +++ src/ia64/ffi.c (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2007 Red Hat, Inc. + ffi.c - Copyright (c) 1998, 2007, 2008 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company IA64 Foreign Function Interface @@ -270,10 +270,10 @@ return FFI_OK; } -extern int ffi_call_unix (struct ia64_args *, PTR64, void (*)(), UINT64); +extern int ffi_call_unix (struct ia64_args *, PTR64, void (*)(void), UINT64); void -ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { struct ia64_args *stack; long i, avn, gpcount, fpcount; Index: src/java_raw_api.c =================================================================== --- src/java_raw_api.c (revision 148171) +++ src/java_raw_api.c (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - java_raw_api.c - Copyright (c) 1999, 2007 Red Hat, Inc. + java_raw_api.c - Copyright (c) 1999, 2007, 2008 Red Hat, Inc. Cloned from raw_api.c @@ -295,7 +295,7 @@ * these following couple of functions will handle the translation forth * and back automatically. */ -void ffi_java_raw_call (ffi_cif *cif, void (*fn)(), void *rvalue, +void ffi_java_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_java_raw *raw) { void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); Index: src/sparc/v9.S =================================================================== --- src/sparc/v9.S (revision 148171) +++ src/sparc/v9.S (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - v9.S - Copyright (c) 2000, 2003, 2004 Red Hat, Inc. + v9.S - Copyright (c) 2000, 2003, 2004, 2008 Red Hat, Inc. SPARC 64-bit Foreign Function Interface Index: src/sparc/ffi.c =================================================================== --- src/sparc/ffi.c (revision 148171) +++ src/sparc/ffi.c (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 2003, 2004, 2007 Red Hat, Inc. + ffi.c - Copyright (c) 1996, 2003, 2004, 2007, 2008 Red Hat, Inc. SPARC Foreign Function Interface @@ -369,13 +369,13 @@ #ifdef SPARC64 extern int ffi_call_v9(void *, extended_cif *, unsigned, - unsigned, unsigned *, void (*fn)()); + unsigned, unsigned *, void (*fn)(void)); #else extern int ffi_call_v8(void *, extended_cif *, unsigned, - unsigned, unsigned *, void (*fn)()); + unsigned, unsigned *, void (*fn)(void)); #endif -void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; void *rval = rvalue; Index: src/sparc/v8.S =================================================================== --- src/sparc/v8.S (revision 148171) +++ src/sparc/v8.S (working copy) @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - v8.S - Copyright (c) 1996, 1997, 2003, 2004 Red Hat, Inc. + v8.S - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. SPARC Foreign Function Interface Index: src/mips/ffitarget.h =================================================================== --- src/mips/ffitarget.h (revision 148171) +++ src/mips/ffitarget.h (working copy) @@ -27,6 +27,19 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifdef linux +#include <asm/sgidefs.h> +# ifndef _ABIN32 +# define _ABIN32 _MIPS_SIM_NABI32 +# endif +# ifndef _ABI64 +# define _ABI64 _MIPS_SIM_ABI64 +# endif +# ifndef _ABIO32 +# define _ABIO32 _MIPS_SIM_ABI32 +# endif +#endif + #if !defined(_MIPS_SIM) -- something is very wrong -- #else Index: src/mips/ffi.c =================================================================== --- src/mips/ffi.c (revision 148171) +++ src/mips/ffi.c (working copy) @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 2007 Red Hat, Inc. + ffi.c - Copyright (c) 1996, 2007, 2008 Red Hat, Inc. + Copyright (c) 2008 David Daney MIPS Foreign Function Interface @@ -29,6 +30,16 @@ #include <stdlib.h> +#ifdef __GNUC__ +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) +# define USE__BUILTIN___CLEAR_CACHE 1 +# endif +#endif + +#ifndef USE__BUILTIN___CLEAR_CACHE +#include <sys/cachectl.h> +#endif + #ifdef FFI_DEBUG # define FFI_MIPS_STOP_HERE() ffi_stop_here() #else @@ -483,14 +494,14 @@ /* Low level routine for calling O32 functions */ extern int ffi_call_O32(void (*)(char *, extended_cif *, int, int), extended_cif *, unsigned, - unsigned, unsigned *, void (*)()); + unsigned, unsigned *, void (*)(void)); /* Low level routine for calling N32 functions */ extern int ffi_call_N32(void (*)(char *, extended_cif *, int, int), extended_cif *, unsigned, - unsigned, unsigned *, void (*)()); + unsigned, unsigned *, void (*)(void)); -void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; @@ -616,8 +627,11 @@ closure->fun = fun; closure->user_data = user_data; +#ifdef USE__BUILTIN___CLEAR_CACHE __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE); - +#else + cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE); +#endif return FFI_OK; } Index: src/sh/ffi.c =================================================================== --- src/sh/ffi.c (revision 148171) +++ src/sh/ffi.c (working copy) @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 - Kaz Kojima + ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Kaz Kojima + Copyright (c) 2008 Red Hat, Inc. SuperH Foreign Function Interface @@ -407,9 +407,9 @@ } extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)()); + unsigned, unsigned, unsigned *, void (*fn)(void)); -void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; UINT64 trvalue; ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 15:41 ` Andrew Haley @ 2009-06-04 16:04 ` Andrew Haley 2009-06-04 16:11 ` Dave Korn ` (2 more replies) 0 siblings, 3 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-04 16:04 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List x86 changes: merge from libffi -> gcc. Timothy Wall, please check this one. Thanks, Andrew. 2008-02-26 Anthony Green <green@redhat.com> Thomas Heller <theller@ctypes.org> * src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C comment. 2008-02-03 Timothy Wall <twall@users.sf.net> * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return offset based on code pointer, not data pointer. 2008-01-31 Timothy Wall <twall@users.sf.net> * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall closures. * src/x86/ffitarget.h: Increase size of trampoline for stdcall closures. * src/x86/win32.S: Add assembly for stdcall closure. * src/x86/ffi.c: Initialize stdcall closure trampoline. --- /home/aph/gcc/trunk/libffi/src/x86/ffi.c 2009-06-04 16:47:13.000000000 +0100 +++ ./src/x86/ffi.c 2008-04-03 19:57:34.000000000 +0100 @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007 Red Hat, Inc. + ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. Copyright (c) 2002 Ranjit Mathew Copyright (c) 2002 Bo Thorsen Copyright (c) 2002 Roger Sayle @@ -236,6 +236,10 @@ __attribute__ ((regparm(1))); void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) __attribute__ ((regparm(1))); +#ifdef X86_WIN32 +void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) + __attribute__ ((regparm(1))); +#endif /* This function is jumped to by the trampoline */ @@ -245,7 +249,7 @@ void **respp; void *args; { - // our various things... + /* our various things... */ ffi_cif *cif; void **arg_area; @@ -311,13 +315,26 @@ ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ - unsigned int __dis = __fun - (__ctx + FFI_TRAMPOLINE_SIZE); \ + unsigned int __dis = __fun - (__ctx + 10); \ *(unsigned char*) &__tramp[0] = 0xb8; \ *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ *(unsigned char *) &__tramp[5] = 0xe9; \ *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ }) +#define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ +({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 10); \ + unsigned short __size = (unsigned short)(SIZE); \ + *(unsigned char*) &__tramp[0] = 0xb8; \ + *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[5] = 0xe8; \ + *(unsigned int*) &__tramp[6] = __dis; /* call __fun */ \ + *(unsigned char *) &__tramp[10] = 0xc2; \ + *(unsigned short*) &__tramp[11] = __size; /* ret __size */ \ + }) /* the cif must already be prep'ed */ @@ -328,11 +345,24 @@ void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); - - FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ - &ffi_closure_SYSV, \ - codeloc); + if (cif->abi == FFI_SYSV) + { + FFI_INIT_TRAMPOLINE (&closure->tramp[0], + &ffi_closure_SYSV, + (void*)codeloc); + } +#ifdef X86_WIN32 + else if (cif->abi == FFI_STDCALL) + { + FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], + &ffi_closure_STDCALL, + (void*)codeloc, cif->bytes); + } +#endif + else + { + return FFI_BAD_ABI; + } closure->cif = cif; closure->user_data = user_data; @@ -354,7 +384,9 @@ { int i; - FFI_ASSERT (cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) { + return FFI_BAD_ABI; + } // we currently don't support certain kinds of arguments for raw // closures. This should be implemented by a separate assembly language --- /home/aph/gcc/trunk/libffi/src/x86/ffitarget.h 2009-06-04 15:25:12.000000000 +0100 +++ ./src/x86/ffitarget.h 2008-02-15 01:24:06.000000000 +0000 @@ -78,7 +78,11 @@ #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #else +#ifdef X86_WIN32 +#define FFI_TRAMPOLINE_SIZE 13 +#else #define FFI_TRAMPOLINE_SIZE 10 +#endif #define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ #endif --- /home/aph/gcc/trunk/libffi/src/x86/win32.S 2009-06-04 15:43:59.000000000 +0100 +++ ./src/x86/win32.S 2009-06-04 15:30:26.000000000 +0100 @@ -264,6 +264,22 @@ .ffi_call_STDCALL_end: .LFE2: + .globl _ffi_closure_STDCALL +_ffi_closure_STDCALL: + pushl %ebp + movl %esp, %ebp + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 12(%ebp), %edx /* account for stub return address on stack */ + movl %edx, 4(%esp) /* args */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx + jmp .Lcls_return_result +.ffi_closure_STDCALL_end: + # This assumes we are using gas. .balign 16 .globl _ffi_closure_SYSV @@ -283,6 +299,7 @@ movl %edx, (%esp) /* &resp */ call _ffi_closure_SYSV_inner movl -12(%ebp), %ecx +.Lcls_return_result: cmpl $FFI_TYPE_INT, %eax je .Lcls_retint cmpl $FFI_TYPE_FLOAT, %eax @@ -392,70 +409,6 @@ #endif /* !FFI_NO_RAW_API */ - # This assumes we are using gas. - .balign 16 - .globl _ffi_closure_STDCALL - .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef -_ffi_closure_STDCALL: -.LFB5: - pushl %ebp -.LCFI9: - movl %esp, %ebp -.LCFI10: - subl $40, %esp - leal -24(%ebp), %edx - movl %edx, -12(%ebp) /* resp */ - leal 12(%ebp), %edx /* account for stub return address on stack */ - movl %edx, 4(%esp) /* args */ - leal -12(%ebp), %edx - movl %edx, (%esp) /* &resp */ - call _ffi_closure_SYSV_inner - movl -12(%ebp), %ecx - /* It would be nice to just share this code with the - duplicate sequence in _ffi_closure_SYSV, if only - there were some way to represent that in the EH info. */ - cmpl $FFI_TYPE_INT, %eax - je .Lscls_retint - cmpl $FFI_TYPE_FLOAT, %eax - je .Lscls_retfloat - cmpl $FFI_TYPE_DOUBLE, %eax - je .Lscls_retdouble - cmpl $FFI_TYPE_LONGDOUBLE, %eax - je .Lscls_retldouble - cmpl $FFI_TYPE_SINT64, %eax - je .Lscls_retllong - cmpl $FFI_TYPE_SINT8, %eax /* 1-byte struct */ - je .Lscls_retstruct1 - cmpl $FFI_TYPE_SINT16, %eax /* 2-bytes struct */ - je .Lscls_retstruct2 -.Lscls_epilogue: - movl %ebp, %esp - popl %ebp - ret -.Lscls_retint: - movl (%ecx), %eax - jmp .Lscls_epilogue -.Lscls_retfloat: - flds (%ecx) - jmp .Lscls_epilogue -.Lscls_retdouble: - fldl (%ecx) - jmp .Lscls_epilogue -.Lscls_retldouble: - fldt (%ecx) - jmp .Lscls_epilogue -.Lscls_retllong: - movl (%ecx), %eax - movl 4(%ecx), %edx - jmp .Lscls_epilogue -.Lscls_retstruct1: - movsbl (%ecx), %eax - jmp .Lscls_epilogue -.Lscls_retstruct2: - movswl (%ecx), %eax - jmp .Lscls_epilogue -.ffi_closure_STDCALL_end: -.LFE5: .section .eh_frame,"w" .Lframe1: @@ -618,34 +571,3 @@ .LEFDE4: #endif /* !FFI_NO_RAW_API */ - -.LSFDE5: - .long .LEFDE5-.LASFDE5 /* FDE Length */ -.LASFDE5: - .long .LASFDE5-.Lframe1 /* FDE CIE offset */ -#if defined __PIC__ && defined HAVE_AS_X86_PCREL - .long .LFB5-. /* FDE initial location */ -#else - .long .LFB5 -#endif - .long .LFE5-.LFB5 /* FDE address range */ -#ifdef __PIC__ - .byte 0x0 /* .uleb128 0x0; Augmentation size */ -#endif - /* DW_CFA_xxx CFI instructions go here. */ - - .byte 0x4 /* DW_CFA_advance_loc4 */ - .long .LCFI9-.LFB5 - .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ - .byte 0x8 /* .uleb128 0x8 */ - .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ - .byte 0x2 /* .uleb128 0x2 */ - - .byte 0x4 /* DW_CFA_advance_loc4 */ - .long .LCFI10-.LCFI9 - .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ - .byte 0x5 /* .uleb128 0x5 */ - - /* End of DW_CFA_xxx CFI instructions. */ - .align 4 -.LEFDE5: ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 16:04 ` Andrew Haley @ 2009-06-04 16:11 ` Dave Korn 2009-06-04 16:27 ` Andrew Haley ` (2 more replies) 2009-06-04 16:29 ` Andrew Haley 2009-06-04 17:47 ` Timothy Wall 2 siblings, 3 replies; 91+ messages in thread From: Dave Korn @ 2009-06-04 16:11 UTC (permalink / raw) To: Andrew Haley Cc: Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > x86 changes: merge from libffi -> gcc. > > Timothy Wall, please check this one. I am not he, but ... > --- /home/aph/gcc/trunk/libffi/src/x86/win32.S 2009-06-04 15:43:59.000000000 +0100 > +++ ./src/x86/win32.S 2009-06-04 15:30:26.000000000 +0100 > @@ -264,6 +264,22 @@ > .ffi_call_STDCALL_end: > .LFE2: > > + .globl _ffi_closure_STDCALL > +_ffi_closure_STDCALL: > + pushl %ebp > + movl %esp, %ebp > + subl $40, %esp > + leal -24(%ebp), %edx > + movl %edx, -12(%ebp) /* resp */ > + leal 12(%ebp), %edx /* account for stub return address on stack */ > + movl %edx, 4(%esp) /* args */ > + leal -12(%ebp), %edx > + movl %edx, (%esp) /* &resp */ > + call _ffi_closure_SYSV_inner > + movl -12(%ebp), %ecx > + jmp .Lcls_return_result ^^^^^^^^^^^^^^^^^^^^^^^^^ I figured we couldn't share this code, owing to the need to have discontiguous FDEs in the debug info. Looks like you effectively have the inverse of my last patch in there along with some of the libffi changes. > - /* It would be nice to just share this code with the > - duplicate sequence in _ffi_closure_SYSV, if only > - there were some way to represent that in the EH info. */ Refs: http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01473.html http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01476.html cheers, DaveK ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 16:11 ` Dave Korn @ 2009-06-04 16:27 ` Andrew Haley 2009-06-04 16:36 ` Andrew Haley 2009-06-04 17:04 ` Andrew Haley 2 siblings, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-04 16:27 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Dave Korn wrote: > Andrew Haley wrote: >> x86 changes: merge from libffi -> gcc. >> >> Timothy Wall, please check this one. > > I am not he, but ... > >> --- /home/aph/gcc/trunk/libffi/src/x86/win32.S 2009-06-04 15:43:59.000000000 +0100 >> +++ ./src/x86/win32.S 2009-06-04 15:30:26.000000000 +0100 >> @@ -264,6 +264,22 @@ >> .ffi_call_STDCALL_end: >> .LFE2: >> >> + .globl _ffi_closure_STDCALL >> +_ffi_closure_STDCALL: >> + pushl %ebp >> + movl %esp, %ebp >> + subl $40, %esp >> + leal -24(%ebp), %edx >> + movl %edx, -12(%ebp) /* resp */ >> + leal 12(%ebp), %edx /* account for stub return address on stack */ >> + movl %edx, 4(%esp) /* args */ >> + leal -12(%ebp), %edx >> + movl %edx, (%esp) /* &resp */ >> + call _ffi_closure_SYSV_inner >> + movl -12(%ebp), %ecx >> + jmp .Lcls_return_result > ^^^^^^^^^^^^^^^^^^^^^^^^^ > > I figured we couldn't share this code, owing to the need to have > discontiguous FDEs in the debug info. Looks like you effectively have the > inverse of my last patch in there along with some of the libffi changes. Well, hold on now. Is the code in libffi correct, or not? I don't get it. Neither of those emails contain a patch. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 16:11 ` Dave Korn 2009-06-04 16:27 ` Andrew Haley @ 2009-06-04 16:36 ` Andrew Haley 2009-06-04 17:04 ` Andrew Haley 2 siblings, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-04 16:36 UTC (permalink / raw) To: Dave Korn; +Cc: libffi-discuss Dave Korn wrote: > Andrew Haley wrote: >> x86 changes: merge from libffi -> gcc. >> >> Timothy Wall, please check this one. > > I am not he, but ... > >> --- /home/aph/gcc/trunk/libffi/src/x86/win32.S 2009-06-04 15:43:59.000000000 +0100 >> +++ ./src/x86/win32.S 2009-06-04 15:30:26.000000000 +0100 >> @@ -264,6 +264,22 @@ >> .ffi_call_STDCALL_end: >> .LFE2: >> >> + .globl _ffi_closure_STDCALL >> +_ffi_closure_STDCALL: >> + pushl %ebp >> + movl %esp, %ebp >> + subl $40, %esp >> + leal -24(%ebp), %edx >> + movl %edx, -12(%ebp) /* resp */ >> + leal 12(%ebp), %edx /* account for stub return address on stack */ >> + movl %edx, 4(%esp) /* args */ >> + leal -12(%ebp), %edx >> + movl %edx, (%esp) /* &resp */ >> + call _ffi_closure_SYSV_inner >> + movl -12(%ebp), %ecx >> + jmp .Lcls_return_result > ^^^^^^^^^^^^^^^^^^^^^^^^^ > > I figured we couldn't share this code, owing to the need to have > discontiguous FDEs in the debug info. Looks like you effectively have the > inverse of my last patch in there along with some of the libffi changes. Is this the patch you're talking about? Index: ChangeLog =================================================================== --- ChangeLog (revision 147801) +++ ChangeLog (revision 147802) @@ -1,5 +1,10 @@ 2009-05-22 Dave Korn <dave.korn.cygwin@gmail.com> + * src/x86/win32.S (_ffi_closure_STDCALL): New function. + (.eh_frame): Add FDE for it. + +2009-05-22 Dave Korn <dave.korn.cygwin@gmail.com> + * configure.ac: Also check if assembler supports pc-relative relocs on X86_WIN32 targets. * configure: Regenerate. Index: src/x86/win32.S =================================================================== --- src/x86/win32.S (revision 147801) +++ src/x86/win32.S (revision 147802) @@ -390,6 +390,70 @@ #endif /* !FFI_NO_RAW_API */ + # This assumes we are using gas. + .balign 16 + .globl _ffi_closure_STDCALL + .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef +_ffi_closure_STDCALL: +.LFB5: + pushl %ebp +.LCFI9: + movl %esp, %ebp +.LCFI10: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 12(%ebp), %edx /* account for stub return address on stack */ + movl %edx, 4(%esp) /* args */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx + /* It would be nice to just share this code with the + duplicate sequence in _ffi_closure_SYSV, if only + there were some way to represent that in the EH info. */ + cmpl $FFI_TYPE_INT, %eax + je .Lscls_retint + cmpl $FFI_TYPE_FLOAT, %eax + je .Lscls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lscls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lscls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lscls_retllong + cmpl $FFI_TYPE_SINT8, %eax /* 1-byte struct */ + je .Lscls_retstruct1 + cmpl $FFI_TYPE_SINT16, %eax /* 2-bytes struct */ + je .Lscls_retstruct2 +.Lscls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.Lscls_retint: + movl (%ecx), %eax + jmp .Lscls_epilogue +.Lscls_retfloat: + flds (%ecx) + jmp .Lscls_epilogue +.Lscls_retdouble: + fldl (%ecx) + jmp .Lscls_epilogue +.Lscls_retldouble: + fldt (%ecx) + jmp .Lscls_epilogue +.Lscls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lscls_epilogue +.Lscls_retstruct1: + movsbl (%ecx), %eax + jmp .Lscls_epilogue +.Lscls_retstruct2: + movswl (%ecx), %eax + jmp .Lscls_epilogue +.ffi_closure_STDCALL_end: +.LFE5: .section .eh_frame,"w" .Lframe1: @@ -552,3 +616,34 @@ .LEFDE4: #endif /* !FFI_NO_RAW_API */ + +.LSFDE5: + .long .LEFDE5-.LASFDE5 /* FDE Length */ +.LASFDE5: + .long .LASFDE5-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB5-. /* FDE initial location */ +#else + .long .LFB5 +#endif + .long .LFE5-.LFB5 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI9-.LFB5 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI10-.LCFI9 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE5: ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 16:11 ` Dave Korn 2009-06-04 16:27 ` Andrew Haley 2009-06-04 16:36 ` Andrew Haley @ 2009-06-04 17:04 ` Andrew Haley 2009-06-04 17:46 ` Timothy Wall 2009-06-05 12:12 ` Dave Korn 2 siblings, 2 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-04 17:04 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Dave Korn wrote: > Andrew Haley wrote: >> x86 changes: merge from libffi -> gcc. >> >> Timothy Wall, please check this one. > > I am not he, but ... > >> --- /home/aph/gcc/trunk/libffi/src/x86/win32.S 2009-06-04 15:43:59.000000000 +0100 >> +++ ./src/x86/win32.S 2009-06-04 15:30:26.000000000 +0100 >> @@ -264,6 +264,22 @@ >> .ffi_call_STDCALL_end: >> .LFE2: >> >> + .globl _ffi_closure_STDCALL >> +_ffi_closure_STDCALL: >> + pushl %ebp >> + movl %esp, %ebp >> + subl $40, %esp >> + leal -24(%ebp), %edx >> + movl %edx, -12(%ebp) /* resp */ >> + leal 12(%ebp), %edx /* account for stub return address on stack */ >> + movl %edx, 4(%esp) /* args */ >> + leal -12(%ebp), %edx >> + movl %edx, (%esp) /* &resp */ >> + call _ffi_closure_SYSV_inner >> + movl -12(%ebp), %ecx >> + jmp .Lcls_return_result > ^^^^^^^^^^^^^^^^^^^^^^^^^ > > I figured we couldn't share this code, owing to the need to have > discontiguous FDEs in the debug info. Looks like you effectively have the > inverse of my last patch in there along with some of the libffi changes. > >> - /* It would be nice to just share this code with the >> - duplicate sequence in _ffi_closure_SYSV, if only >> - there were some way to represent that in the EH info. */ > > Refs: http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01473.html > http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01476.html OK, I backed out that patch. I'm awaiting some explanation of what on Earth is going on. I'm guessing that Timothy Wall changed the version upstream but not the version in gcc, and then you changed the version in gcc but not the version upstream. So, we have a two sets of changes, and I can't tell which is supposed to go where. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 17:04 ` Andrew Haley @ 2009-06-04 17:46 ` Timothy Wall 2009-06-04 17:26 ` Andrew Haley 2009-06-05 12:12 ` Dave Korn 1 sibling, 1 reply; 91+ messages in thread From: Timothy Wall @ 2009-06-04 17:46 UTC (permalink / raw) To: Andrew Haley Cc: Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List On Jun 4, 2009, at 1:03 PM, Andrew Haley wrote: > Dave Korn wrote: >> Andrew Haley wrote: >>> x86 changes: merge from libffi -> gcc. >>> >>> Timothy Wall, please check this one. >> >> I am not he, but ... >> >>> --- /home/aph/gcc/trunk/libffi/src/x86/win32.S 2009-06-04 >>> 15:43:59.000000000 +0100 >>> +++ ./src/x86/win32.S 2009-06-04 15:30:26.000000000 +0100 >>> @@ -264,6 +264,22 @@ >>> .ffi_call_STDCALL_end: >>> .LFE2: >>> >>> + .globl _ffi_closure_STDCALL >>> +_ffi_closure_STDCALL: >>> + pushl %ebp >>> + movl %esp, %ebp >>> + subl $40, %esp >>> + leal -24(%ebp), %edx >>> + movl %edx, -12(%ebp) /* resp */ >>> + leal 12(%ebp), %edx /* account for stub return address on stack >>> */ >>> + movl %edx, 4(%esp) /* args */ >>> + leal -12(%ebp), %edx >>> + movl %edx, (%esp) /* &resp */ >>> + call _ffi_closure_SYSV_inner >>> + movl -12(%ebp), %ecx >>> + jmp .Lcls_return_result >> ^^^^^^^^^^^^^^^^^^^^^^^^^ >> >> I figured we couldn't share this code, owing to the need to have >> discontiguous FDEs in the debug info. Looks like you effectively >> have the >> inverse of my last patch in there along with some of the libffi >> changes. >> >>> - /* It would be nice to just share this code with the >>> - duplicate sequence in _ffi_closure_SYSV, if only >>> - there were some way to represent that in the EH info. */ >> >> Refs: http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01473.html >> http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01476.html > > OK, I backed out that patch. I'm awaiting some explanation of what > on Earth > is going on. I'm guessing that Timothy Wall changed the version > upstream but > not the version in gcc, and then you changed the version in gcc but > not the > version upstream. So, we have a two sets of changes, and I can't > tell which > is supposed to go where. I applied the STDCALL closure patch to libffi, but not to GCC. I believe Dave applied the STDCALL closure patch to libffi, expanded somewhat to include the extra EH info. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 17:46 ` Timothy Wall @ 2009-06-04 17:26 ` Andrew Haley 0 siblings, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-04 17:26 UTC (permalink / raw) To: Timothy Wall Cc: Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Timothy Wall wrote: > On Jun 4, 2009, at 1:03 PM, Andrew Haley wrote: >> OK, I backed out that patch. I'm awaiting some explanation of what >> on Earth is going on. I'm guessing that Timothy Wall changed the >> version upstream but not the version in gcc, and then you changed >> the version in gcc but not the version upstream. So, we have a two >> sets of changes, and I can't tell which is supposed to go where. > > I applied the STDCALL closure patch to libffi, but not to GCC. I > believe Dave applied the STDCALL closure patch to libffi, expanded > somewhat to include the extra EH info. OK, so the version in libffi ought to be correct, then. But I'm looking at src/x86/win32.S in libffi, and I see: .globl _ffi_closure_STDCALL _ffi_closure_STDCALL: pushl %ebp movl %esp, %ebp subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 12(%ebp), %edx /* account for stub return address on stack */ movl %edx, 4(%esp) /* args */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ call _ffi_closure_SYSV_inner movl -12(%ebp), %ecx jmp .Lcls_return_result .ffi_closure_STDCALL_end: which is the code that Dave is complaining about. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 17:04 ` Andrew Haley 2009-06-04 17:46 ` Timothy Wall @ 2009-06-05 12:12 ` Dave Korn 2009-06-05 12:53 ` Andrew Haley 1 sibling, 1 reply; 91+ messages in thread From: Dave Korn @ 2009-06-05 12:12 UTC (permalink / raw) To: Andrew Haley Cc: Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Dave Korn wrote: >> Refs: http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01473.html >> http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01476.html > > OK, I backed out that patch. I'm awaiting some explanation of what on Earth > is going on. I'm guessing that Timothy Wall changed the version upstream but > not the version in gcc, and then you changed the version in gcc but not the > version upstream. So, we have a two sets of changes, and I can't tell which > is supposed to go where. The relevant bit from those links was this: > There is currently one difference between our win32.S and upstream libffi > win32.S, where upstream adds a new entrypoint, _ffi_closure_STDCALL. > > Would it help if I added that function and EH annotations for it to my patch? i.e. I already merged (the only difference between) win32.s from libffi->gcc for you, and thought that you'd just copy the gcc version back across wholesale when updating libffi. Sorry for having been AFK for so long, I have a lot of outside stuff going on this week/weekend. cheers, DaveK ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 12:12 ` Dave Korn @ 2009-06-05 12:53 ` Andrew Haley 2009-06-05 13:03 ` Andrew Haley 2009-06-05 13:11 ` Dave Korn 0 siblings, 2 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-05 12:53 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Dave Korn wrote: > Andrew Haley wrote: >> Dave Korn wrote: > >>> Refs: http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01473.html >>> http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01476.html >> OK, I backed out that patch. I'm awaiting some explanation of what on Earth >> is going on. I'm guessing that Timothy Wall changed the version upstream but >> not the version in gcc, and then you changed the version in gcc but not the >> version upstream. So, we have a two sets of changes, and I can't tell which >> is supposed to go where. > > The relevant bit from those links was this: > >> There is currently one difference between our win32.S and upstream libffi >> win32.S, where upstream adds a new entrypoint, _ffi_closure_STDCALL. >> >> Would it help if I added that function and EH annotations for it to my patch? > > i.e. I already merged (the only difference between) win32.s from libffi->gcc > for you, and thought that you'd just copy the gcc version back across > wholesale when updating libffi. Sorry for having been AFK for so long, I have > a lot of outside stuff going on this week/weekend. OK, so the gcc version of win32.s should be copied to libffi, but the other two files, src/x86/ffi.c and src/x86/ffitarget.h should be copied from libffi to gcc. Patch the first: libffi -> gcc. Andrew. 2009-06-05 Andrew Haley <aph@redhat.com> * src/x86/ffitarget.h, src/x86/ffi.c: Merge stdcall changes from libffi. --- /home/aph/gcc/trunk/libffi/src/x86/ffi.c 2009-06-04 18:07:09.000000000 +0100 +++ ./src/x86/ffi.c 2008-04-03 19:57:34.000000000 +0100 @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007 Red Hat, Inc. + ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. Copyright (c) 2002 Ranjit Mathew Copyright (c) 2002 Bo Thorsen Copyright (c) 2002 Roger Sayle @@ -236,6 +236,10 @@ __attribute__ ((regparm(1))); void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) __attribute__ ((regparm(1))); +#ifdef X86_WIN32 +void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) + __attribute__ ((regparm(1))); +#endif /* This function is jumped to by the trampoline */ @@ -245,7 +249,7 @@ void **respp; void *args; { - // our various things... + /* our various things... */ ffi_cif *cif; void **arg_area; @@ -311,13 +315,26 @@ ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ - unsigned int __dis = __fun - (__ctx + FFI_TRAMPOLINE_SIZE); \ + unsigned int __dis = __fun - (__ctx + 10); \ *(unsigned char*) &__tramp[0] = 0xb8; \ *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ *(unsigned char *) &__tramp[5] = 0xe9; \ *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ }) +#define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ +({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 10); \ + unsigned short __size = (unsigned short)(SIZE); \ + *(unsigned char*) &__tramp[0] = 0xb8; \ + *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[5] = 0xe8; \ + *(unsigned int*) &__tramp[6] = __dis; /* call __fun */ \ + *(unsigned char *) &__tramp[10] = 0xc2; \ + *(unsigned short*) &__tramp[11] = __size; /* ret __size */ \ + }) /* the cif must already be prep'ed */ @@ -328,11 +345,24 @@ void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); - - FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ - &ffi_closure_SYSV, \ - codeloc); + if (cif->abi == FFI_SYSV) + { + FFI_INIT_TRAMPOLINE (&closure->tramp[0], + &ffi_closure_SYSV, + (void*)codeloc); + } +#ifdef X86_WIN32 + else if (cif->abi == FFI_STDCALL) + { + FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], + &ffi_closure_STDCALL, + (void*)codeloc, cif->bytes); + } +#endif + else + { + return FFI_BAD_ABI; + } closure->cif = cif; closure->user_data = user_data; @@ -354,7 +384,9 @@ { int i; - FFI_ASSERT (cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) { + return FFI_BAD_ABI; + } // we currently don't support certain kinds of arguments for raw // closures. This should be implemented by a separate assembly language --- /home/aph/gcc/trunk/libffi/src/x86/ffitarget.h 2009-06-04 18:07:09.000000000 +0100 +++ ./src/x86/ffitarget.h 2008-02-15 01:24:06.000000000 +0000 @@ -78,7 +78,11 @@ #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #else +#ifdef X86_WIN32 +#define FFI_TRAMPOLINE_SIZE 13 +#else #define FFI_TRAMPOLINE_SIZE 10 +#endif #define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ #endif ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 12:53 ` Andrew Haley @ 2009-06-05 13:03 ` Andrew Haley 2009-06-05 13:40 ` Andrew Haley 2009-06-05 13:11 ` Dave Korn 1 sibling, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-05 13:03 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List x86 changes, patch the second: gcc -> libffi Andrew. 2009-06-05 Andrew Haley <aph@redhat.com> * src/x86/win32.S (_ffi_closure_STDCALL): Import from gcc. Index: src/x86/win32.S =================================================================== RCS file: /cvs/libffi/libffi/src/x86/win32.S,v retrieving revision 1.7 diff -u -w -r1.7 win32.S --- src/x86/win32.S 4 Jun 2009 14:43:40 -0000 1.7 +++ src/x86/win32.S 5 Jun 2009 13:01:52 -0000 @@ -264,22 +264,6 @@ .ffi_call_STDCALL_end: .LFE2: - .globl _ffi_closure_STDCALL -_ffi_closure_STDCALL: - pushl %ebp - movl %esp, %ebp - subl $40, %esp - leal -24(%ebp), %edx - movl %edx, -12(%ebp) /* resp */ - leal 12(%ebp), %edx /* account for stub return address on stack */ - movl %edx, 4(%esp) /* args */ - leal -12(%ebp), %edx - movl %edx, (%esp) /* &resp */ - call _ffi_closure_SYSV_inner - movl -12(%ebp), %ecx - jmp .Lcls_return_result -.ffi_closure_STDCALL_end: - # This assumes we are using gas. .balign 16 .globl _ffi_closure_SYSV @@ -299,7 +283,6 @@ movl %edx, (%esp) /* &resp */ call _ffi_closure_SYSV_inner movl -12(%ebp), %ecx -.Lcls_return_result: cmpl $FFI_TYPE_INT, %eax je .Lcls_retint cmpl $FFI_TYPE_FLOAT, %eax @@ -409,6 +392,70 @@ #endif /* !FFI_NO_RAW_API */ + # This assumes we are using gas. + .balign 16 + .globl _ffi_closure_STDCALL + .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef +_ffi_closure_STDCALL: +.LFB5: + pushl %ebp +.LCFI9: + movl %esp, %ebp +.LCFI10: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 12(%ebp), %edx /* account for stub return address on stack */ + movl %edx, 4(%esp) /* args */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx + /* It would be nice to just share this code with the + duplicate sequence in _ffi_closure_SYSV, if only + there were some way to represent that in the EH info. */ + cmpl $FFI_TYPE_INT, %eax + je .Lscls_retint + cmpl $FFI_TYPE_FLOAT, %eax + je .Lscls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lscls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lscls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lscls_retllong + cmpl $FFI_TYPE_SINT8, %eax /* 1-byte struct */ + je .Lscls_retstruct1 + cmpl $FFI_TYPE_SINT16, %eax /* 2-bytes struct */ + je .Lscls_retstruct2 +.Lscls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.Lscls_retint: + movl (%ecx), %eax + jmp .Lscls_epilogue +.Lscls_retfloat: + flds (%ecx) + jmp .Lscls_epilogue +.Lscls_retdouble: + fldl (%ecx) + jmp .Lscls_epilogue +.Lscls_retldouble: + fldt (%ecx) + jmp .Lscls_epilogue +.Lscls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lscls_epilogue +.Lscls_retstruct1: + movsbl (%ecx), %eax + jmp .Lscls_epilogue +.Lscls_retstruct2: + movswl (%ecx), %eax + jmp .Lscls_epilogue +.ffi_closure_STDCALL_end: +.LFE5: .section .eh_frame,"w" .Lframe1: @@ -571,3 +618,34 @@ .LEFDE4: #endif /* !FFI_NO_RAW_API */ + +.LSFDE5: + .long .LEFDE5-.LASFDE5 /* FDE Length */ +.LASFDE5: + .long .LASFDE5-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB5-. /* FDE initial location */ +#else + .long .LFB5 +#endif + .long .LFE5-.LFB5 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI9-.LFB5 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI10-.LCFI9 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE5: ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 13:03 ` Andrew Haley @ 2009-06-05 13:40 ` Andrew Haley 2009-06-05 17:24 ` Andreas Tobler ` (3 more replies) 0 siblings, 4 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-05 13:40 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Testsuite, libffi -> gcc 2008-12-26 Timothy Wall <twall@users.sf.net> * testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_align_longdouble.c, testsuite/libffi.call/cls_align_longdouble_split.c, testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected failures on x86_64 cygwin/mingw. 2008-12-22 Timothy Wall <twall@users.sf.net> * testsuite/libffi.call/closure_fn0.c, testsuite/libffi.call/closure_fn1.c, testsuite/libffi.call/closure_fn2.c, testsuite/libffi.call/closure_fn3.c, testsuite/libffi.call/closure_fn4.c, testsuite/libffi.call/closure_fn5.c, testsuite/libffi.call/closure_fn6.c, testsuite/libffi.call/closure_loc_fn0.c, testsuite/libffi.call/closure_stdcall.c, testsuite/libffi.call/cls_align_pointer.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c: use portable cast from pointer to integer (intptr_t). * testsuite/libffi.call/cls_longdouble.c: disable for win64. 2008-07-24 Anthony Green <green@redhat.com> * testsuite/libffi.call/cls_dbls_struct.c, testsuite/libffi.call/cls_double_va.c, testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c, testsuite/libffi.call/err_bad_abi.c: Clean up failures from compiler warnings. 2008-03-04 Anthony Green <green@redhat.com> Blake Chaffin hos@tamanegi.org * testsuite/libffi.call/cls_align_longdouble_split2.c testsuite/libffi.call/cls_align_longdouble_split.c testsuite/libffi.call/cls_dbls_struct.c testsuite/libffi.call/cls_double_va.c testsuite/libffi.call/cls_longdouble.c testsuite/libffi.call/cls_longdouble_va.c testsuite/libffi.call/cls_pointer.c testsuite/libffi.call/cls_pointer_stack.c testsuite/libffi.call/err_bad_abi.c testsuite/libffi.call/err_bad_typedef.c testsuite/libffi.call/huge_struct.c testsuite/libffi.call/stret_large2.c testsuite/libffi.call/stret_large.c testsuite/libffi.call/stret_medium2.c testsuite/libffi.call/stret_medium.c: New tests from Apple. Index: libffi.call/stret_medium.c =================================================================== --- libffi.call/stret_medium.c (revision 0) +++ libffi.call/stret_medium.c (revision 0) @@ -0,0 +1,132 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +typedef struct struct_72byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + double i; +} struct_72byte; + +struct_72byte cls_struct_72byte_fn( + struct_72byte b0, + struct_72byte b1, + struct_72byte b2, + struct_72byte b3) +{ + struct_72byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + + printf("%g %g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i); + + return result; +} + +static void +cls_struct_72byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) +{ + struct_72byte b0, b1, b2, b3; + + b0 = *(struct_72byte*)(args[0]); + b1 = *(struct_72byte*)(args[1]); + b2 = *(struct_72byte*)(args[2]); + b3 = *(struct_72byte*)(args[3]); + + *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[5]; + ffi_type* cls_struct_fields[10]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 }; + struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 }; + struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 }; + struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 }; + struct_72byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_double; + cls_struct_fields[9] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK); + + res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, + struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + exit(0); +} Index: libffi.call/cls_align_longdouble_split2.c =================================================================== --- libffi.call/cls_align_longdouble_split2.c (revision 0) +++ libffi.call/cls_align_longdouble_split2.c (revision 0) @@ -0,0 +1,120 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of long double. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/18/2007 +*/ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ + +#include "ffitest.h" + +typedef struct cls_struct_align { + long double a; + long double b; + long double c; + long double d; + long double e; + double f; + long double g; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn( + cls_struct_align a1, + cls_struct_align a2) +{ + struct cls_struct_align r; + + r.a = a1.a + a2.a; + r.b = a1.b + a2.b; + r.c = a1.c + a2.c; + r.d = a1.d + a2.d; + r.e = a1.e + a2.e; + r.f = a1.f + a2.f; + r.g = a1.g + a2.g; + + printf("%Lg %Lg %Lg %Lg %Lg %g %Lg %Lg %Lg %Lg %Lg %Lg %g %Lg: " + "%Lg %Lg %Lg %Lg %Lg %g %Lg\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, + r.a, r.b, r.c, r.d, r.e, r.f, r.g); + + return r; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[3]; + ffi_type* cls_struct_fields[8]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_longdouble; + cls_struct_fields[1] = &ffi_type_longdouble; + cls_struct_fields[2] = &ffi_type_longdouble; + cls_struct_fields[3] = &ffi_type_longdouble; + cls_struct_fields[4] = &ffi_type_longdouble; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_longdouble; + cls_struct_fields[7] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + exit(0); +} Index: libffi.call/err_bad_abi.c =================================================================== --- libffi.call/err_bad_abi.c (revision 0) +++ libffi.call/err_bad_abi.c (revision 0) @@ -0,0 +1,45 @@ +/* Area: ffi_prep_cif, ffi_prep_closure + Purpose: Test error return for bad ABIs. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +static void +dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, + void** args __UNUSED__, void* userdata __UNUSED__) +{} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args[1]; + ffi_type* arg_types[1]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + arg_types[0] = NULL; + args[0] = NULL; + + CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, + arg_types) == FFI_BAD_ABI); + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, + arg_types) == FFI_OK); + + cif.abi= 255; + + CHECK(ffi_prep_closure(pcl, &cif, dummy_fn, NULL) == FFI_BAD_ABI); + + exit(0); +} Index: libffi.call/cls_pointer.c =================================================================== --- libffi.call/cls_pointer.c (revision 0) +++ libffi.call/cls_pointer.c (revision 0) @@ -0,0 +1,82 @@ +/* Area: ffi_call, closure_call + Purpose: Check pointer arguments. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +void* cls_pointer_fn(void* a1, void* a2) +{ + void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + + printf("0x%08x 0x%08x: 0x%08x\n", + (unsigned int)(uintptr_t) a1, + (unsigned int)(uintptr_t) a2, + (unsigned int)(uintptr_t) result); + + return result; +} + +static void +cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + void* a1 = *(void**)(args[0]); + void* a2 = *(void**)(args[1]); + + *(void**)resp = cls_pointer_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure* pcl; + void* args[3]; +// ffi_type cls_pointer_type; + ffi_type* arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + +/* cls_pointer_type.size = sizeof(void*); + cls_pointer_type.alignment = 0; + cls_pointer_type.type = FFI_TYPE_POINTER; + cls_pointer_type.elements = NULL;*/ + + void* arg1 = (void*)0x12345678; + void* arg2 = (void*)0x89abcdef; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_pointer; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, + arg_types) == FFI_OK); + + args[0] = &arg1; + args[1] = &arg2; + args[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_pointer_fn), &res, args); + /* { dg-output "0x12345678 0x89abcdef: 0x9be02467" } */ + printf("res: 0x%08x\n", (unsigned int) res); + /* { dg-output "\nres: 0x9be02467" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK); + + res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2); + /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ + printf("res: 0x%08x\n", (unsigned int) res); + /* { dg-output "\nres: 0x9be02467" } */ + + exit(0); +} Index: libffi.call/stret_large.c =================================================================== --- libffi.call/stret_large.c (revision 0) +++ libffi.call/stret_large.c (revision 0) @@ -0,0 +1,153 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +// 13 FPRs: 104 bytes +// 14 FPRs: 112 bytes + +typedef struct struct_108byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + double i; + double j; + double k; + double l; + double m; + int n; +} struct_108byte; + +struct_108byte cls_struct_108byte_fn( + struct_108byte b0, + struct_108byte b1, + struct_108byte b2, + struct_108byte b3) +{ + struct_108byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + result.j = b0.j + b1.j + b2.j + b3.j; + result.k = b0.k + b1.k + b2.k + b3.k; + result.l = b0.l + b1.l + b2.l + b3.l; + result.m = b0.m + b1.m + b2.m + b3.m; + result.n = b0.n + b1.n + b2.n + b3.n; + + printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i, + result.j, result.k, result.l, result.m, result.n); + + return result; +} + +static void +cls_struct_108byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) +{ + struct_108byte b0, b1, b2, b3; + + b0 = *(struct_108byte*)(args[0]); + b1 = *(struct_108byte*)(args[1]); + b2 = *(struct_108byte*)(args[2]); + b3 = *(struct_108byte*)(args[3]); + + *(struct_108byte*)resp = cls_struct_108byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[5]; + ffi_type* cls_struct_fields[15]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 }; + struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 }; + struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 }; + struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 }; + struct_108byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_double; + cls_struct_fields[9] = &ffi_type_double; + cls_struct_fields[10] = &ffi_type_double; + cls_struct_fields[11] = &ffi_type_double; + cls_struct_fields[12] = &ffi_type_double; + cls_struct_fields[13] = &ffi_type_sint32; + cls_struct_fields[14] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_108byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_108byte_gn, NULL) == FFI_OK); + + res_dbl = ((struct_108byte(*)(struct_108byte, struct_108byte, + struct_108byte, struct_108byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + + exit(0); +} Index: libffi.call/err_bad_typedef.c =================================================================== --- libffi.call/err_bad_typedef.c (revision 0) +++ libffi.call/err_bad_typedef.c (revision 0) @@ -0,0 +1,35 @@ +/* Area: ffi_prep_cif + Purpose: Test error return for bad typedefs. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + ffi_type* arg_types[1]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + arg_types[0] = NULL; + + ffi_type badType = ffi_type_void; + + badType.size = 0; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType, + arg_types) == FFI_BAD_TYPEDEF); + + exit(0); +} Index: libffi.call/closure_fn1.c =================================================================== --- libffi.call/closure_fn1.c (revision 148170) +++ libffi.call/closure_fn1.c (working copy) @@ -21,7 +21,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)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)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]), @@ -32,7 +32,7 @@ (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); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type1)(float, float, float, float, signed short, Index: libffi.call/cls_align_longdouble_split.c =================================================================== --- libffi.call/cls_align_longdouble_split.c (revision 0) +++ libffi.call/cls_align_longdouble_split.c (revision 0) @@ -0,0 +1,140 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of long double. + Limitations: none. + PR: none. + Originator: <hos@tamanegi.org> 20031203 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ + +#include "ffitest.h" + +typedef struct cls_struct_align { + long double a; + long double b; + long double c; + long double d; + long double e; + long double f; + long double g; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn( + cls_struct_align a1, + cls_struct_align a2) +{ + struct cls_struct_align r; + + r.a = a1.a + a2.a; + r.b = a1.b + a2.b; + r.c = a1.c + a2.c; + r.d = a1.d + a2.d; + r.e = a1.e + a2.e; + r.f = a1.f + a2.f; + r.g = a1.g + a2.g; + + printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: " + "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, + r.a, r.b, r.c, r.d, r.e, r.f, r.g); + + return r; +} + +cls_struct_align cls_struct_align_fn2( + cls_struct_align a1) +{ + struct cls_struct_align r; + + r.a = a1.a + 1; + r.b = a1.b + 1; + r.c = a1.c + 1; + r.d = a1.d + 1; + r.e = a1.e + 1; + r.f = a1.f + 1; + r.g = a1.g + 1; + + printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg: " + "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + r.a, r.b, r.c, r.d, r.e, r.f, r.g); + + return r; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[3]; + ffi_type* cls_struct_fields[8]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_longdouble; + cls_struct_fields[1] = &ffi_type_longdouble; + cls_struct_fields[2] = &ffi_type_longdouble; + cls_struct_fields[3] = &ffi_type_longdouble; + cls_struct_fields[4] = &ffi_type_longdouble; + cls_struct_fields[5] = &ffi_type_longdouble; + cls_struct_fields[6] = &ffi_type_longdouble; + cls_struct_fields[7] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + exit(0); +} Index: libffi.call/closure_fn3.c =================================================================== --- libffi.call/closure_fn3.c (revision 148170) +++ libffi.call/closure_fn3.c (working copy) @@ -20,7 +20,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)(*(float *)args[14]) + *(int *)args[15] + (intptr_t)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]), @@ -30,7 +30,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)(*(float *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: libffi.call/closure_fn5.c =================================================================== --- libffi.call/closure_fn5.c (revision 148170) +++ libffi.call/closure_fn5.c (working copy) @@ -24,7 +24,7 @@ (int)*(unsigned long long *)args[12] + (int)*(unsigned long long *)args[13] + (int)*(unsigned long long *)args[14] + - *(int *)args[15] + (int)(long)userdata; + *(int *)args[15] + (intptr_t)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], @@ -43,7 +43,7 @@ (int)*(unsigned long long *)args[13], (int)*(unsigned long long *)args[14], *(int *)args[15], - (int)(long)userdata, (int)*(ffi_arg *)resp); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: libffi.call/cls_longdouble.c =================================================================== --- libffi.call/cls_longdouble.c (revision 0) +++ libffi.call/cls_longdouble.c (revision 0) @@ -0,0 +1,111 @@ +/* Area: ffi_call, closure_call + Purpose: Check long double arguments. + Limitations: none. + PR: none. + Originator: Blake Chaffin */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ + +#include "ffitest.h" + +long double cls_ldouble_fn( + long double a1, + long double a2, + long double a3, + long double a4, + long double a5, + long double a6, + long double a7, + long double a8) +{ + long double r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8; + + printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: %Lg\n", + a1, a2, a3, a4, a5, a6, a7, a8, r); + + return r; +} + +static void +cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + long double a1 = *(long double*)args[0]; + long double a2 = *(long double*)args[1]; + long double a3 = *(long double*)args[2]; + long double a4 = *(long double*)args[3]; + long double a5 = *(long double*)args[4]; + long double a6 = *(long double*)args[5]; + long double a7 = *(long double*)args[6]; + long double a8 = *(long double*)args[7]; + + *(long double*)resp = cls_ldouble_fn( + a1, a2, a3, a4, a5, a6, a7, a8); +} + +int main(void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure* pcl; + void* args[9]; + ffi_type* arg_types[9]; + long double res = 0; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + long double arg1 = 1; + long double arg2 = 2; + long double arg3 = 3; + long double arg4 = 4; + long double arg5 = 5; + long double arg6 = 6; + long double arg7 = 7; + long double arg8 = 8; + + arg_types[0] = &ffi_type_longdouble; + arg_types[1] = &ffi_type_longdouble; + arg_types[2] = &ffi_type_longdouble; + arg_types[3] = &ffi_type_longdouble; + arg_types[4] = &ffi_type_longdouble; + arg_types[5] = &ffi_type_longdouble; + arg_types[6] = &ffi_type_longdouble; + arg_types[7] = &ffi_type_longdouble; + arg_types[8] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 8, &ffi_type_longdouble, + arg_types) == FFI_OK); + + args[0] = &arg1; + args[1] = &arg2; + args[2] = &arg3; + args[3] = &arg4; + args[4] = &arg5; + args[5] = &arg6; + args[6] = &arg7; + args[7] = &arg8; + args[8] = NULL; + + ffi_call(&cif, FFI_FN(cls_ldouble_fn), &res, args); + /* { dg-output "1 2 3 4 5 6 7 8: 36" } */ + printf("res: %Lg\n", res); + /* { dg-output "\nres: 36" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_ldouble_gn, NULL) == FFI_OK); + + res = ((long double(*)(long double, long double, long double, long double, + long double, long double, long double, long double))(pcl))(arg1, arg2, + arg3, arg4, arg5, arg6, arg7, arg8); + /* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */ + printf("res: %Lg\n", res); + /* { dg-output "\nres: 36" } */ + + return 0; +} Index: libffi.call/huge_struct.c =================================================================== --- libffi.call/huge_struct.c (revision 0) +++ libffi.call/huge_struct.c (revision 0) @@ -0,0 +1,348 @@ +/* Area: ffi_call, closure_call + Purpose: Check large structure returns. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/18/2007 +*/ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ + +#include <stdint.h> + +#include "ffitest.h" + +typedef struct BigStruct{ + uint8_t a; + int8_t b; + uint16_t c; + int16_t d; + uint32_t e; + int32_t f; + uint64_t g; + int64_t h; + float i; + double j; + long double k; + char* l; + uint8_t m; + int8_t n; + uint16_t o; + int16_t p; + uint32_t q; + int32_t r; + uint64_t s; + int64_t t; + float u; + double v; + long double w; + char* x; + uint8_t y; + int8_t z; + uint16_t aa; + int16_t bb; + uint32_t cc; + int32_t dd; + uint64_t ee; + int64_t ff; + float gg; + double hh; + long double ii; + char* jj; + uint8_t kk; + int8_t ll; + uint16_t mm; + int16_t nn; + uint32_t oo; + int32_t pp; + uint64_t qq; + int64_t rr; + float ss; + double tt; + long double uu; + char* vv; + uint8_t ww; + int8_t xx; +} BigStruct; + +BigStruct +test_large_fn( + uint8_t ui8_1, + int8_t si8_1, + uint16_t ui16_1, + int16_t si16_1, + uint32_t ui32_1, + int32_t si32_1, + uint64_t ui64_1, + int64_t si64_1, + float f_1, + double d_1, + long double ld_1, + char* p_1, + uint8_t ui8_2, + int8_t si8_2, + uint16_t ui16_2, + int16_t si16_2, + uint32_t ui32_2, + int32_t si32_2, + uint64_t ui64_2, + int64_t si64_2, + float f_2, + double d_2, + long double ld_2, + char* p_2, + uint8_t ui8_3, + int8_t si8_3, + uint16_t ui16_3, + int16_t si16_3, + uint32_t ui32_3, + int32_t si32_3, + uint64_t ui64_3, + int64_t si64_3, + float f_3, + double d_3, + long double ld_3, + char* p_3, + uint8_t ui8_4, + int8_t si8_4, + uint16_t ui16_4, + int16_t si16_4, + uint32_t ui32_4, + int32_t si32_4, + uint64_t ui64_4, + int64_t si64_4, + float f_4, + double d_4, + long double ld_4, + char* p_4, + uint8_t ui8_5, + int8_t si8_5) +{ + BigStruct retVal = { + ui8_1 + 1, si8_1 + 1, ui16_1 + 1, si16_1 + 1, ui32_1 + 1, si32_1 + 1, + ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((long)p_1 + 1), + ui8_2 + 2, si8_2 + 2, ui16_2 + 2, si16_2 + 2, ui32_2 + 2, si32_2 + 2, + ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((long)p_2 + 2), + ui8_3 + 3, si8_3 + 3, ui16_3 + 3, si16_3 + 3, ui32_3 + 3, si32_3 + 3, + ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((long)p_3 + 3), + ui8_4 + 4, si8_4 + 4, ui16_4 + 4, si16_4 + 4, ui32_4 + 4, si32_4 + 4, + ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((long)p_4 + 4), + ui8_5 + 5, si8_5 + 5}; + + printf("%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd: " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd\n", + ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, p_1, + ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, p_2, + ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, p_3, + ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, p_4, ui8_5, si8_5, + retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, + retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, retVal.l, + retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, + retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, retVal.x, + retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, + retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, retVal.jj, + retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, + retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, retVal.vv, retVal.ww, retVal.xx); + + return retVal; +} + +static void +cls_large_fn(ffi_cif* cif, void* resp, void** args, void* userdata) +{ + uint8_t ui8_1 = *(uint8_t*)args[0]; + int8_t si8_1 = *(int8_t*)args[1]; + uint16_t ui16_1 = *(uint16_t*)args[2]; + int16_t si16_1 = *(int16_t*)args[3]; + uint32_t ui32_1 = *(uint32_t*)args[4]; + int32_t si32_1 = *(int32_t*)args[5]; + uint64_t ui64_1 = *(uint64_t*)args[6]; + int64_t si64_1 = *(int64_t*)args[7]; + float f_1 = *(float*)args[8]; + double d_1 = *(double*)args[9]; + long double ld_1 = *(long double*)args[10]; + char* p_1 = *(char**)args[11]; + uint8_t ui8_2 = *(uint8_t*)args[12]; + int8_t si8_2 = *(int8_t*)args[13]; + uint16_t ui16_2 = *(uint16_t*)args[14]; + int16_t si16_2 = *(int16_t*)args[15]; + uint32_t ui32_2 = *(uint32_t*)args[16]; + int32_t si32_2 = *(int32_t*)args[17]; + uint64_t ui64_2 = *(uint64_t*)args[18]; + int64_t si64_2 = *(int64_t*)args[19]; + float f_2 = *(float*)args[20]; + double d_2 = *(double*)args[21]; + long double ld_2 = *(long double*)args[22]; + char* p_2 = *(char**)args[23]; + uint8_t ui8_3 = *(uint8_t*)args[24]; + int8_t si8_3 = *(int8_t*)args[25]; + uint16_t ui16_3 = *(uint16_t*)args[26]; + int16_t si16_3 = *(int16_t*)args[27]; + uint32_t ui32_3 = *(uint32_t*)args[28]; + int32_t si32_3 = *(int32_t*)args[29]; + uint64_t ui64_3 = *(uint64_t*)args[30]; + int64_t si64_3 = *(int64_t*)args[31]; + float f_3 = *(float*)args[32]; + double d_3 = *(double*)args[33]; + long double ld_3 = *(long double*)args[34]; + char* p_3 = *(char**)args[35]; + uint8_t ui8_4 = *(uint8_t*)args[36]; + int8_t si8_4 = *(int8_t*)args[37]; + uint16_t ui16_4 = *(uint16_t*)args[38]; + int16_t si16_4 = *(int16_t*)args[39]; + uint32_t ui32_4 = *(uint32_t*)args[40]; + int32_t si32_4 = *(int32_t*)args[41]; + uint64_t ui64_4 = *(uint64_t*)args[42]; + int64_t si64_4 = *(int64_t*)args[43]; + float f_4 = *(float*)args[44]; + double d_4 = *(double*)args[45]; + long double ld_4 = *(long double*)args[46]; + char* p_4 = *(char**)args[47]; + uint8_t ui8_5 = *(uint8_t*)args[48]; + int8_t si8_5 = *(int8_t*)args[49]; + + *(BigStruct*)resp = test_large_fn( + ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, p_1, + ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, p_2, + ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, p_3, + ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, p_4, + ui8_5, si8_5); +} + +int +main(int argc, const char** argv) +{ +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + ffi_cif cif; + ffi_type* argTypes[51]; + void* argValues[51]; + + ffi_type ret_struct_type; + ffi_type* st_fields[51]; + BigStruct retVal = {0}; + + ret_struct_type.size = 0; + ret_struct_type.alignment = 0; + ret_struct_type.type = FFI_TYPE_STRUCT; + ret_struct_type.elements = st_fields; + + st_fields[0] = st_fields[12] = st_fields[24] = st_fields[36] = st_fields[48] = &ffi_type_uint8; + st_fields[1] = st_fields[13] = st_fields[25] = st_fields[37] = st_fields[49] = &ffi_type_sint8; + st_fields[2] = st_fields[14] = st_fields[26] = st_fields[38] = &ffi_type_uint16; + st_fields[3] = st_fields[15] = st_fields[27] = st_fields[39] = &ffi_type_sint16; + st_fields[4] = st_fields[16] = st_fields[28] = st_fields[40] = &ffi_type_uint32; + st_fields[5] = st_fields[17] = st_fields[29] = st_fields[41] = &ffi_type_sint32; + st_fields[6] = st_fields[18] = st_fields[30] = st_fields[42] = &ffi_type_uint64; + st_fields[7] = st_fields[19] = st_fields[31] = st_fields[43] = &ffi_type_sint64; + st_fields[8] = st_fields[20] = st_fields[32] = st_fields[44] = &ffi_type_float; + st_fields[9] = st_fields[21] = st_fields[33] = st_fields[45] = &ffi_type_double; + st_fields[10] = st_fields[22] = st_fields[34] = st_fields[46] = &ffi_type_longdouble; + st_fields[11] = st_fields[23] = st_fields[35] = st_fields[47] = &ffi_type_pointer; + + st_fields[50] = NULL; + + uint8_t ui8 = 1; + int8_t si8 = 2; + uint16_t ui16 = 3; + int16_t si16 = 4; + uint32_t ui32 = 5; + int32_t si32 = 6; + uint64_t ui64 = 7; + int64_t si64 = 8; + float f = 9; + double d = 10; + long double ld = 11; + char* p = (char*)0x12345678; + + argTypes[0] = argTypes[12] = argTypes[24] = argTypes[36] = argTypes[48] = &ffi_type_uint8; + argValues[0] = argValues[12] = argValues[24] = argValues[36] = argValues[48] = &ui8; + argTypes[1] = argTypes[13] = argTypes[25] = argTypes[37] = argTypes[49] = &ffi_type_sint8; + argValues[1] = argValues[13] = argValues[25] = argValues[37] = argValues[49] = &si8; + argTypes[2] = argTypes[14] = argTypes[26] = argTypes[38] = &ffi_type_uint16; + argValues[2] = argValues[14] = argValues[26] = argValues[38] = &ui16; + argTypes[3] = argTypes[15] = argTypes[27] = argTypes[39] = &ffi_type_sint16; + argValues[3] = argValues[15] = argValues[27] = argValues[39] = &si16; + argTypes[4] = argTypes[16] = argTypes[28] = argTypes[40] = &ffi_type_uint32; + argValues[4] = argValues[16] = argValues[28] = argValues[40] = &ui32; + argTypes[5] = argTypes[17] = argTypes[29] = argTypes[41] = &ffi_type_sint32; + argValues[5] = argValues[17] = argValues[29] = argValues[41] = &si32; + argTypes[6] = argTypes[18] = argTypes[30] = argTypes[42] = &ffi_type_uint64; + argValues[6] = argValues[18] = argValues[30] = argValues[42] = &ui64; + argTypes[7] = argTypes[19] = argTypes[31] = argTypes[43] = &ffi_type_sint64; + argValues[7] = argValues[19] = argValues[31] = argValues[43] = &si64; + argTypes[8] = argTypes[20] = argTypes[32] = argTypes[44] = &ffi_type_float; + argValues[8] = argValues[20] = argValues[32] = argValues[44] = &f; + argTypes[9] = argTypes[21] = argTypes[33] = argTypes[45] = &ffi_type_double; + argValues[9] = argValues[21] = argValues[33] = argValues[45] = &d; + argTypes[10] = argTypes[22] = argTypes[34] = argTypes[46] = &ffi_type_longdouble; + argValues[10] = argValues[22] = argValues[34] = argValues[46] = &ld; + argTypes[11] = argTypes[23] = argTypes[35] = argTypes[47] = &ffi_type_pointer; + argValues[11] = argValues[23] = argValues[35] = argValues[47] = &p; + + argTypes[50] = NULL; + argValues[50] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK); + + ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues); + // { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + printf("res: %hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd\n", + retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, + retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, retVal.l, + retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, + retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, retVal.x, + retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, + retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, retVal.jj, + retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, + retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, retVal.vv, retVal.ww, retVal.xx); + // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + + CHECK(ffi_prep_closure(pcl, &cif, cls_large_fn, NULL) == FFI_OK); + + retVal = ((BigStruct(*)( + uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, + uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, + uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, + uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, + uint8_t, int8_t))(pcl))( + ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, + ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, + ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, + ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, + ui8, si8); + // { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + printf("res: %hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd\n", + retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, + retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, retVal.l, + retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, + retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, retVal.x, + retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, + retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, retVal.jj, + retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, + retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, retVal.vv, retVal.ww, retVal.xx); + // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + + return 0; +} Index: libffi.call/cls_double_va.c =================================================================== --- libffi.call/cls_double_va.c (revision 0) +++ libffi.call/cls_double_va.c (revision 0) @@ -0,0 +1,64 @@ +/* Area: ffi_call, closure_call + Purpose: Test doubles passed in variable argument lists. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +static void +cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + char* format = *(char**)args[0]; + double doubleValue = *(double*)args[1]; + + *(ffi_arg*)resp = printf(format, doubleValue); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args[3]; + ffi_type* arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + char* format = "%.1f\n"; + double doubleArg = 7; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_double; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + arg_types) == FFI_OK); + + args[0] = &format; + args[1] = &doubleArg; + args[2] = NULL; + + ffi_call(&cif, FFI_FN(printf), &res, args); + // { dg-output "7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + CHECK(ffi_prep_closure(pcl, &cif, cls_double_va_fn, NULL) == FFI_OK); + + res = ((int(*)(char*, double))(pcl))(format, doubleArg); + // { dg-output "\n7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + exit(0); +} Index: libffi.call/cls_pointer_stack.c =================================================================== --- libffi.call/cls_pointer_stack.c (revision 0) +++ libffi.call/cls_pointer_stack.c (revision 0) @@ -0,0 +1,148 @@ +/* Area: ffi_call, closure_call + Purpose: Check pointer arguments across multiple hideous stack frames. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/7/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +static long dummyVar; + +long dummy_func( + long double a1, char b1, + long double a2, char b2, + long double a3, char b3, + long double a4, char b4) +{ + return a1 + b1 + a2 + b2 + a3 + b3 + a4 + b4; +} + +void* cls_pointer_fn2(void* a1, void* a2) +{ + long double trample1 = (intptr_t)a1 + (intptr_t)a2; + char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; + long double trample3 = (intptr_t)trample1 + (intptr_t)a1; + char trample4 = trample2 + ((char*)&a1)[1]; + long double trample5 = (intptr_t)trample3 + (intptr_t)a2; + char trample6 = trample4 + ((char*)&a2)[1]; + long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; + char trample8 = trample6 + trample2; + + dummyVar = dummy_func(trample1, trample2, trample3, trample4, + trample5, trample6, trample7, trample8); + + void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + + printf("0x%08x 0x%08x: 0x%08x\n", + (unsigned int)(uintptr_t) a1, + (unsigned int)(uintptr_t) a2, + (unsigned int)(uintptr_t) result); + + return result; +} + +void* cls_pointer_fn1(void* a1, void* a2) +{ + long double trample1 = (intptr_t)a1 + (intptr_t)a2; + char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; + long double trample3 = (intptr_t)trample1 + (intptr_t)a1; + char trample4 = trample2 + ((char*)&a1)[1]; + long double trample5 = (intptr_t)trample3 + (intptr_t)a2; + char trample6 = trample4 + ((char*)&a2)[1]; + long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; + char trample8 = trample6 + trample2; + + dummyVar = dummy_func(trample1, trample2, trample3, trample4, + trample5, trample6, trample7, trample8); + + void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + + printf("0x%08x 0x%08x: 0x%08x\n", + (unsigned int)(intptr_t) a1, + (unsigned int)(intptr_t) a2, + (unsigned int)(intptr_t) result); + + result = cls_pointer_fn2(result, a1); + + return result; +} + +static void +cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + void* a1 = *(void**)(args[0]); + void* a2 = *(void**)(args[1]); + + long double trample1 = (intptr_t)a1 + (intptr_t)a2; + char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; + long double trample3 = (intptr_t)trample1 + (intptr_t)a1; + char trample4 = trample2 + ((char*)&a1)[1]; + long double trample5 = (intptr_t)trample3 + (intptr_t)a2; + char trample6 = trample4 + ((char*)&a2)[1]; + long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; + char trample8 = trample6 + trample2; + + dummyVar = dummy_func(trample1, trample2, trample3, trample4, + trample5, trample6, trample7, trample8); + + *(void**)resp = cls_pointer_fn1(a1, a2); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure* pcl; + void* args[3]; +// ffi_type cls_pointer_type; + ffi_type* arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + +/* cls_pointer_type.size = sizeof(void*); + cls_pointer_type.alignment = 0; + cls_pointer_type.type = FFI_TYPE_POINTER; + cls_pointer_type.elements = NULL;*/ + + void* arg1 = (void*)0x01234567; + void* arg2 = (void*)0x89abcdef; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_pointer; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, + arg_types) == FFI_OK); + + args[0] = &arg1; + args[1] = &arg2; + args[2] = NULL; + + printf("\n"); + ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); + + printf("res: 0x%08x\n", (unsigned int) res); + // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } + // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } + // { dg-output "\nres: 0x8bf258bd" } + + CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK); + + res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2); + + printf("res: 0x%08x\n", (unsigned int) res); + // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } + // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } + // { dg-output "\nres: 0x8bf258bd" } + + exit(0); +} Index: libffi.call/closure_loc_fn0.c =================================================================== --- libffi.call/closure_loc_fn0.c (revision 0) +++ libffi.call/closure_loc_fn0.c (revision 0) @@ -0,0 +1,95 @@ +/* Area: closure_call + Purpose: Check multiple values passing from different type. + Also, exceed the limit of gpr and fpr registers on PowerPC + Darwin. + Limitations: none. + PR: none. + Originator: <andreast@gcc.gnu.org> 20030828 */ + + + + +/* { dg-do run } */ +#include "ffitest.h" + +static void +closure_loc_test_fn0(ffi_cif* cif __UNUSED__, 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] + (intptr_t)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)(intptr_t)userdata, (int)*(ffi_arg *)resp); + +} + +typedef int (*closure_loc_test_type0)(unsigned long long, int, unsigned long long, + int, signed short, unsigned long long, int, + int, double, int, int, float, int, int, + int, int); + +int main (void) +{ + ffi_cif cif; + ffi_closure *pcl; + ffi_type * cl_arg_types[17]; + int res; + void *codeloc; + + cl_arg_types[0] = &ffi_type_uint64; + cl_arg_types[1] = &ffi_type_sint; + cl_arg_types[2] = &ffi_type_uint64; + cl_arg_types[3] = &ffi_type_sint; + cl_arg_types[4] = &ffi_type_sshort; + cl_arg_types[5] = &ffi_type_uint64; + cl_arg_types[6] = &ffi_type_sint; + cl_arg_types[7] = &ffi_type_sint; + cl_arg_types[8] = &ffi_type_double; + cl_arg_types[9] = &ffi_type_sint; + cl_arg_types[10] = &ffi_type_sint; + cl_arg_types[11] = &ffi_type_float; + cl_arg_types[12] = &ffi_type_sint; + cl_arg_types[13] = &ffi_type_sint; + cl_arg_types[14] = &ffi_type_sint; + cl_arg_types[15] = &ffi_type_sint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + pcl = ffi_closure_alloc(sizeof(ffi_closure), &codeloc); + CHECK(pcl != NULL); + CHECK(codeloc != NULL); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0, + (void *) 3 /* userdata */, codeloc) == FFI_OK); + + CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0); + + res = (*((closure_loc_test_type0)codeloc)) + (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, + 19, 21, 1); + /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 680" } */ + exit(0); +} Index: libffi.call/cls_dbls_struct.c =================================================================== --- libffi.call/cls_dbls_struct.c (revision 0) +++ libffi.call/cls_dbls_struct.c (revision 0) @@ -0,0 +1,75 @@ +/* Area: ffi_call, closure_call + Purpose: Check double arguments in structs. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/23/2007 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef struct Dbls { + double x; + double y; +} Dbls; + +void +closure_test_fn(Dbls p) +{ + printf("%.1f %.1f\n", p.x, p.y); +} + +void +closure_test_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, + void** args, void* userdata __UNUSED__) +{ + closure_test_fn(*(Dbls*)args[0]); +} + +int main(int argc __UNUSED__, char** argv __UNUSED__) +{ + ffi_cif cif; + +#ifndef USING_MMAP + static ffi_closure cl; +#endif + + ffi_closure* pcl; + ffi_type* cl_arg_types[1]; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + ffi_type ts1_type; + ffi_type* ts1_type_elements[4]; + + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + + ts1_type_elements[0] = &ffi_type_double; + ts1_type_elements[1] = &ffi_type_double; + ts1_type_elements[2] = NULL; + + cl_arg_types[0] = &ts1_type; + + Dbls arg = { 1.0, 2.0 }; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_void, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure(pcl, &cif, closure_test_gn, NULL) == FFI_OK); + + ((void*(*)(Dbls))(pcl))(arg); + /* { dg-output "1.0 2.0\n" } */ + + closure_test_fn(arg); + /* { dg-output "1.0 2.0\n" } */ + + return 0; +} Index: libffi.call/stret_large2.c =================================================================== --- libffi.call/stret_large2.c (revision 0) +++ libffi.call/stret_large2.c (revision 0) @@ -0,0 +1,156 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +// 13 FPRs: 104 bytes +// 14 FPRs: 112 bytes + +typedef struct struct_116byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + double i; + double j; + double k; + double l; + double m; + double n; + int o; +} struct_116byte; + +struct_116byte cls_struct_116byte_fn( + struct_116byte b0, + struct_116byte b1, + struct_116byte b2, + struct_116byte b3) +{ + struct_116byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + result.j = b0.j + b1.j + b2.j + b3.j; + result.k = b0.k + b1.k + b2.k + b3.k; + result.l = b0.l + b1.l + b2.l + b3.l; + result.m = b0.m + b1.m + b2.m + b3.m; + result.n = b0.n + b1.n + b2.n + b3.n; + result.o = b0.o + b1.o + b2.o + b3.o; + + printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i, + result.j, result.k, result.l, result.m, result.n, result.o); + + return result; +} + +static void +cls_struct_116byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) +{ + struct_116byte b0, b1, b2, b3; + + b0 = *(struct_116byte*)(args[0]); + b1 = *(struct_116byte*)(args[1]); + b2 = *(struct_116byte*)(args[2]); + b3 = *(struct_116byte*)(args[3]); + + *(struct_116byte*)resp = cls_struct_116byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[5]; + ffi_type* cls_struct_fields[16]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 }; + struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 }; + struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 }; + struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 }; + struct_116byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_double; + cls_struct_fields[9] = &ffi_type_double; + cls_struct_fields[10] = &ffi_type_double; + cls_struct_fields[11] = &ffi_type_double; + cls_struct_fields[12] = &ffi_type_double; + cls_struct_fields[13] = &ffi_type_double; + cls_struct_fields[14] = &ffi_type_sint32; + cls_struct_fields[15] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_116byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_116byte_gn, NULL) == FFI_OK); + + res_dbl = ((struct_116byte(*)(struct_116byte, struct_116byte, + struct_116byte, struct_116byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + + exit(0); +} Index: libffi.call/cls_align_longdouble.c =================================================================== --- libffi.call/cls_align_longdouble.c (revision 148170) +++ libffi.call/cls_align_longdouble.c (working copy) @@ -4,7 +4,7 @@ PR: none. Originator: <hos@tamanegi.org> 20031203 */ -/* { dg-do run } */ +/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" Index: libffi.call/ffitest.h =================================================================== --- libffi.call/ffitest.h (revision 148170) +++ libffi.call/ffitest.h (working copy) @@ -2,6 +2,8 @@ #include <stdio.h> #include <string.h> #include <fcntl.h> +#include <stdint.h> +#include <inttypes.h> #include <ffi.h> #include "fficonfig.h" Index: libffi.call/closure_fn0.c =================================================================== --- libffi.call/closure_fn0.c (revision 148170) +++ libffi.call/closure_fn0.c (working copy) @@ -25,7 +25,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)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)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]), @@ -37,7 +37,7 @@ (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); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: libffi.call/closure_fn2.c =================================================================== --- libffi.call/closure_fn2.c (revision 148170) +++ libffi.call/closure_fn2.c (working copy) @@ -20,7 +20,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)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)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]), @@ -30,7 +30,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)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: libffi.call/cls_longdouble_va.c =================================================================== --- libffi.call/cls_longdouble_va.c (revision 0) +++ libffi.call/cls_longdouble_va.c (revision 0) @@ -0,0 +1,64 @@ +/* Area: ffi_call, closure_call + Purpose: Test long doubles passed in variable argument lists. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +#include "ffitest.h" + +static void +cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + char* format = *(char**)args[0]; + long double ldValue = *(long double*)args[1]; + + *(ffi_arg*)resp = printf(format, ldValue); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args[3]; + ffi_type* arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + char* format = "%L.1f\n"; + long double ldArg = 7; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_longdouble; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + arg_types) == FFI_OK); + + args[0] = &format; + args[1] = &ldArg; + args[2] = NULL; + + ffi_call(&cif, FFI_FN(printf), &res, args); + // { dg-output "7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + CHECK(ffi_prep_closure(pcl, &cif, cls_longdouble_va_fn, NULL) == FFI_OK); + + res = ((int(*)(char*, long double))(pcl))(format, ldArg); + // { dg-output "\n7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + exit(0); +} Index: libffi.call/closure_stdcall.c =================================================================== --- libffi.call/closure_stdcall.c (revision 0) +++ libffi.call/closure_stdcall.c (revision 0) @@ -0,0 +1,72 @@ +/* Area: closure_call (stdcall convention) + Purpose: Check handling when caller expects stdcall callee + Limitations: none. + PR: none. + Originator: <twalljava@dev.java.net> */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +#include "ffitest.h" + +static void +closure_test_stdcall(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(int *)args[0] + (int)(*(int *)args[1]) + + (int)(*(int *)args[2]) + (int)(*(int *)args[3]) + + (int)(intptr_t)userdata; + + printf("%d %d %d %d: %d\n", + (int)*(int *)args[0], (int)(*(int *)args[1]), + (int)(*(int *)args[2]), (int)(*(int *)args[3]), + (int)*(ffi_arg *)resp); + +} + +typedef int (__stdcall *closure_test_type0)(int, int, int, int); + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + ffi_type * cl_arg_types[17]; + int res; + void* sp_pre; + void* sp_post; + char buf[1024]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cl_arg_types[0] = &ffi_type_uint; + cl_arg_types[1] = &ffi_type_uint; + cl_arg_types[2] = &ffi_type_uint; + cl_arg_types[3] = &ffi_type_uint; + cl_arg_types[4] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 4, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure(pcl, &cif, closure_test_stdcall, + (void *) 3 /* userdata */) == FFI_OK); + + asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); + res = (*(closure_test_type0)pcl)(0, 1, 2, 3); + asm volatile (" movl %%esp,%0" : "=g" (sp_post)); + /* { dg-output "0 1 2 3: 9" } */ + + printf("res: %d\n",res); + /* { dg-output "\nres: 9" } */ + + sprintf(buf, "mismatch: pre=%p vs post=%p", sp_pre, sp_post); + printf("stack pointer %s\n", (sp_pre == sp_post ? "match" : buf)); + /* { dg-output "\nstack pointer match" } */ + exit(0); +} Index: libffi.call/closure_fn4.c =================================================================== --- libffi.call/closure_fn4.c (revision 148170) +++ libffi.call/closure_fn4.c (working copy) @@ -25,7 +25,7 @@ (int)*(unsigned long long *)args[12] + (int)*(unsigned long long *)args[13] + (int)*(unsigned long long *)args[14] + - *(int *)args[15] + (int)(long)userdata; + *(int *)args[15] + (intptr_t)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], @@ -44,7 +44,7 @@ (int)*(unsigned long long *)args[13], (int)*(unsigned long long *)args[14], *(int *)args[15], - (int)(long)userdata, (int)*(ffi_arg *)resp); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: libffi.call/stret_medium2.c =================================================================== --- libffi.call/stret_medium2.c (revision 0) +++ libffi.call/stret_medium2.c (revision 0) @@ -0,0 +1,132 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +typedef struct struct_72byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + long long i; +} struct_72byte; + +struct_72byte cls_struct_72byte_fn( + struct_72byte b0, + struct_72byte b1, + struct_72byte b2, + struct_72byte b3) +{ + struct_72byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + + printf("%g %g %g %g %g %g %g %g %lld\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i); + + return result; +} + +static void +cls_struct_72byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) +{ + struct_72byte b0, b1, b2, b3; + + b0 = *(struct_72byte*)(args[0]); + b1 = *(struct_72byte*)(args[1]); + b2 = *(struct_72byte*)(args[2]); + b3 = *(struct_72byte*)(args[3]); + + *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[5]; + ffi_type* cls_struct_fields[10]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 }; + struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 }; + struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 }; + struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 }; + struct_72byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_sint64; + cls_struct_fields[9] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK); + + res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, + struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + exit(0); +} Index: libffi.call/closure_fn6.c =================================================================== --- libffi.call/closure_fn6.c (revision 148170) +++ libffi.call/closure_fn6.c (working copy) @@ -23,7 +23,7 @@ (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(double *)args[14]) + (int)*(double *)args[15] + - (int)(long)userdata; + (intptr_t)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], @@ -36,7 +36,7 @@ (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(double *)args[14]), (int)(*(double *)args[15]), - (int)(long)userdata, (int)*(ffi_arg *)resp); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: libffi.call/cls_align_pointer.c =================================================================== --- libffi.call/cls_align_pointer.c (revision 148170) +++ libffi.call/cls_align_pointer.c (working copy) @@ -19,11 +19,13 @@ struct cls_struct_align result; result.a = a1.a + a2.a; - result.b = (void *)((unsigned long)a1.b + (unsigned long)a2.b); + result.b = (void *)((uintptr_t)a1.b + (uintptr_t)a2.b); result.c = a1.c + a2.c; - printf("%d %lu %d %d %lu %d: %d %lu %d\n", a1.a, (unsigned long)a1.b, a1.c, - a2.a, (unsigned long)a2.b, a2.c, result.a, (unsigned long)result.b, + printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n", + a1.a, (uintptr_t)a1.b, a1.c, + a2.a, (uintptr_t)a2.b, a2.c, + result.a, (uintptr_t)result.b, result.c); return result; @@ -87,14 +89,14 @@ ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %lu %d\n", res_dbl.a, (unsigned long)res_dbl.b, res_dbl.c); + printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %lu %d\n", res_dbl.a, (unsigned long)res_dbl.b, res_dbl.c); + printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); Index: lib/libffi-dg.exp =================================================================== --- lib/libffi-dg.exp (revision 148170) +++ lib/libffi-dg.exp (working copy) @@ -16,7 +16,7 @@ proc load_gcc_lib { filename } { global srcdir - load_file $srcdir/../../gcc/testsuite/lib/$filename + load_file $srcdir/lib/$filename } load_lib dg.exp @@ -94,7 +94,6 @@ global srcdir global blddirffi global objdir - global blddircxx global TOOL_OPTIONS global tool global libffi_include @@ -102,10 +101,8 @@ global tool_root_dir global ld_library_path - set blddirffi [lookfor_file [get_multilibs] libffi] + set blddirffi [pwd]/.. verbose "libffi $blddirffi" - set blddircxx [lookfor_file [get_multilibs] libstdc++-v3] - verbose "libstdc++ $blddircxx" set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] if {$gccdir != ""} { @@ -132,8 +129,6 @@ } # add the library path for libffi. append ld_library_path ":${blddirffi}/.libs" - # add the library path for libstdc++ as well. - append ld_library_path ":${blddircxx}/src/.libs" verbose "ld_library_path: $ld_library_path" @@ -146,7 +141,6 @@ if { $libffi_dir != "" } { set libffi_dir [file dirname ${libffi_dir}] set libffi_link_flags "-L${libffi_dir}/.libs" - lappend libffi_link_flags "-L${blddircxx}/src/.libs" } set_ld_library_path_env_vars Index: Makefile.am =================================================================== --- Makefile.am (revision 148170) +++ Makefile.am (working copy) @@ -14,3 +14,58 @@ AM_RUNTESTFLAGS = CLEANFILES = *.exe core* *.log *.sum + +EXTRA_DIST = config/default.exp lib/libffi-dg.exp \ + lib/target-libpath.exp lib/wrapper.exp libffi.call/call.exp \ + libffi.call/closure_fn0.c libffi.call/closure_fn1.c \ + libffi.call/closure_fn2.c libffi.call/closure_fn3.c \ + libffi.call/closure_fn4.c libffi.call/closure_fn5.c \ + libffi.call/closure_fn6.c libffi.call/closure_stdcall.c \ + libffi.call/cls_1_1byte.c libffi.call/cls_12byte.c \ + libffi.call/cls_16byte.c libffi.call/cls_18byte.c \ + libffi.call/cls_19byte.c libffi.call/cls_20byte1.c \ + libffi.call/cls_20byte.c libffi.call/cls_24byte.c \ + libffi.call/cls_2byte.c libffi.call/cls_3_1byte.c \ + libffi.call/cls_3byte1.c libffi.call/cls_3byte2.c \ + libffi.call/cls_4_1byte.c libffi.call/cls_4byte.c \ + libffi.call/cls_5_1_byte.c libffi.call/cls_5byte.c \ + libffi.call/cls_6_1_byte.c libffi.call/cls_64byte.c \ + libffi.call/cls_6byte.c libffi.call/cls_7_1_byte.c \ + libffi.call/cls_7byte.c libffi.call/cls_8byte.c \ + libffi.call/cls_9byte1.c libffi.call/cls_9byte2.c \ + libffi.call/cls_align_double.c libffi.call/cls_align_float.c \ + libffi.call/cls_align_longdouble.c libffi.call/cls_align_pointer.c \ + libffi.call/cls_align_sint16.c libffi.call/cls_align_sint32.c \ + libffi.call/cls_align_sint64.c libffi.call/cls_align_uint16.c \ + libffi.call/cls_align_uint32.c libffi.call/cls_align_uint64.c \ + libffi.call/cls_double.c libffi.call/cls_float.c \ + libffi.call/cls_multi_schar.c libffi.call/cls_multi_sshort.c \ + libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_uchar.c \ + libffi.call/cls_multi_ushort.c libffi.call/cls_multi_ushortchar.c \ + libffi.call/cls_schar.c libffi.call/cls_sint.c \ + libffi.call/cls_sshort.c libffi.call/cls_uchar.c \ + libffi.call/cls_uint.c libffi.call/cls_ulonglong.c \ + libffi.call/cls_ushort.c libffi.call/ffitest.h libffi.call/float1.c \ + libffi.call/float2.c libffi.call/float3.c libffi.call/float4.c \ + libffi.call/float.c libffi.call/many.c libffi.call/many_win32.c \ + libffi.call/negint.c libffi.call/nested_struct10.c \ + libffi.call/nested_struct1.c libffi.call/nested_struct2.c \ + libffi.call/nested_struct3.c libffi.call/nested_struct4.c \ + libffi.call/nested_struct5.c libffi.call/nested_struct6.c \ + libffi.call/nested_struct7.c libffi.call/nested_struct8.c \ + libffi.call/nested_struct9.c libffi.call/nested_struct.c \ + libffi.call/problem1.c libffi.call/promotion.c \ + libffi.call/pyobjc-tc.c libffi.call/return_dbl1.c \ + libffi.call/return_dbl2.c libffi.call/return_dbl.c \ + libffi.call/return_fl1.c libffi.call/return_fl2.c \ + libffi.call/return_fl3.c libffi.call/return_fl.c \ + libffi.call/return_ldl.c libffi.call/return_ll1.c \ + libffi.call/return_ll.c libffi.call/return_sc.c \ + libffi.call/return_sl.c libffi.call/return_uc.c \ + libffi.call/return_ul.c libffi.call/strlen.c \ + libffi.call/strlen_win32.c libffi.call/struct1.c \ + libffi.call/struct2.c libffi.call/struct3.c libffi.call/struct4.c \ + libffi.call/struct5.c libffi.call/struct6.c libffi.call/struct7.c \ + libffi.call/struct8.c libffi.call/struct9.c \ + libffi.special/ffitestcxx.h libffi.special/special.exp \ + libffi.special/unwindtest.cc libffi.special/unwindtest_ffi_call.cc ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 13:40 ` Andrew Haley @ 2009-06-05 17:24 ` Andreas Tobler 2009-06-05 17:37 ` Andrew Haley 2009-06-08 17:03 ` Andrew Haley ` (2 subsequent siblings) 3 siblings, 1 reply; 91+ messages in thread From: Andreas Tobler @ 2009-06-05 17:24 UTC (permalink / raw) To: Andrew Haley Cc: Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Index: libffi.call/closure_loc_fn0.c > =================================================================== > --- libffi.call/closure_loc_fn0.c (revision 0) > +++ libffi.call/closure_loc_fn0.c (revision 0) > @@ -0,0 +1,95 @@ > +/* Area: closure_call > + Purpose: Check multiple values passing from different type. > + Also, exceed the limit of gpr and fpr registers on PowerPC > + Darwin. > + Limitations: none. > + PR: none. > + Originator: <andreast@gcc.gnu.org> 20030828 */ > + The above is not from me, I know, nitpicking. > Index: lib/libffi-dg.exp > =================================================================== > --- lib/libffi-dg.exp (revision 148170) > +++ lib/libffi-dg.exp (working copy) > @@ -16,7 +16,7 @@ > > proc load_gcc_lib { filename } { > global srcdir > - load_file $srcdir/../../gcc/testsuite/lib/$filename > + load_file $srcdir/lib/$filename > } > > load_lib dg.exp > @@ -94,7 +94,6 @@ > global srcdir > global blddirffi > global objdir > - global blddircxx > global TOOL_OPTIONS > global tool > global libffi_include > @@ -102,10 +101,8 @@ > global tool_root_dir > global ld_library_path > > - set blddirffi [lookfor_file [get_multilibs] libffi] > + set blddirffi [pwd]/.. > verbose "libffi $blddirffi" > - set blddircxx [lookfor_file [get_multilibs] libstdc++-v3] > - verbose "libstdc++ $blddircxx" > > set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] > if {$gccdir != ""} { > @@ -132,8 +129,6 @@ > } > # add the library path for libffi. > append ld_library_path ":${blddirffi}/.libs" > - # add the library path for libstdc++ as well. > - append ld_library_path ":${blddircxx}/src/.libs" > > verbose "ld_library_path: $ld_library_path" > > @@ -146,7 +141,6 @@ > if { $libffi_dir != "" } { > set libffi_dir [file dirname ${libffi_dir}] > set libffi_link_flags "-L${libffi_dir}/.libs" > - lappend libffi_link_flags "-L${blddircxx}/src/.libs" > } > > set_ld_library_path_env_vars Do we really want that? As I remember we wanted to test against the built libraries from gcc. Also, we have multilib configs in gcc which will no longer be tested with the above, or not correctly. > Index: Makefile.am > =================================================================== > --- Makefile.am (revision 148170) > +++ Makefile.am (working copy) > @@ -14,3 +14,58 @@ > AM_RUNTESTFLAGS = > > CLEANFILES = *.exe core* *.log *.sum > + > +EXTRA_DIST = config/default.exp lib/libffi-dg.exp \ > + lib/target-libpath.exp lib/wrapper.exp libffi.call/call.exp \ > + libffi.call/closure_fn0.c libffi.call/closure_fn1.c \ > + libffi.call/closure_fn2.c libffi.call/closure_fn3.c \ > + libffi.call/closure_fn4.c libffi.call/closure_fn5.c \ > + libffi.call/closure_fn6.c libffi.call/closure_stdcall.c \ > + libffi.call/cls_1_1byte.c libffi.call/cls_12byte.c \ > + libffi.call/cls_16byte.c libffi.call/cls_18byte.c \ > + libffi.call/cls_19byte.c libffi.call/cls_20byte1.c \ > + libffi.call/cls_20byte.c libffi.call/cls_24byte.c \ > + libffi.call/cls_2byte.c libffi.call/cls_3_1byte.c \ > + libffi.call/cls_3byte1.c libffi.call/cls_3byte2.c \ > + libffi.call/cls_4_1byte.c libffi.call/cls_4byte.c \ > + libffi.call/cls_5_1_byte.c libffi.call/cls_5byte.c \ > + libffi.call/cls_6_1_byte.c libffi.call/cls_64byte.c \ > + libffi.call/cls_6byte.c libffi.call/cls_7_1_byte.c \ > + libffi.call/cls_7byte.c libffi.call/cls_8byte.c \ > + libffi.call/cls_9byte1.c libffi.call/cls_9byte2.c \ > + libffi.call/cls_align_double.c libffi.call/cls_align_float.c \ > + libffi.call/cls_align_longdouble.c libffi.call/cls_align_pointer.c \ > + libffi.call/cls_align_sint16.c libffi.call/cls_align_sint32.c \ > + libffi.call/cls_align_sint64.c libffi.call/cls_align_uint16.c \ > + libffi.call/cls_align_uint32.c libffi.call/cls_align_uint64.c \ > + libffi.call/cls_double.c libffi.call/cls_float.c \ > + libffi.call/cls_multi_schar.c libffi.call/cls_multi_sshort.c \ > + libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_uchar.c \ > + libffi.call/cls_multi_ushort.c libffi.call/cls_multi_ushortchar.c \ > + libffi.call/cls_schar.c libffi.call/cls_sint.c \ > + libffi.call/cls_sshort.c libffi.call/cls_uchar.c \ > + libffi.call/cls_uint.c libffi.call/cls_ulonglong.c \ > + libffi.call/cls_ushort.c libffi.call/ffitest.h libffi.call/float1.c \ > + libffi.call/float2.c libffi.call/float3.c libffi.call/float4.c \ > + libffi.call/float.c libffi.call/many.c libffi.call/many_win32.c \ > + libffi.call/negint.c libffi.call/nested_struct10.c \ > + libffi.call/nested_struct1.c libffi.call/nested_struct2.c \ > + libffi.call/nested_struct3.c libffi.call/nested_struct4.c \ > + libffi.call/nested_struct5.c libffi.call/nested_struct6.c \ > + libffi.call/nested_struct7.c libffi.call/nested_struct8.c \ > + libffi.call/nested_struct9.c libffi.call/nested_struct.c \ > + libffi.call/problem1.c libffi.call/promotion.c \ > + libffi.call/pyobjc-tc.c libffi.call/return_dbl1.c \ > + libffi.call/return_dbl2.c libffi.call/return_dbl.c \ > + libffi.call/return_fl1.c libffi.call/return_fl2.c \ > + libffi.call/return_fl3.c libffi.call/return_fl.c \ > + libffi.call/return_ldl.c libffi.call/return_ll1.c \ > + libffi.call/return_ll.c libffi.call/return_sc.c \ > + libffi.call/return_sl.c libffi.call/return_uc.c \ > + libffi.call/return_ul.c libffi.call/strlen.c \ > + libffi.call/strlen_win32.c libffi.call/struct1.c \ > + libffi.call/struct2.c libffi.call/struct3.c libffi.call/struct4.c \ > + libffi.call/struct5.c libffi.call/struct6.c libffi.call/struct7.c \ > + libffi.call/struct8.c libffi.call/struct9.c \ > + libffi.special/ffitestcxx.h libffi.special/special.exp \ > + libffi.special/unwindtest.cc libffi.special/unwindtest_ffi_call.cc Hm, do we distribute other testfiles with gcc when we install it? My 2Rp. Thanks for doing the work Andrew! Andreas ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 17:24 ` Andreas Tobler @ 2009-06-05 17:37 ` Andrew Haley 2009-06-06 2:58 ` NightStrike 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-05 17:37 UTC (permalink / raw) To: Andreas Tobler Cc: Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andreas Tobler wrote: > Andrew Haley wrote: > >> Index: libffi.call/closure_loc_fn0.c >> =================================================================== >> --- libffi.call/closure_loc_fn0.c (revision 0) >> +++ libffi.call/closure_loc_fn0.c (revision 0) >> @@ -0,0 +1,95 @@ >> +/* Area: closure_call >> + Purpose: Check multiple values passing from different type. >> + Also, exceed the limit of gpr and fpr registers on PowerPC >> + Darwin. >> + Limitations: none. >> + PR: none. >> + Originator: <andreast@gcc.gnu.org> 20030828 */ >> + > > The above is not from me, I know, nitpicking. Patches welcome. :-) >> Index: lib/libffi-dg.exp >> =================================================================== >> --- lib/libffi-dg.exp (revision 148170) >> +++ lib/libffi-dg.exp (working copy) >> @@ -16,7 +16,7 @@ >> >> proc load_gcc_lib { filename } { >> global srcdir >> - load_file $srcdir/../../gcc/testsuite/lib/$filename >> + load_file $srcdir/lib/$filename >> } >> >> load_lib dg.exp >> @@ -94,7 +94,6 @@ >> global srcdir >> global blddirffi >> global objdir >> - global blddircxx >> global TOOL_OPTIONS >> global tool >> global libffi_include >> @@ -102,10 +101,8 @@ >> global tool_root_dir >> global ld_library_path >> >> - set blddirffi [lookfor_file [get_multilibs] libffi] >> + set blddirffi [pwd]/.. >> verbose "libffi $blddirffi" >> - set blddircxx [lookfor_file [get_multilibs] libstdc++-v3] >> - verbose "libstdc++ $blddircxx" >> >> set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] >> if {$gccdir != ""} { >> @@ -132,8 +129,6 @@ >> } >> # add the library path for libffi. >> append ld_library_path ":${blddirffi}/.libs" >> - # add the library path for libstdc++ as well. >> - append ld_library_path ":${blddircxx}/src/.libs" >> >> verbose "ld_library_path: $ld_library_path" >> >> @@ -146,7 +141,6 @@ >> if { $libffi_dir != "" } { >> set libffi_dir [file dirname ${libffi_dir}] >> set libffi_link_flags "-L${libffi_dir}/.libs" >> - lappend libffi_link_flags "-L${blddircxx}/src/.libs" >> } >> >> set_ld_library_path_env_vars > > > Do we really want that? As I remember we wanted to test against the > built libraries from gcc. Also, we have multilib configs in gcc which > will no longer be tested with the above, or not correctly. Okay, so we will need to diverge the testsuite between libffi and gcc. That's perfectly okay, as long as we clearly mark the section **** DO NOT MERGE *** Or something... >> Index: Makefile.am >> =================================================================== >> --- Makefile.am (revision 148170) >> +++ Makefile.am (working copy) >> @@ -14,3 +14,58 @@ >> AM_RUNTESTFLAGS = >> >> CLEANFILES = *.exe core* *.log *.sum >> + >> +EXTRA_DIST = config/default.exp lib/libffi-dg.exp > > Hm, do we distribute other testfiles with gcc when we install it? I dunno why this stuff is in EXTRA_DIST. Anthony? Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 17:37 ` Andrew Haley @ 2009-06-06 2:58 ` NightStrike 2009-06-06 8:22 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: NightStrike @ 2009-06-06 2:58 UTC (permalink / raw) To: Andrew Haley Cc: Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List On Fri, Jun 5, 2009 at 1:36 PM, Andrew Haley<aph@redhat.com> wrote: > Andreas Tobler wrote: >> Andrew Haley wrote: >> >>> Index: libffi.call/closure_loc_fn0.c >> Do we really want that? As I remember we wanted to test against the >> built libraries from gcc. Also, we have multilib configs in gcc which >> will no longer be tested with the above, or not correctly. > > Okay, so we will need to diverge the testsuite between libffi and gcc. That's > perfectly okay, as long as we clearly mark the section **** DO NOT MERGE *** > Or something... Wouldn't it be ideal for the libffi in the gcc tree to be identical to upstream, so that this mess doesn't occur again? ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-06 2:58 ` NightStrike @ 2009-06-06 8:22 ` Andrew Haley 2009-06-07 6:44 ` Ralf Wildenhues 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-06 8:22 UTC (permalink / raw) To: NightStrike Cc: Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List NightStrike wrote: > On Fri, Jun 5, 2009 at 1:36 PM, Andrew Haley<aph@redhat.com> wrote: >> Andreas Tobler wrote: >>> Andrew Haley wrote: >>> >>>> Index: libffi.call/closure_loc_fn0.c >>> Do we really want that? As I remember we wanted to test against the >>> built libraries from gcc. Also, we have multilib configs in gcc which >>> will no longer be tested with the above, or not correctly. >> Okay, so we will need to diverge the testsuite between libffi and gcc. That's >> perfectly okay, as long as we clearly mark the section **** DO NOT MERGE *** >> Or something... > > Wouldn't it be ideal for the libffi in the gcc tree to be identical to > upstream, so that this mess doesn't occur again? Of course it would, but the configury is not different just for the sake of it, it's because the requirements are different. I don't want there to be any differences at all, but we have to do what is possible. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-06 8:22 ` Andrew Haley @ 2009-06-07 6:44 ` Ralf Wildenhues 2009-06-08 16:22 ` Tom Tromey 0 siblings, 1 reply; 91+ messages in thread From: Ralf Wildenhues @ 2009-06-07 6:44 UTC (permalink / raw) To: Andrew Haley Cc: NightStrike, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List * Andrew Haley wrote on Sat, Jun 06, 2009 at 10:21:12AM CEST: > NightStrike wrote: > > > > Wouldn't it be ideal for the libffi in the gcc tree to be identical to > > upstream, so that this mess doesn't occur again? > > Of course it would, but the configury is not different just for the sake > of it, it's because the requirements are different. I don't want there > to be any differences at all, but we have to do what is possible. I think we can fix that mostly. configure.ac differences can use m4-time conditionals (m4_ifdef([IN_GCC], [...], [...]) or so) with a suitable define, and multilib differences in the Makefile.am files can *hopefully* be factored under an automake conditional. At least that could push differences to a few bits. Would standalone libffi be willing to accept into its tree configury parts that are only active in the GCC tree? I'd look into this more but I really would like to be able to update Autoconf and Automake used in the GCC tree first, that will likely make things a bit easier. Cheers, Ralf ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-07 6:44 ` Ralf Wildenhues @ 2009-06-08 16:22 ` Tom Tromey 2009-06-08 16:35 ` Andrew Haley ` (2 more replies) 0 siblings, 3 replies; 91+ messages in thread From: Tom Tromey @ 2009-06-08 16:22 UTC (permalink / raw) To: Ralf Wildenhues Cc: Andrew Haley, NightStrike, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List >>>>> "Ralf" == Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes: Ralf> Would standalone libffi be willing to accept into its tree Ralf> configury parts that are only active in the GCC tree? If this is possible, why have a separate libffi repository at all? You could just tell developers to: svn co svn://gcc.gnu.org/svn/gcc/trunk/libffi Tom ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 16:22 ` Tom Tromey @ 2009-06-08 16:35 ` Andrew Haley 2009-06-08 16:54 ` NightStrike 2009-06-08 16:48 ` libffi merge NightStrike 2009-06-08 18:25 ` Ralf Wildenhues 2 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-08 16:35 UTC (permalink / raw) To: tromey Cc: Ralf Wildenhues, NightStrike, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Tom Tromey wrote: >>>>>> "Ralf" == Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes: > > Ralf> Would standalone libffi be willing to accept into its tree > Ralf> configury parts that are only active in the GCC tree? > > If this is possible, why have a separate libffi repository at all? > You could just tell developers to: > > svn co svn://gcc.gnu.org/svn/gcc/trunk/libffi And we'd have to check into gcc bits of configury that are no longer relevant to gcc. But I'm looking at all possibilities. Anyway, if the repos are not massively different then merging is trivial. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 16:35 ` Andrew Haley @ 2009-06-08 16:54 ` NightStrike 2009-06-08 17:01 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: NightStrike @ 2009-06-08 16:54 UTC (permalink / raw) To: Andrew Haley Cc: tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List On Mon, Jun 8, 2009 at 12:34 PM, Andrew Haley<aph@redhat.com> wrote: > Tom Tromey wrote: >>>>>>> "Ralf" == Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes: >> >> Ralf> Would standalone libffi be willing to accept into its tree >> Ralf> configury parts that are only active in the GCC tree? >> >> If this is possible, why have a separate libffi repository at all? >> You could just tell developers to: >> >> svn co svn://gcc.gnu.org/svn/gcc/trunk/libffi > > And we'd have to check into gcc bits of configury that are no longer > relevant to gcc. But I'm looking at all possibilities. Such is the nature of using external libraries. Look at GMP/MPFR/PPL/CLOOG. > Anyway, if the repos are not massively different then merging is trivial. It's keeping them in synch that poses problems. Even libiberty exhibits issues at times between gcc and binutils, and that is supposed to be automated. On a side note, when do you plan on updating everything with Timothy Wall's patch? ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 16:54 ` NightStrike @ 2009-06-08 17:01 ` Andrew Haley 2009-06-08 17:58 ` NightStrike 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-08 17:01 UTC (permalink / raw) To: NightStrike Cc: tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List NightStrike wrote: > On a side note, when do you plan on updating everything with Timothy > Wall's patch? If you can point me at a URL which describes this patch then I can tell you. Timothy Wall has written a few patches. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 17:01 ` Andrew Haley @ 2009-06-08 17:58 ` NightStrike 2009-06-08 18:57 ` Timothy Wall 2009-06-08 22:21 ` Timothy Wall 0 siblings, 2 replies; 91+ messages in thread From: NightStrike @ 2009-06-08 17:58 UTC (permalink / raw) To: Andrew Haley, Timothy Wall Cc: tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List On Mon, Jun 8, 2009 at 1:00 PM, Andrew Haley<aph@redhat.com> wrote: > NightStrike wrote: > >> On a side note, when do you plan on updating everything with Timothy >> Wall's patch? > > If you can point me at a URL which describes this patch then I can tell > you. Timothy Wall has written a few patches. I guess he'd be the best person to ask. Tim, where is your latest patch for libffi to support win64? ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 17:58 ` NightStrike @ 2009-06-08 18:57 ` Timothy Wall 2009-06-08 22:21 ` Timothy Wall 1 sibling, 0 replies; 91+ messages in thread From: Timothy Wall @ 2009-06-08 18:57 UTC (permalink / raw) To: NightStrike Cc: Andrew Haley, tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List The patches Nightstrike is referring to implement win64 support with mingw. I'll probably need to regenerate them; I sent two patches to gcc- patches/java-patches, but I don't think the first ever showed up (it changed all closure tests in the testsuite to use ffi_closure_alloc instead of stack-based memory). I'd prefer to generate the patch against libffi CVS, since I can test that one standalone. On Jun 8, 2009, at 1:58 PM, NightStrike wrote: > On Mon, Jun 8, 2009 at 1:00 PM, Andrew Haley<aph@redhat.com> wrote: >> NightStrike wrote: >> >>> On a side note, when do you plan on updating everything with Timothy >>> Wall's patch? >> >> If you can point me at a URL which describes this patch then I can >> tell >> you. Timothy Wall has written a few patches. > > I guess he'd be the best person to ask. > > Tim, where is your latest patch for libffi to support win64? ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 17:58 ` NightStrike 2009-06-08 18:57 ` Timothy Wall @ 2009-06-08 22:21 ` Timothy Wall 2009-06-09 15:32 ` Andrew Haley 1 sibling, 1 reply; 91+ messages in thread From: Timothy Wall @ 2009-06-08 22:21 UTC (permalink / raw) To: NightStrike Cc: Andrew Haley, tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List testsuite patches: http://pastebin.com/m5cb479f6 win64 support: http://pastebin.com/m4edc43be On Jun 8, 2009, at 1:58 PM, NightStrike wrote: > On Mon, Jun 8, 2009 at 1:00 PM, Andrew Haley<aph@redhat.com> wrote: >> NightStrike wrote: >> >>> On a side note, when do you plan on updating everything with Timothy >>> Wall's patch? >> >> If you can point me at a URL which describes this patch then I can >> tell >> you. Timothy Wall has written a few patches. > > I guess he'd be the best person to ask. > > Tim, where is your latest patch for libffi to support win64? ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 22:21 ` Timothy Wall @ 2009-06-09 15:32 ` Andrew Haley 2009-06-09 16:36 ` Timothy Wall 2009-06-09 18:08 ` PATCH libffi win64 support Timothy Wall 0 siblings, 2 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-09 15:32 UTC (permalink / raw) To: Timothy Wall Cc: NightStrike, tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Timothy Wall wrote: > testsuite patches: http://pastebin.com/m5cb479f6 > win64 support: http://pastebin.com/m4edc43be That all looks OK, but we'll need a ChangeLog with the patches. Thanks, Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-09 15:32 ` Andrew Haley @ 2009-06-09 16:36 ` Timothy Wall 2009-06-09 16:44 ` Andrew Haley 2009-06-09 18:08 ` PATCH libffi win64 support Timothy Wall 1 sibling, 1 reply; 91+ messages in thread From: Timothy Wall @ 2009-06-09 16:36 UTC (permalink / raw) To: Andrew Haley Cc: NightStrike, tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List The ChangeLog is at the front of each patch, on ChangeLog.libffi. On Jun 9, 2009, at 11:32 AM, Andrew Haley wrote: > Timothy Wall wrote: >> testsuite patches: http://pastebin.com/m5cb479f6 >> win64 support: http://pastebin.com/m4edc43be > > That all looks OK, but we'll need a ChangeLog with the patches. > > Thanks, > Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-09 16:36 ` Timothy Wall @ 2009-06-09 16:44 ` Andrew Haley 2009-06-09 18:08 ` PATCH libffi testsuite closure fixes Timothy Wall 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-09 16:44 UTC (permalink / raw) To: Timothy Wall Cc: NightStrike, tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Timothy Wall wrote: > The ChangeLog is at the front of each patch, on ChangeLog.libffi. Yeah, but you still have to submit the patches to this list. Thanks, Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* PATCH libffi testsuite closure fixes 2009-06-09 16:44 ` Andrew Haley @ 2009-06-09 18:08 ` Timothy Wall 0 siblings, 0 replies; 91+ messages in thread From: Timothy Wall @ 2009-06-09 18:08 UTC (permalink / raw) To: Andrew Haley Cc: NightStrike, tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List [-- Attachment #1: Type: text/plain, Size: 1 bytes --] [-- Attachment #2: testsuite-patch.diff --] [-- Type: application/octet-stream, Size: 144024 bytes --] Index: ChangeLog.libffi =================================================================== RCS file: /cvs/libffi/libffi/ChangeLog.libffi,v retrieving revision 1.50 diff -u -b -w -r1.50 ChangeLog.libffi --- ChangeLog.libffi 4 Jun 2009 16:29:58 -0000 1.50 +++ ChangeLog.libffi 8 Jun 2009 18:59:31 -0000 @@ -1,3 +1,95 @@ +2009-06-08 Timothy Wall <twall@users.sf.net> + + * testsuite/libffi.call/closure_fn0.c, + testsuite/libffi.call/closure_fn1.c, + testsuite/libffi.call/closure_fn2.c, + testsuite/libffi.call/closure_fn3.c, + testsuite/libffi.call/closure_fn4.c, + testsuite/libffi.call/closure_fn5.c, + testsuite/libffi.call/closure_fn6.c, + testsuite/libffi.call/closure_stdcall.c, + testsuite/libffi.call/cls_12byte.c, + testsuite/libffi.call/cls_16byte.c, + testsuite/libffi.call/cls_18byte.c, + testsuite/libffi.call/cls_19byte.c, + testsuite/libffi.call/cls_1_1byte.c, + testsuite/libffi.call/cls_20byte.c, + testsuite/libffi.call/cls_20byte1.c, + testsuite/libffi.call/cls_24byte.c, + testsuite/libffi.call/cls_2byte.c, + testsuite/libffi.call/cls_3_1byte.c, + testsuite/libffi.call/cls_3byte1.c, + testsuite/libffi.call/cls_3byte2.c, + testsuite/libffi.call/cls_4_1byte.c, + testsuite/libffi.call/cls_4byte.c, + testsuite/libffi.call/cls_5_1_byte.c, + testsuite/libffi.call/cls_5byte.c, + testsuite/libffi.call/cls_64byte.c, + testsuite/libffi.call/cls_6_1_byte.c, + testsuite/libffi.call/cls_6byte.c, + testsuite/libffi.call/cls_7_1_byte.c, + testsuite/libffi.call/cls_7byte.c, + testsuite/libffi.call/cls_8byte.c, + testsuite/libffi.call/cls_9byte1.c, + testsuite/libffi.call/cls_9byte2.c, + testsuite/libffi.call/cls_align_double.c, + testsuite/libffi.call/cls_align_float.c, + testsuite/libffi.call/cls_align_longdouble.c, + testsuite/libffi.call/cls_align_longdouble_split.c, + testsuite/libffi.call/cls_align_longdouble_split2.c, + testsuite/libffi.call/cls_align_pointer.c, + testsuite/libffi.call/cls_align_sint16.c, + testsuite/libffi.call/cls_align_sint32.c, + testsuite/libffi.call/cls_align_sint64.c, + testsuite/libffi.call/cls_align_uint16.c, + testsuite/libffi.call/cls_align_uint32.c, + testsuite/libffi.call/cls_align_uint64.c, + testsuite/libffi.call/cls_dbls_struct.c, + testsuite/libffi.call/cls_double.c, + testsuite/libffi.call/cls_double_va.c, + testsuite/libffi.call/cls_float.c, + testsuite/libffi.call/cls_longdouble.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_multi_schar.c, + testsuite/libffi.call/cls_multi_sshort.c, + testsuite/libffi.call/cls_multi_sshortchar.c, + testsuite/libffi.call/cls_multi_uchar.c, + testsuite/libffi.call/cls_multi_ushort.c, + testsuite/libffi.call/cls_multi_ushortchar.c, + testsuite/libffi.call/cls_pointer.c, + testsuite/libffi.call/cls_pointer_stack.c, + testsuite/libffi.call/cls_schar.c, + testsuite/libffi.call/cls_sint.c, + testsuite/libffi.call/cls_sshort.c, + testsuite/libffi.call/cls_uchar.c, + testsuite/libffi.call/cls_uint.c, + testsuite/libffi.call/cls_ulonglong.c, + testsuite/libffi.call/cls_ushort.c, + testsuite/libffi.call/err_bad_abi.c, + testsuite/libffi.call/err_bad_typedef.c, + testsuite/libffi.call/float2.c, + testsuite/libffi.call/huge_struct.c, + testsuite/libffi.call/nested_struct.c, + testsuite/libffi.call/nested_struct1.c, + testsuite/libffi.call/nested_struct10.c, + testsuite/libffi.call/nested_struct2.c, + testsuite/libffi.call/nested_struct3.c, + testsuite/libffi.call/nested_struct4.c, + testsuite/libffi.call/nested_struct5.c, + testsuite/libffi.call/nested_struct6.c, + testsuite/libffi.call/nested_struct7.c, + testsuite/libffi.call/nested_struct8.c, + testsuite/libffi.call/nested_struct9.c, + testsuite/libffi.call/problem1.c, + testsuite/libffi.call/return_ldl.c, + testsuite/libffi.call/return_ll1.c, + testsuite/libffi.call/stret_large.c, + testsuite/libffi.call/stret_large2.c, + testsuite/libffi.call/stret_medium.c, + testsuite/libffi.call/stret_medium2.c, + testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead + of checking for MMAP. Use intptr_t instead of long casts. + 2009-06-04 Andrew Haley <aph@redhat.com> * src/powerpc/ffitarget.h: Fix misapplied merge from gcc. Index: testsuite/Makefile.in =================================================================== RCS file: /cvs/libffi/libffi/testsuite/Makefile.in,v retrieving revision 1.6 diff -u -b -w -r1.6 Makefile.in --- testsuite/Makefile.in 19 Dec 2008 15:47:44 -0000 1.6 +++ testsuite/Makefile.in 8 Jun 2009 18:59:08 -0000 @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -245,8 +245,8 @@ @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ Index: testsuite/libffi.call/closure_fn0.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn0.c,v retrieving revision 1.4 diff -u -b -w -r1.4 closure_fn0.c --- testsuite/libffi.call/closure_fn0.c 22 Dec 2008 15:21:15 -0000 1.4 +++ testsuite/libffi.call/closure_fn0.c 8 Jun 2009 18:59:08 -0000 @@ -49,19 +49,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void * code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = &ffi_type_sint; cl_arg_types[2] = &ffi_type_uint64; @@ -84,10 +76,10 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn0, - (void *) 3 /* userdata */) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, + (void *) 3 /* userdata */, code) == FFI_OK); - res = (*((closure_test_type0)pcl)) + res = (*((closure_test_type0)code)) (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, 19, 21, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ Index: testsuite/libffi.call/closure_fn1.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn1.c,v retrieving revision 1.4 diff -u -b -w -r1.4 closure_fn1.c --- testsuite/libffi.call/closure_fn1.c 22 Dec 2008 15:21:15 -0000 1.4 +++ testsuite/libffi.call/closure_fn1.c 8 Jun 2009 18:59:08 -0000 @@ -41,19 +41,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; @@ -76,10 +68,10 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn1, - (void *) 3 /* userdata */) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, + (void *) 3 /* userdata */, code) == FFI_OK); - res = (*((closure_test_type1)pcl)) + res = (*((closure_test_type1)code)) (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, 19, 21, 1); /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ Index: testsuite/libffi.call/closure_fn2.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn2.c,v retrieving revision 1.4 diff -u -b -w -r1.4 closure_fn2.c --- testsuite/libffi.call/closure_fn2.c 22 Dec 2008 15:21:15 -0000 1.4 +++ testsuite/libffi.call/closure_fn2.c 8 Jun 2009 18:59:08 -0000 @@ -41,19 +41,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_double; cl_arg_types[1] = &ffi_type_double; cl_arg_types[2] = &ffi_type_double; @@ -76,10 +68,10 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn2, - (void *) 3 /* userdata */) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn2, + (void *) 3 /* userdata */, code) == FFI_OK); - res = (*((closure_test_type2)pcl)) + res = (*((closure_test_type2)code)) (1, 2, 3, 4, 127, 5, 6, 8, 9, 10, 11, 12.0, 13, 19.0, 21, 1); /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ Index: testsuite/libffi.call/closure_fn3.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn3.c,v retrieving revision 1.4 diff -u -b -w -r1.4 closure_fn3.c --- testsuite/libffi.call/closure_fn3.c 22 Dec 2008 15:21:15 -0000 1.4 +++ testsuite/libffi.call/closure_fn3.c 8 Jun 2009 18:59:08 -0000 @@ -42,19 +42,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; @@ -77,10 +69,10 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn3, - (void *) 3 /* userdata */) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn3, + (void *) 3 /* userdata */, code) == FFI_OK); - res = (*((closure_test_type3)pcl)) + res = (*((closure_test_type3)code)) (1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9, 10, 11.11, 12.0, 13, 19.19, 21.21, 1); /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 19 21 1 3: 135" } */ Index: testsuite/libffi.call/closure_fn4.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn4.c,v retrieving revision 1.4 diff -u -b -w -r1.4 closure_fn4.c --- testsuite/libffi.call/closure_fn4.c 22 Dec 2008 15:21:15 -0000 1.4 +++ testsuite/libffi.call/closure_fn4.c 8 Jun 2009 18:59:08 -0000 @@ -60,19 +60,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int i, res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - for (i = 0; i < 15; i++) { cl_arg_types[i] = &ffi_type_uint64; } @@ -83,10 +75,10 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn0, - (void *) 3 /* userdata */) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, + (void *) 3 /* userdata */, code) == FFI_OK); - res = (*((closure_test_type0)pcl)) + res = (*((closure_test_type0)code)) (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11LL, 12LL, 13LL, 19LL, 21LL, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ Index: testsuite/libffi.call/closure_fn5.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn5.c,v retrieving revision 1.4 diff -u -b -w -r1.4 closure_fn5.c --- testsuite/libffi.call/closure_fn5.c 22 Dec 2008 15:21:15 -0000 1.4 +++ testsuite/libffi.call/closure_fn5.c 8 Jun 2009 18:59:08 -0000 @@ -59,17 +59,10 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int i, res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif for (i = 0; i < 10; i++) { cl_arg_types[i] = &ffi_type_uint64; @@ -85,10 +78,10 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn5, - (void *) 3 /* userdata */) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn5, + (void *) 3 /* userdata */, code) == FFI_OK); - res = (*((closure_test_type0)pcl)) + res = (*((closure_test_type0)code)) (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11, 12LL, 13LL, 19LL, 21LL, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ Index: testsuite/libffi.call/closure_fn6.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_fn6.c,v retrieving revision 1.3 diff -u -b -w -r1.3 closure_fn6.c --- testsuite/libffi.call/closure_fn6.c 22 Dec 2008 15:21:15 -0000 1.3 +++ testsuite/libffi.call/closure_fn6.c 8 Jun 2009 18:59:08 -0000 @@ -50,19 +50,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = &ffi_type_uint64; cl_arg_types[2] = &ffi_type_uint64; @@ -85,10 +77,10 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn0, - (void *) 3 /* userdata */) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, + (void *) 3 /* userdata */, code) == FFI_OK); - res = (*((closure_test_type0)pcl)) + res = (*((closure_test_type0)code)) (1, 2, 3, 4, 127, 429., 7., 8., 9.5, 10., 11, 12., 13, 19, 21., 1.); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ Index: testsuite/libffi.call/closure_stdcall.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/closure_stdcall.c,v retrieving revision 1.2 diff -u -b -w -r1.2 closure_stdcall.c --- testsuite/libffi.call/closure_stdcall.c 22 Dec 2008 15:21:15 -0000 1.2 +++ testsuite/libffi.call/closure_stdcall.c 8 Jun 2009 18:59:08 -0000 @@ -28,22 +28,14 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; void* sp_pre; void* sp_post; char buf[1024]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_uint; cl_arg_types[1] = &ffi_type_uint; cl_arg_types[2] = &ffi_type_uint; @@ -54,11 +46,11 @@ CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 4, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_stdcall, - (void *) 3 /* userdata */) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall, + (void *) 3 /* userdata */, code) == FFI_OK); asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); - res = (*(closure_test_type0)pcl)(0, 1, 2, 3); + res = (*(closure_test_type0)code)(0, 1, 2, 3); asm volatile (" movl %%esp,%0" : "=g" (sp_post)); /* { dg-output "0 1 2 3: 9" } */ Index: testsuite/libffi.call/cls_12byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_12byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_12byte.c --- testsuite/libffi.call/cls_12byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_12byte.c 8 Jun 2009 18:59:08 -0000 @@ -42,21 +42,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -87,13 +79,13 @@ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 9 12" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_12byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_12byte_gn, NULL, code) == FFI_OK); res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; - res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(pcl))(h_dbl, j_dbl); + res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 4 9 1 5 3: 8 9 12" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 9 12" } */ Index: testsuite/libffi.call/cls_16byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_16byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_16byte.c --- testsuite/libffi.call/cls_16byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_16byte.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -92,9 +84,9 @@ res_dbl.b = 0.0; res_dbl.c = 0; - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_16byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_16byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(pcl))(h_dbl, j_dbl); + res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 8 9 1 9 3: 8 17 12" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 17 12" } */ Index: testsuite/libffi.call/cls_18byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_18byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_18byte.c --- testsuite/libffi.call/cls_18byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_18byte.c 8 Jun 2009 18:59:08 -0000 @@ -47,21 +47,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -93,9 +85,9 @@ printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 5 252 250 8" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_18byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_18byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 127 126 3 4 125 124 5: 5 252 250 8" } */ printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 5 252 250 8" } */ Index: testsuite/libffi.call/cls_19byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_19byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_19byte.c --- testsuite/libffi.call/cls_19byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_19byte.c 8 Jun 2009 18:59:08 -0000 @@ -50,21 +50,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[6]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -98,9 +90,9 @@ res_dbl.d, res_dbl.e); /* { dg-output "\nres: 5 252 250 8 239" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_19byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_19byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); Index: testsuite/libffi.call/cls_1_1byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_1_1byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_1_1byte.c --- testsuite/libffi.call/cls_1_1byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_1_1byte.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[2]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -86,9 +78,9 @@ printf("res: %d\n", res_dbl.a); /* { dg-output "\nres: 190" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_1_1byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_1_1byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 178: 190" } */ printf("res: %d\n", res_dbl.a); /* { dg-output "\nres: 190" } */ Index: testsuite/libffi.call/cls_20byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_20byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_20byte.c --- testsuite/libffi.call/cls_20byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_20byte.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -88,9 +80,9 @@ printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_20byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ Index: testsuite/libffi.call/cls_20byte1.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_20byte1.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_20byte1.c --- testsuite/libffi.call/cls_20byte1.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_20byte1.c 8 Jun 2009 18:59:08 -0000 @@ -45,21 +45,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -90,9 +82,9 @@ printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_20byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ Index: testsuite/libffi.call/cls_24byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_24byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_24byte.c --- testsuite/libffi.call/cls_24byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_24byte.c 8 Jun 2009 18:59:08 -0000 @@ -54,21 +54,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -106,13 +98,13 @@ printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 22 15 17 25" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_24byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_24byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_24byte(*)(cls_struct_24byte, cls_struct_24byte, cls_struct_24byte, cls_struct_24byte)) - (pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 22 15 17 25" } */ Index: testsuite/libffi.call/cls_2byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_2byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_2byte.c --- testsuite/libffi.call/cls_2byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_2byte.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -87,9 +79,9 @@ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_2byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_2byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 127 1 13: 13 140" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 140" } */ Index: testsuite/libffi.call/cls_3_1byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_3_1byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_3_1byte.c --- testsuite/libffi.call/cls_3_1byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_3_1byte.c 8 Jun 2009 18:59:08 -0000 @@ -47,21 +47,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -92,9 +84,9 @@ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 190 192 194" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3_1byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3_1byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 13 14 178 179 180: 190 192 194" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 190 192 194" } */ Index: testsuite/libffi.call/cls_3byte1.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_3byte1.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_3byte1.c --- testsuite/libffi.call/cls_3byte1.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_3byte1.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -87,9 +79,9 @@ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 134" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 119 1 15: 13 134" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 134" } */ Index: testsuite/libffi.call/cls_3byte2.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_3byte2.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_3byte2.c --- testsuite/libffi.call/cls_3byte2.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_3byte2.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -87,9 +79,9 @@ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 24 144" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3byte_gn1, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn1, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(code))(g_dbl, f_dbl); /* { dg-output "\n15 125 9 19: 24 144" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 24 144" } */ Index: testsuite/libffi.call/cls_4_1byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_4_1byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_4_1byte.c --- testsuite/libffi.call/cls_4_1byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_4_1byte.c 8 Jun 2009 18:59:08 -0000 @@ -49,21 +49,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -95,9 +87,9 @@ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 190 192 194 196" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_4_1byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4_1byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 13 14 15 178 179 180 181: 190 192 194 196" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 190 192 194 196" } */ Index: testsuite/libffi.call/cls_4byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_4byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_4byte.c --- testsuite/libffi.call/cls_4byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_4byte.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -87,9 +79,9 @@ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 139 248" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_4byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 12 128: 139 248" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 139 248" } */ Index: testsuite/libffi.call/cls_5_1_byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_5_1_byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_5_1_byte.c --- testsuite/libffi.call/cls_5_1_byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_5_1_byte.c 8 Jun 2009 18:59:08 -0000 @@ -51,21 +51,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[6]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -105,9 +97,9 @@ res_dbl.d = 0; res_dbl.e = 0; - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_5byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */ printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); Index: testsuite/libffi.call/cls_5byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_5byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_5byte.c --- testsuite/libffi.call/cls_5byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_5byte.c 8 Jun 2009 18:59:08 -0000 @@ -46,21 +46,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -95,9 +87,9 @@ res_dbl.b = 0; res_dbl.c = 0; - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_5byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 12 128 9: 139 248 10" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 139 248 10" } */ Index: testsuite/libffi.call/cls_64byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_64byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_64byte.c --- testsuite/libffi.call/cls_64byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_64byte.c 8 Jun 2009 18:59:08 -0000 @@ -59,21 +59,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[9]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -116,13 +108,13 @@ res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_64byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_64byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_64byte(*)(cls_struct_64byte, cls_struct_64byte, cls_struct_64byte, cls_struct_64byte)) - (pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18" } */ printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); Index: testsuite/libffi.call/cls_6_1_byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_6_1_byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_6_1_byte.c --- testsuite/libffi.call/cls_6_1_byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_6_1_byte.c 8 Jun 2009 18:59:08 -0000 @@ -53,21 +53,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[7]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -109,9 +101,9 @@ res_dbl.e = 0; res_dbl.f = 0; - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_6byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */ printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f); Index: testsuite/libffi.call/cls_6byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_6byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_6byte.c --- testsuite/libffi.call/cls_6byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_6byte.c 8 Jun 2009 18:59:08 -0000 @@ -49,21 +49,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -95,9 +87,9 @@ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 255" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_6byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 128 12 128 9 127: 139 248 10 255" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 255" } */ Index: testsuite/libffi.call/cls_7_1_byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_7_1_byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_7_1_byte.c --- testsuite/libffi.call/cls_7_1_byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_7_1_byte.c 8 Jun 2009 18:59:08 -0000 @@ -55,21 +55,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -113,9 +105,9 @@ res_dbl.f = 0; res_dbl.g = 0; - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_7byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */ printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); Index: testsuite/libffi.call/cls_7byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_7byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_7byte.c --- testsuite/libffi.call/cls_7byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_7byte.c 8 Jun 2009 18:59:08 -0000 @@ -48,21 +48,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -94,9 +86,9 @@ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 509" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_7byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 254 12 128 9 255: 139 248 10 509" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 509" } */ Index: testsuite/libffi.call/cls_8byte.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_8byte.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_8byte.c --- testsuite/libffi.call/cls_8byte.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_8byte.c 8 Jun 2009 18:59:08 -0000 @@ -42,21 +42,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -85,9 +77,9 @@ /* { dg-output "1 2 4 5: 5 7" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 5 7" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_8byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_8byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 4 5: 5 7" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 5 7" } */ Index: testsuite/libffi.call/cls_9byte1.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_9byte1.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_9byte1.c --- testsuite/libffi.call/cls_9byte1.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_9byte1.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -87,9 +79,9 @@ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_9byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(pcl))(h_dbl, j_dbl); + res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 8 1 9: 8 17" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ Index: testsuite/libffi.call/cls_9byte2.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_9byte2.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_9byte2.c --- testsuite/libffi.call/cls_9byte2.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_9byte2.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -88,9 +80,9 @@ /* { dg-output "\nres: 8 17" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_9byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(pcl))(h_dbl, j_dbl); + res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 8 1 9: 8 17" } */ printf("res: %g %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ Index: testsuite/libffi.call/cls_align_double.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_double.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_align_double.c --- testsuite/libffi.call/cls_align_double.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_align_double.c 8 Jun 2009 18:59:08 -0000 @@ -45,21 +45,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -90,9 +82,9 @@ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ Index: testsuite/libffi.call/cls_align_float.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_float.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_align_float.c --- testsuite/libffi.call/cls_align_float.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_align_float.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -88,9 +80,9 @@ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ Index: testsuite/libffi.call/cls_align_longdouble.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_longdouble.c,v retrieving revision 1.4 diff -u -b -w -r1.4 cls_align_longdouble.c --- testsuite/libffi.call/cls_align_longdouble.c 26 Dec 2008 19:06:28 -0000 1.4 +++ testsuite/libffi.call/cls_align_longdouble.c 8 Jun 2009 18:59:08 -0000 @@ -4,7 +4,7 @@ PR: none. Originator: <hos@tamanegi.org> 20031203 */ -/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run } */ #include "ffitest.h" @@ -44,21 +44,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -89,9 +81,9 @@ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ Index: testsuite/libffi.call/cls_align_longdouble_split.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_longdouble_split.c,v retrieving revision 1.2 diff -u -b -w -r1.2 cls_align_longdouble_split.c --- testsuite/libffi.call/cls_align_longdouble_split.c 26 Dec 2008 19:06:28 -0000 1.2 +++ testsuite/libffi.call/cls_align_longdouble_split.c 8 Jun 2009 18:59:08 -0000 @@ -4,8 +4,10 @@ PR: none. Originator: <hos@tamanegi.org> 20031203 */ -/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" @@ -78,21 +80,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -128,9 +122,9 @@ res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); Index: testsuite/libffi.call/cls_align_longdouble_split2.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c,v retrieving revision 1.2 diff -u -b -w -r1.2 cls_align_longdouble_split2.c --- testsuite/libffi.call/cls_align_longdouble_split2.c 26 Dec 2008 19:06:28 -0000 1.2 +++ testsuite/libffi.call/cls_align_longdouble_split2.c 8 Jun 2009 18:59:08 -0000 @@ -5,8 +5,10 @@ Originator: Blake Chaffin 6/18/2007 */ -/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" @@ -58,21 +60,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -108,9 +102,9 @@ res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); @@ -118,3 +112,6 @@ exit(0); } + + + Index: testsuite/libffi.call/cls_align_pointer.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_pointer.c,v retrieving revision 1.4 diff -u -b -w -r1.4 cls_align_pointer.c --- testsuite/libffi.call/cls_align_pointer.c 22 Dec 2008 15:21:15 -0000 1.4 +++ testsuite/libffi.call/cls_align_pointer.c 8 Jun 2009 18:59:08 -0000 @@ -47,21 +47,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -92,9 +84,9 @@ printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ Index: testsuite/libffi.call/cls_align_sint16.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_sint16.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_align_sint16.c --- testsuite/libffi.call/cls_align_sint16.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_align_sint16.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -88,9 +80,9 @@ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ Index: testsuite/libffi.call/cls_align_sint32.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_sint32.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_align_sint32.c --- testsuite/libffi.call/cls_align_sint32.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_align_sint32.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -88,9 +80,9 @@ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ Index: testsuite/libffi.call/cls_align_sint64.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_sint64.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_align_sint64.c --- testsuite/libffi.call/cls_align_sint64.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_align_sint64.c 8 Jun 2009 18:59:08 -0000 @@ -22,7 +22,7 @@ result.b = a1.b + a2.b; result.c = a1.c + a2.c; - printf("%d %lld %d %d %lld %d: %d %lld %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + printf("%d %" PRId64 " %d %d %" PRId64 " %d: %d %" PRId64 " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -85,14 +77,14 @@ ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); Index: testsuite/libffi.call/cls_align_uint16.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_uint16.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_align_uint16.c --- testsuite/libffi.call/cls_align_uint16.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_align_uint16.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -88,9 +80,9 @@ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ Index: testsuite/libffi.call/cls_align_uint32.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_uint32.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_align_uint32.c --- testsuite/libffi.call/cls_align_uint32.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_align_uint32.c 8 Jun 2009 18:59:08 -0000 @@ -43,21 +43,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -88,9 +80,9 @@ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ Index: testsuite/libffi.call/cls_align_uint64.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_uint64.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_align_uint64.c --- testsuite/libffi.call/cls_align_uint64.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_align_uint64.c 8 Jun 2009 18:59:08 -0000 @@ -23,7 +23,7 @@ result.b = a1.b + a2.b; result.c = a1.c + a2.c; - printf("%d %lld %d %d %lld %d: %d %lld %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + printf("%d %" PRId64 " %d %d %" PRId64 " %d: %d %" PRId64 " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } @@ -44,21 +44,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -86,14 +78,14 @@ ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); Index: testsuite/libffi.call/cls_dbls_struct.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_dbls_struct.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_dbls_struct.c --- testsuite/libffi.call/cls_dbls_struct.c 8 Jun 2009 16:50:49 -0000 1.3 +++ testsuite/libffi.call/cls_dbls_struct.c 8 Jun 2009 18:59:08 -0000 @@ -30,19 +30,10 @@ { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - - ffi_closure* pcl; + void *code; + ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type* cl_arg_types[1]; -#ifdef USING_MMAP - pcl = allocate_mmap(sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - ffi_type ts1_type; ffi_type* ts1_type_elements[4]; @@ -63,9 +54,9 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK); - ((void*(*)(Dbls))(pcl))(arg); + ((void*(*)(Dbls))(code))(arg); /* { dg-output "1.0 2.0\n" { xfail x86_64-*-linux-* } } */ closure_test_fn(arg); Index: testsuite/libffi.call/cls_double.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_double.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_double.c --- testsuite/libffi.call/cls_double.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_double.c 8 Jun 2009 18:59:08 -0000 @@ -20,19 +20,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; double res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_double; cl_arg_types[1] = NULL; @@ -40,9 +32,9 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, cls_ret_double_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK); - res = (*((cls_ret_double)pcl))(21474.789); + res = (*((cls_ret_double)code))(21474.789); /* { dg-output "21474.789000: 21474.789000" } */ printf("res: %.6f\n", res); /* { dg-output "\nres: 21474.789000" } */ Index: testsuite/libffi.call/cls_double_va.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_double_va.c,v retrieving revision 1.2 diff -u -b -w -r1.2 cls_double_va.c --- testsuite/libffi.call/cls_double_va.c 24 Jul 2008 18:03:48 -0000 1.2 +++ testsuite/libffi.call/cls_double_va.c 8 Jun 2009 18:59:08 -0000 @@ -20,19 +20,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; ffi_type* arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap(sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - char* format = "%.1f\n"; double doubleArg = 7; ffi_arg res = 0; @@ -53,9 +45,9 @@ printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } - CHECK(ffi_prep_closure(pcl, &cif, cls_double_va_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); - res = ((int(*)(char*, double))(pcl))(format, doubleArg); + res = ((int(*)(char*, double))(code))(format, doubleArg); // { dg-output "\n7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } Index: testsuite/libffi.call/cls_float.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_float.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_float.c --- testsuite/libffi.call/cls_float.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_float.c 8 Jun 2009 18:59:08 -0000 @@ -21,20 +21,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; float res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - - cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = NULL; @@ -42,8 +33,8 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_float, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, cls_ret_float_fn, NULL) == FFI_OK); - res = ((((cls_ret_float)pcl)(-2122.12))); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_float_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_float)code)(-2122.12))); /* { dg-output "\\-2122.12: \\-2122.12" } */ printf("res: %.6f\n", res); /* { dg-output "\nres: \-2122.120117" } */ Index: testsuite/libffi.call/cls_longdouble.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_longdouble.c,v retrieving revision 1.4 diff -u -b -w -r1.4 cls_longdouble.c --- testsuite/libffi.call/cls_longdouble.c 27 Dec 2008 16:59:05 -0000 1.4 +++ testsuite/libffi.call/cls_longdouble.c 8 Jun 2009 18:59:08 -0000 @@ -4,8 +4,10 @@ PR: none. Originator: Blake Chaffin */ -/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" @@ -47,20 +49,12 @@ int main(void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure* pcl; + void* code; + ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[9]; ffi_type* arg_types[9]; long double res = 0; -#ifdef USING_MMAP - pcl = allocate_mmap(sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - long double arg1 = 1; long double arg2 = 2; long double arg3 = 3; @@ -98,10 +92,10 @@ printf("res: %Lg\n", res); /* { dg-output "\nres: 36" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_ldouble_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ldouble_gn, NULL, code) == FFI_OK); res = ((long double(*)(long double, long double, long double, long double, - long double, long double, long double, long double))(pcl))(arg1, arg2, + long double, long double, long double, long double))(code))(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); /* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */ printf("res: %Lg\n", res); Index: testsuite/libffi.call/cls_longdouble_va.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_longdouble_va.c,v retrieving revision 1.4 diff -u -b -w -r1.4 cls_longdouble_va.c --- testsuite/libffi.call/cls_longdouble_va.c 8 Jun 2009 16:50:49 -0000 1.4 +++ testsuite/libffi.call/cls_longdouble_va.c 8 Jun 2009 18:59:08 -0000 @@ -4,7 +4,8 @@ PR: none. Originator: Blake Chaffin 6/6/2007 */ -/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +/* { dg-output "" { xfail x86_64-*-mingw* } } */ #include "ffitest.h" static void @@ -20,19 +21,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; ffi_type* arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - char* format = "%L.1f\n"; long double ldArg = 7; ffi_arg res = 0; @@ -53,9 +46,9 @@ printf("res: %d\n", (int) res); // { dg-output "\nres: 4" { xfail i*86-*-linux-* x86_64-*-linux-* } } - CHECK(ffi_prep_closure(pcl, &cif, cls_longdouble_va_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); - res = ((int(*)(char*, long double))(pcl))(format, ldArg); + res = ((int(*)(char*, long double))(code))(format, ldArg); // { dg-output "\n7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } Index: testsuite/libffi.call/cls_multi_schar.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_multi_schar.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_multi_schar.c --- testsuite/libffi.call/cls_multi_schar.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_multi_schar.c 8 Jun 2009 18:59:08 -0000 @@ -36,21 +36,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; signed char a, b, res_closure; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - a = 2; b = 125; @@ -71,9 +63,9 @@ printf("res: %d\n", (signed char)res_call); /* { dg-output "\nres: 127" } */ - CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - res_closure = (*((test_type)pcl))(2, 125); + res_closure = (*((test_type)code))(2, 125); /* { dg-output "\n2 125: 127" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 127" } */ Index: testsuite/libffi.call/cls_multi_sshort.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_multi_sshort.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_multi_sshort.c --- testsuite/libffi.call/cls_multi_sshort.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_multi_sshort.c 8 Jun 2009 18:59:08 -0000 @@ -36,21 +36,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; unsigned short a, b, res_closure; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - a = 2; b = 32765; @@ -71,9 +63,9 @@ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 32767" } */ - CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - res_closure = (*((test_type)pcl))(2, 32765); + res_closure = (*((test_type)code))(2, 32765); /* { dg-output "\n2 32765: 32767" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32767" } */ Index: testsuite/libffi.call/cls_multi_sshortchar.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_multi_sshortchar.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_multi_sshortchar.c --- testsuite/libffi.call/cls_multi_sshortchar.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_multi_sshortchar.c 8 Jun 2009 18:59:08 -0000 @@ -41,22 +41,14 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; signed char a, c; signed short b, d, res_closure; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - a = 1; b = 32765; c = 127; @@ -83,9 +75,9 @@ printf("res: %d\n", (signed short)res_call); /* { dg-output "\nres: 32765" } */ - CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - res_closure = (*((test_type)pcl))(1, 32765, 127, -128); + res_closure = (*((test_type)code))(1, 32765, 127, -128); /* { dg-output "\n1 32765 127 -128: 32765" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32765" } */ Index: testsuite/libffi.call/cls_multi_uchar.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_multi_uchar.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_multi_uchar.c --- testsuite/libffi.call/cls_multi_uchar.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_multi_uchar.c 8 Jun 2009 18:59:08 -0000 @@ -47,21 +47,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; unsigned char a, b, c, d, res_closure; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - a = 1; b = 2; c = 127; @@ -88,9 +80,9 @@ printf("res: %d\n", (unsigned char)res_call); /* { dg-output "\nres: 255" } */ - CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - res_closure = (*((test_type)pcl))(1, 2, 127, 125); + res_closure = (*((test_type)code))(1, 2, 127, 125); /* { dg-output "\n1 2 127 125: 255" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 255" } */ Index: testsuite/libffi.call/cls_multi_ushort.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_multi_ushort.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_multi_ushort.c --- testsuite/libffi.call/cls_multi_ushort.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_multi_ushort.c 8 Jun 2009 18:59:08 -0000 @@ -36,21 +36,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; unsigned short a, b, res_closure; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - a = 2; b = 32765; @@ -71,9 +63,9 @@ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 32767" } */ - CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - res_closure = (*((test_type)pcl))(2, 32765); + res_closure = (*((test_type)code))(2, 32765); /* { dg-output "\n2 32765: 32767" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32767" } */ Index: testsuite/libffi.call/cls_multi_ushortchar.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_multi_ushortchar.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_multi_ushortchar.c --- testsuite/libffi.call/cls_multi_ushortchar.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_multi_ushortchar.c 8 Jun 2009 18:59:08 -0000 @@ -41,22 +41,14 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; unsigned char a, c; unsigned short b, d, res_closure; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - a = 1; b = 2; c = 127; @@ -83,9 +75,9 @@ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 258" } */ - CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - res_closure = (*((test_type)pcl))(1, 2, 127, 128); + res_closure = (*((test_type)code))(1, 2, 127, 128); /* { dg-output "\n1 2 127 128: 258" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 258" } */ Index: testsuite/libffi.call/cls_pointer.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_pointer.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_pointer.c --- testsuite/libffi.call/cls_pointer.c 22 Dec 2008 15:21:15 -0000 1.3 +++ testsuite/libffi.call/cls_pointer.c 8 Jun 2009 18:59:08 -0000 @@ -32,20 +32,12 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure* pcl; + void *code; + ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; // ffi_type cls_pointer_type; ffi_type* arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap(sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - /* cls_pointer_type.size = sizeof(void*); cls_pointer_type.alignment = 0; cls_pointer_type.type = FFI_TYPE_POINTER; @@ -71,9 +63,9 @@ printf("res: 0x%08x\n", (unsigned int) res); /* { dg-output "\nres: 0x9be02467" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2); + res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ printf("res: 0x%08x\n", (unsigned int) res); /* { dg-output "\nres: 0x9be02467" } */ Index: testsuite/libffi.call/cls_pointer_stack.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_pointer_stack.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_pointer_stack.c --- testsuite/libffi.call/cls_pointer_stack.c 22 Dec 2008 15:21:15 -0000 1.3 +++ testsuite/libffi.call/cls_pointer_stack.c 8 Jun 2009 18:59:08 -0000 @@ -93,20 +93,12 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure* pcl; + void *code; + ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; // ffi_type cls_pointer_type; ffi_type* arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap(sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - /* cls_pointer_type.size = sizeof(void*); cls_pointer_type.alignment = 0; cls_pointer_type.type = FFI_TYPE_POINTER; @@ -135,9 +127,9 @@ // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } // { dg-output "\nres: 0x8bf258bd" } - CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2); + res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); printf("res: 0x%08x\n", (unsigned int) res); // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } Index: testsuite/libffi.call/cls_schar.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_schar.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_schar.c --- testsuite/libffi.call/cls_schar.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_schar.c 8 Jun 2009 18:59:08 -0000 @@ -21,19 +21,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; signed char res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = NULL; @@ -41,9 +33,9 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_schar, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, cls_ret_schar_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_schar_fn, NULL, code) == FFI_OK); - res = (*((cls_ret_schar)pcl))(127); + res = (*((cls_ret_schar)code))(127); /* { dg-output "127: 127" } */ printf("res: %d\n", res); /* { dg-output "\nres: 127" } */ Index: testsuite/libffi.call/cls_sint.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_sint.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_sint.c --- testsuite/libffi.call/cls_sint.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_sint.c 8 Jun 2009 18:59:08 -0000 @@ -19,19 +19,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; signed int res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_sint; cl_arg_types[1] = NULL; @@ -39,9 +31,9 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, cls_ret_sint_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sint_fn, NULL, code) == FFI_OK); - res = (*((cls_ret_sint)pcl))(65534); + res = (*((cls_ret_sint)code))(65534); /* { dg-output "65534: 65534" } */ printf("res: %d\n",res); /* { dg-output "\nres: 65534" } */ Index: testsuite/libffi.call/cls_sshort.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_sshort.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_sshort.c --- testsuite/libffi.call/cls_sshort.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_sshort.c 8 Jun 2009 18:59:08 -0000 @@ -19,19 +19,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; signed short res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_sshort; cl_arg_types[1] = NULL; @@ -39,9 +31,9 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sshort, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, cls_ret_sshort_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sshort_fn, NULL, code) == FFI_OK); - res = (*((cls_ret_sshort)pcl))(255); + res = (*((cls_ret_sshort)code))(255); /* { dg-output "255: 255" } */ printf("res: %d\n",res); /* { dg-output "\nres: 255" } */ Index: testsuite/libffi.call/cls_uchar.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_uchar.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_uchar.c --- testsuite/libffi.call/cls_uchar.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_uchar.c 8 Jun 2009 18:59:08 -0000 @@ -19,19 +19,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned char res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_uchar; cl_arg_types[1] = NULL; @@ -39,9 +31,9 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uchar, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, cls_ret_uchar_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uchar_fn, NULL, code) == FFI_OK); - res = (*((cls_ret_uchar)pcl))(127); + res = (*((cls_ret_uchar)code))(127); /* { dg-output "127: 127" } */ printf("res: %d\n",res); /* { dg-output "\nres: 127" } */ Index: testsuite/libffi.call/cls_uint.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_uint.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_uint.c --- testsuite/libffi.call/cls_uint.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_uint.c 8 Jun 2009 18:59:08 -0000 @@ -20,19 +20,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned int res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_uint; cl_arg_types[1] = NULL; @@ -40,9 +32,9 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, cls_ret_uint_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uint_fn, NULL, code) == FFI_OK); - res = (*((cls_ret_uint)pcl))(2147483647); + res = (*((cls_ret_uint)code))(2147483647); /* { dg-output "2147483647: 2147483647" } */ printf("res: %d\n",res); /* { dg-output "\nres: 2147483647" } */ Index: testsuite/libffi.call/cls_ulonglong.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_ulonglong.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_ulonglong.c --- testsuite/libffi.call/cls_ulonglong.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_ulonglong.c 8 Jun 2009 18:59:08 -0000 @@ -12,7 +12,7 @@ { *(unsigned long long *)resp= *(unsigned long long *)args[0]; - printf("%llu: %llu\n",*(unsigned long long *)args[0], + printf("%" PRIu64 ": %" PRIu64 "\n",*(unsigned long long *)args[0], *(unsigned long long *)(resp)); } typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long); @@ -20,34 +20,26 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned long long res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint64, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ulonglong_fn, NULL) == FFI_OK); - res = (*((cls_ret_ulonglong)pcl))(214LL); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); + res = (*((cls_ret_ulonglong)code))(214LL); /* { dg-output "214: 214" } */ - printf("res: %lld\n", res); + printf("res: %" PRId64 "\n", res); /* { dg-output "\nres: 214" } */ - res = (*((cls_ret_ulonglong)pcl))(9223372035854775808LL); + res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ - printf("res: %lld\n", res); + printf("res: %" PRId64 "\n", res); /* { dg-output "\nres: 9223372035854775808" } */ exit(0); Index: testsuite/libffi.call/cls_ushort.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_ushort.c,v retrieving revision 1.3 diff -u -b -w -r1.3 cls_ushort.c --- testsuite/libffi.call/cls_ushort.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/cls_ushort.c 8 Jun 2009 18:59:08 -0000 @@ -20,19 +20,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned short res; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cl_arg_types[0] = &ffi_type_ushort; cl_arg_types[1] = NULL; @@ -40,9 +32,9 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_ushort, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ushort_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ushort_fn, NULL, code) == FFI_OK); - res = (*((cls_ret_ushort)pcl))(65535); + res = (*((cls_ret_ushort)code))(65535); /* { dg-output "65535: 65535" } */ printf("res: %d\n",res); /* { dg-output "\nres: 65535" } */ Index: testsuite/libffi.call/err_bad_abi.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/err_bad_abi.c,v retrieving revision 1.3 diff -u -b -w -r1.3 err_bad_abi.c --- testsuite/libffi.call/err_bad_abi.c 8 Jun 2009 16:50:49 -0000 1.3 +++ testsuite/libffi.call/err_bad_abi.c 8 Jun 2009 18:59:08 -0000 @@ -15,19 +15,11 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[1]; ffi_type* arg_types[1]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - arg_types[0] = NULL; args[0] = NULL; @@ -39,7 +31,7 @@ cif.abi= 255; - CHECK(ffi_prep_closure(pcl, &cif, dummy_fn, NULL) == FFI_BAD_ABI); + CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI); exit(0); } Index: testsuite/libffi.call/err_bad_typedef.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/err_bad_typedef.c,v retrieving revision 1.2 diff -u -b -w -r1.2 err_bad_typedef.c --- testsuite/libffi.call/err_bad_typedef.c 8 Jun 2009 16:50:49 -0000 1.2 +++ testsuite/libffi.call/err_bad_typedef.c 8 Jun 2009 18:59:08 -0000 @@ -10,18 +10,8 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; ffi_type* arg_types[1]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - arg_types[0] = NULL; ffi_type badType = ffi_type_void; Index: testsuite/libffi.call/float2.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/float2.c,v retrieving revision 1.3 diff -u -b -w -r1.3 float2.c --- testsuite/libffi.call/float2.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/float2.c 8 Jun 2009 18:59:08 -0000 @@ -4,7 +4,8 @@ PR: none. Originator: From the original ffitest.c */ -/* { dg-do run } */ +/* { dg-excess-errors { target x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" #include "float.h" Index: testsuite/libffi.call/huge_struct.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/huge_struct.c,v retrieving revision 1.1 diff -u -b -w -r1.1 huge_struct.c --- testsuite/libffi.call/huge_struct.c 5 Mar 2008 00:07:02 -0000 1.1 +++ testsuite/libffi.call/huge_struct.c 8 Jun 2009 18:59:08 -0000 @@ -5,8 +5,10 @@ Originator: Blake Chaffin 6/18/2007 */ +/* { dg-excess-errors { target x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ +/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include <stdint.h> @@ -120,23 +122,23 @@ { BigStruct retVal = { ui8_1 + 1, si8_1 + 1, ui16_1 + 1, si16_1 + 1, ui32_1 + 1, si32_1 + 1, - ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((long)p_1 + 1), + ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((intptr_t)p_1 + 1), ui8_2 + 2, si8_2 + 2, ui16_2 + 2, si16_2 + 2, ui32_2 + 2, si32_2 + 2, - ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((long)p_2 + 2), + ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((intptr_t)p_2 + 2), ui8_3 + 3, si8_3 + 3, ui16_3 + 3, si16_3 + 3, ui32_3 + 3, si32_3 + 3, - ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((long)p_3 + 3), + ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((intptr_t)p_3 + 3), ui8_4 + 4, si8_4 + 4, ui16_4 + 4, si16_4 + 4, ui32_4 + 4, si32_4 + 4, - ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((long)p_4 + 4), + ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((intptr_t)p_4 + 4), ui8_5 + 5, si8_5 + 5}; - printf("%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd: " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd\n", + printf("%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p %hhu %hhd: " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p %hhu %hhd\n", ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, p_1, ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, p_2, ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, p_3, @@ -154,7 +156,7 @@ } static void -cls_large_fn(ffi_cif* cif, void* resp, void** args, void* userdata) +cls_large_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { uint8_t ui8_1 = *(uint8_t*)args[0]; int8_t si8_1 = *(int8_t*)args[1]; @@ -216,18 +218,10 @@ } int -main(int argc, const char** argv) +main(int argc __UNUSED__, const char** argv __UNUSED__) { -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; - -#ifdef USING_MMAP - pcl = allocate_mmap(sizeof(ffi_closure)); -#else - pcl = &cl; -#endif + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_cif cif; ffi_type* argTypes[51]; @@ -302,10 +296,10 @@ ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues); // { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } - printf("res: %hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd\n", + printf("res: %hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p %hhu %hhd\n", retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, retVal.l, retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, @@ -316,24 +310,24 @@ retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, retVal.vv, retVal.ww, retVal.xx); // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } - CHECK(ffi_prep_closure(pcl, &cif, cls_large_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK); retVal = ((BigStruct(*)( uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, - uint8_t, int8_t))(pcl))( + uint8_t, int8_t))(code))( ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8); // { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } - printf("res: %hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p " - "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd\n", + printf("res: %hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p " + "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p %hhu %hhd\n", retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, retVal.l, retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, Index: testsuite/libffi.call/nested_struct.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct.c,v retrieving revision 1.3 diff -u -b -w -r1.3 nested_struct.c --- testsuite/libffi.call/nested_struct.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/nested_struct.c 8 Jun 2009 18:59:08 -0000 @@ -68,10 +68,8 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type* cls_struct_fields1[5]; @@ -79,12 +77,6 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -143,12 +135,12 @@ CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_combined_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, cls_struct_16byte2, cls_struct_combined)) - (pcl))(e_dbl, f_dbl, g_dbl); + (code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); Index: testsuite/libffi.call/nested_struct1.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct1.c,v retrieving revision 1.3 diff -u -b -w -r1.3 nested_struct1.c --- testsuite/libffi.call/nested_struct1.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/nested_struct1.c 8 Jun 2009 18:59:08 -0000 @@ -72,10 +72,8 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type* cls_struct_fields1[5]; @@ -83,12 +81,6 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -150,13 +142,13 @@ CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_combined_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, cls_struct_16byte2, cls_struct_combined, cls_struct_16byte1)) - (pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); Index: testsuite/libffi.call/nested_struct10.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct10.c,v retrieving revision 1.2 diff -u -b -w -r1.2 nested_struct10.c --- testsuite/libffi.call/nested_struct10.c 29 Jan 2008 15:15:20 -0000 1.2 +++ testsuite/libffi.call/nested_struct10.c 8 Jun 2009 18:59:08 -0000 @@ -58,10 +58,8 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[4]; @@ -69,12 +67,6 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -129,9 +121,9 @@ CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl); + res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 255 2 9: 270 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); Index: testsuite/libffi.call/nested_struct2.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct2.c,v retrieving revision 1.3 diff -u -b -w -r1.3 nested_struct2.c --- testsuite/libffi.call/nested_struct2.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/nested_struct2.c 8 Jun 2009 18:59:08 -0000 @@ -49,22 +49,14 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -106,9 +98,9 @@ CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl); + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); Index: testsuite/libffi.call/nested_struct3.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct3.c,v retrieving revision 1.3 diff -u -b -w -r1.3 nested_struct3.c --- testsuite/libffi.call/nested_struct3.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/nested_struct3.c 8 Jun 2009 18:59:08 -0000 @@ -50,22 +50,14 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -108,9 +100,9 @@ CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl); + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); Index: testsuite/libffi.call/nested_struct4.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct4.c,v retrieving revision 1.2 diff -u -b -w -r1.2 nested_struct4.c --- testsuite/libffi.call/nested_struct4.c 29 Jan 2008 15:15:20 -0000 1.2 +++ testsuite/libffi.call/nested_struct4.c 8 Jun 2009 18:59:08 -0000 @@ -50,22 +50,14 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -107,9 +99,9 @@ CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl); + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); Index: testsuite/libffi.call/nested_struct5.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct5.c,v retrieving revision 1.2 diff -u -b -w -r1.2 nested_struct5.c --- testsuite/libffi.call/nested_struct5.c 29 Jan 2008 15:15:20 -0000 1.2 +++ testsuite/libffi.call/nested_struct5.c 8 Jun 2009 18:59:08 -0000 @@ -50,22 +50,14 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -108,9 +100,9 @@ CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl); + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); Index: testsuite/libffi.call/nested_struct6.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct6.c,v retrieving revision 1.2 diff -u -b -w -r1.2 nested_struct6.c --- testsuite/libffi.call/nested_struct6.c 29 Jan 2008 15:15:20 -0000 1.2 +++ testsuite/libffi.call/nested_struct6.c 8 Jun 2009 18:59:08 -0000 @@ -57,10 +57,8 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; @@ -68,12 +66,6 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -127,9 +119,9 @@ CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl); + res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); Index: testsuite/libffi.call/nested_struct7.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct7.c,v retrieving revision 1.2 diff -u -b -w -r1.2 nested_struct7.c --- testsuite/libffi.call/nested_struct7.c 29 Jan 2008 15:15:20 -0000 1.2 +++ testsuite/libffi.call/nested_struct7.c 8 Jun 2009 18:59:08 -0000 @@ -50,22 +50,14 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -107,9 +99,9 @@ CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl); + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); Index: testsuite/libffi.call/nested_struct8.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct8.c,v retrieving revision 1.2 diff -u -b -w -r1.2 nested_struct8.c --- testsuite/libffi.call/nested_struct8.c 29 Jan 2008 15:15:20 -0000 1.2 +++ testsuite/libffi.call/nested_struct8.c 8 Jun 2009 18:59:08 -0000 @@ -57,10 +57,8 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; @@ -68,12 +66,6 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -127,9 +119,9 @@ CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl); + res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); Index: testsuite/libffi.call/nested_struct9.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/nested_struct9.c,v retrieving revision 1.2 diff -u -b -w -r1.2 nested_struct9.c --- testsuite/libffi.call/nested_struct9.c 29 Jan 2008 15:15:20 -0000 1.2 +++ testsuite/libffi.call/nested_struct9.c 8 Jun 2009 18:59:08 -0000 @@ -57,10 +57,8 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; @@ -68,12 +66,6 @@ ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -127,9 +119,9 @@ CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl); + res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); Index: testsuite/libffi.call/problem1.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/problem1.c,v retrieving revision 1.3 diff -u -b -w -r1.3 problem1.c --- testsuite/libffi.call/problem1.c 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.call/problem1.c 8 Jun 2009 18:59:08 -0000 @@ -45,19 +45,11 @@ ffi_type* my_ffi_struct_fields[4]; ffi_type my_ffi_struct_type; ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[4]; ffi_type* arg_types[3]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - struct my_ffi_struct g = { 1.0, 2.0, 3.0 }; struct my_ffi_struct f = { 1.0, 2.0, 3.0 }; struct my_ffi_struct res; @@ -87,9 +79,9 @@ printf("res: %g %g %g\n", res.a, res.b, res.c); /* { dg-output "\nres: 2 4 6" } */ - CHECK(ffi_prep_closure(pcl, &cif, stub, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, stub, NULL, code) == FFI_OK); - res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(pcl))(g, f); + res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(code))(g, f); /* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */ printf("res: %g %g %g\n", res.a, res.b, res.c); /* { dg-output "\nres: 2 4 6" } */ Index: testsuite/libffi.call/return_ldl.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/return_ldl.c,v retrieving revision 1.1 diff -u -b -w -r1.1 return_ldl.c --- testsuite/libffi.call/return_ldl.c 29 Jan 2008 15:16:43 -0000 1.1 +++ testsuite/libffi.call/return_ldl.c 8 Jun 2009 18:59:08 -0000 @@ -4,7 +4,7 @@ PR: none. Originator: <andreast@gcc.gnu.org> 20071113 */ -/* { dg-do run } */ +/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" static long double return_ldl(long double ldl) Index: testsuite/libffi.call/return_ll1.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/return_ll1.c,v retrieving revision 1.2 diff -u -b -w -r1.2 return_ll1.c --- testsuite/libffi.call/return_ll1.c 29 Jan 2008 15:15:20 -0000 1.2 +++ testsuite/libffi.call/return_ll1.c 8 Jun 2009 18:59:08 -0000 @@ -36,7 +36,7 @@ ll2 = 11111111; ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); - printf("res: %lld, %lld\n", rlonglong, ll0 + ll1 + ll2); + printf("res: %" PRId64 ", %" PRId64 "\n", rlonglong, ll0 + ll1 + ll2); /* { dg-output "res: 11111133333222, 11111133333222" } */ exit(0); } Index: testsuite/libffi.call/stret_large.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/stret_large.c,v retrieving revision 1.2 diff -u -b -w -r1.2 stret_large.c --- testsuite/libffi.call/stret_large.c 8 Jun 2009 16:50:49 -0000 1.2 +++ testsuite/libffi.call/stret_large.c 8 Jun 2009 18:59:08 -0000 @@ -75,21 +75,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[15]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -139,10 +131,10 @@ res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_108byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_108byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_108byte(*)(struct_108byte, struct_108byte, - struct_108byte, struct_108byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + struct_108byte, struct_108byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, Index: testsuite/libffi.call/stret_large2.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/stret_large2.c,v retrieving revision 1.2 diff -u -b -w -r1.2 stret_large2.c --- testsuite/libffi.call/stret_large2.c 8 Jun 2009 16:50:49 -0000 1.2 +++ testsuite/libffi.call/stret_large2.c 8 Jun 2009 18:59:08 -0000 @@ -77,21 +77,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[16]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -142,10 +134,10 @@ res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_116byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_116byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_116byte(*)(struct_116byte, struct_116byte, - struct_116byte, struct_116byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + struct_116byte, struct_116byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, Index: testsuite/libffi.call/stret_medium.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/stret_medium.c,v retrieving revision 1.2 diff -u -b -w -r1.2 stret_medium.c --- testsuite/libffi.call/stret_medium.c 8 Jun 2009 16:50:49 -0000 1.2 +++ testsuite/libffi.call/stret_medium.c 8 Jun 2009 18:59:08 -0000 @@ -61,21 +61,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[10]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -119,10 +111,10 @@ res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, - struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); Index: testsuite/libffi.call/stret_medium2.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/stret_medium2.c,v retrieving revision 1.2 diff -u -b -w -r1.2 stret_medium2.c --- testsuite/libffi.call/stret_medium2.c 8 Jun 2009 16:50:49 -0000 1.2 +++ testsuite/libffi.call/stret_medium2.c 8 Jun 2009 18:59:08 -0000 @@ -39,7 +39,7 @@ result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; - printf("%g %g %g %g %g %g %g %g %lld\n", result.a, result.b, result.c, + printf("%g %g %g %g %g %g %g %g %" PRId64 "\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i); return result; @@ -61,21 +61,13 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[10]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; -#ifdef USING_MMAP - pcl = allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif - cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -115,16 +107,16 @@ ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 16" } */ - printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, + printf("res: %g %g %g %g %g %g %g %g %" PRId64 "\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ - CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, - struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ - printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, + printf("res: %g %g %g %g %g %g %g %g %" PRId64 "\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ Index: testsuite/libffi.special/unwindtest.cc =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.special/unwindtest.cc,v retrieving revision 1.3 diff -u -b -w -r1.3 unwindtest.cc --- testsuite/libffi.special/unwindtest.cc 29 Jan 2008 15:15:20 -0000 1.3 +++ testsuite/libffi.special/unwindtest.cc 8 Jun 2009 18:59:08 -0000 @@ -27,7 +27,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)(*(int *)args[14]) + *(int *)args[15] + (int)(intptr_t)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]), @@ -38,7 +38,7 @@ (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); + (int)(intptr_t)userdata, (int)*(ffi_arg*)resp); throw (int)*(ffi_arg*)resp; } @@ -50,27 +50,20 @@ int main (void) { ffi_cif cif; -#ifndef USING_MMAP - static ffi_closure cl; -#endif - ffi_closure *pcl; + void *code; + ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; -#ifdef USING_MMAP - pcl = (ffi_closure *) allocate_mmap (sizeof(ffi_closure)); -#else - pcl = &cl; -#endif { cl_arg_types[1] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn, NULL) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn, NULL, code) == FFI_OK); try { - (*((closure_test_type)(pcl)))(); + (*((closure_test_type)(code)))(); } catch (int exception_code) { CHECK(exception_code == 9); @@ -104,11 +97,11 @@ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn1, - (void *) 3 /* userdata */) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, + (void *) 3 /* userdata */, code) == FFI_OK); try { - (*((closure_test_type1)pcl)) + (*((closure_test_type1)code)) (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, 19, 21, 1); /* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ [-- Attachment #3: Type: text/plain, Size: 1 bytes --] ^ permalink raw reply [flat|nested] 91+ messages in thread
* PATCH libffi win64 support 2009-06-09 15:32 ` Andrew Haley 2009-06-09 16:36 ` Timothy Wall @ 2009-06-09 18:08 ` Timothy Wall 2009-06-10 9:45 ` Andrew Haley 1 sibling, 1 reply; 91+ messages in thread From: Timothy Wall @ 2009-06-09 18:08 UTC (permalink / raw) To: Andrew Haley Cc: NightStrike, tromey, Ralf Wildenhues, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List [-- Attachment #1: win64-patch.diff --] [-- Type: application/octet-stream, Size: 37533 bytes --] Index: ChangeLog.libffi =================================================================== RCS file: /cvs/libffi/libffi/ChangeLog.libffi,v retrieving revision 1.50 diff -u -b -w -r1.50 ChangeLog.libffi --- ChangeLog.libffi 4 Jun 2009 16:29:58 -0000 1.50 +++ ChangeLog.libffi 8 Jun 2009 19:20:19 -0000 @@ -1,3 +1,19 @@ +2009-06-08 Timothy Wall <twall@users.sf.net> + + * Makefile.am, + configure.ac, + include/ffi.h.in, + include/ffi_common.h, + src/closures.c, + src/dlmalloc.c, + src/x86/ffi.c, + src/x86/ffitarget.h, + src/x86/win64.S (new), + README: Added win64 support (mingw or MSVC) + * ltcf-c.sh: properly escape cygwin/w32 path + * man/ffi_call.3: Clarify size requirements for return value. + * src/x86/ffi64.c: Fix filename in comment. + 2009-06-04 Andrew Haley <aph@redhat.com> * src/powerpc/ffitarget.h: Fix misapplied merge from gcc. Index: Makefile.am =================================================================== RCS file: /cvs/libffi/libffi/Makefile.am,v retrieving revision 1.23 diff -u -b -w -r1.23 Makefile.am --- Makefile.am 21 Feb 2008 13:36:18 -0000 1.23 +++ Makefile.am 8 Jun 2009 19:20:19 -0000 @@ -25,8 +25,8 @@ src/sh64/ffi.c src/sh64/sysv.S src/sh64/ffitarget.h \ src/sparc/v8.S src/sparc/v9.S src/sparc/ffitarget.h \ src/sparc/ffi.c src/x86/darwin64.S \ - src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/darwin.S \ - src/x86/freebsd.S \ + src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/win64.S \ + src/x86/darwin.S src/x86/freebsd.S \ src/x86/ffi64.c src/x86/unix64.S src/x86/ffitarget.h \ src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ @@ -102,6 +102,9 @@ if X86_WIN32 nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win32.S endif +if X86_WIN64 +nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win64.S +endif if X86_DARWIN nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S endif Index: README =================================================================== RCS file: /cvs/libffi/libffi/README,v retrieving revision 1.27 diff -u -b -w -r1.27 README --- README 19 Dec 2008 16:13:45 -0000 1.27 +++ README 8 Jun 2009 19:20:19 -0000 @@ -58,6 +58,7 @@ x86 linux x86 openbsd x86 solaris + x86-64 mingw x86-64 darwin x86-64 linux x86-64 OS X Index: configure.ac =================================================================== RCS file: /cvs/libffi/libffi/configure.ac,v retrieving revision 1.25 diff -u -b -w -r1.25 configure.ac --- configure.ac 3 Jun 2009 17:42:56 -0000 1.25 +++ configure.ac 8 Jun 2009 19:20:23 -0000 @@ -148,6 +148,7 @@ TARGET=X86_DARWIN; TARGETDIR=x86 ;; x86_64-*-cygwin* | x86_64-*-mingw*) + TARGET=X86_WIN64; TARGETDIR=x86 ;; x86_64-*-*) TARGET=X86_64; TARGETDIR=x86 @@ -165,6 +166,7 @@ AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32) +AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64) AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN) AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA) AM_CONDITIONAL(IA64, test x$TARGET = xIA64) Index: ltcf-c.sh =================================================================== RCS file: /cvs/libffi/libffi/ltcf-c.sh,v retrieving revision 1.1 diff -u -b -w -r1.1 ltcf-c.sh --- ltcf-c.sh 29 Jan 2008 12:30:10 -0000 1.1 +++ ltcf-c.sh 8 Jun 2009 19:20:23 -0000 @@ -376,7 +376,7 @@ old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' + fix_srcfile_path='\`cygpath -w \"\$srcfile\"\`' ;; darwin* | rhapsody*) Index: include/ffi.h.in =================================================================== RCS file: /cvs/libffi/libffi/include/ffi.h.in,v retrieving revision 1.12 diff -u -b -w -r1.12 ffi.h.in --- include/ffi.h.in 3 Apr 2008 18:57:34 -0000 1.12 +++ include/ffi.h.in 8 Jun 2009 19:20:23 -0000 @@ -67,6 +67,10 @@ #ifndef LIBFFI_ASM +#ifdef _MSC_VER +#define __attribute__(X) +#endif + #include <stddef.h> #include <limits.h> Index: include/ffi_common.h =================================================================== RCS file: /cvs/libffi/libffi/include/ffi_common.h,v retrieving revision 1.7 diff -u -b -w -r1.7 ffi_common.h --- include/ffi_common.h 29 Jan 2008 15:15:17 -0000 1.7 +++ include/ffi_common.h 8 Jun 2009 19:20:23 -0000 @@ -18,7 +18,10 @@ /* Do not move this. Some versions of AIX are very picky about where this is positioned. */ #ifdef __GNUC__ +/* mingw64 defines this already in malloc.h. */ +#ifndef alloca # define alloca __builtin_alloca +#endif # define MAYBE_UNUSED __attribute__((__unused__)) #else # define MAYBE_UNUSED @@ -29,11 +32,15 @@ #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ +# ifdef _MSC_VER +# define alloca _alloca +# else char *alloca (); # endif # endif # endif #endif +#endif /* Check for the existence of memcpy. */ #if STDC_HEADERS @@ -77,6 +84,16 @@ } extended_cif; /* Terse sized type definitions. */ +#ifdef _MSC_VER +typedef unsigned char UINT8; +typedef signed char SINT8; +typedef unsigned short UINT16; +typedef signed short SINT16; +typedef unsigned int UINT32; +typedef signed int SINT32; +typedef unsigned __int64 UINT64; +typedef signed __int64 SINT64; +#else typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); typedef signed int SINT8 __attribute__((__mode__(__QI__))); typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); @@ -85,6 +102,7 @@ typedef signed int SINT32 __attribute__((__mode__(__SI__))); typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); typedef signed int SINT64 __attribute__((__mode__(__DI__))); +#endif typedef float FLOAT32; Index: man/ffi_call.3 =================================================================== RCS file: /cvs/libffi/libffi/man/ffi_call.3,v retrieving revision 1.2 diff -u -b -w -r1.2 ffi_call.3 --- man/ffi_call.3 15 Feb 2008 15:30:26 -0000 1.2 +++ man/ffi_call.3 8 Jun 2009 19:20:23 -0000 @@ -34,8 +34,8 @@ .Nm ffi_call . .Pp .Fa rvalue -must point to storage that is sizeof(long) or larger. For smaller -return value sizes, the +must point to storage that is sizeof(ffi_arg) or larger for non-floating point +types. For smaller-sized return value types, the .Nm ffi_arg or .Nm ffi_sarg Index: src/closures.c =================================================================== RCS file: /cvs/libffi/libffi/src/closures.c,v retrieving revision 1.2 diff -u -b -w -r1.2 closures.c --- src/closures.c 15 Feb 2008 01:24:05 -0000 1.2 +++ src/closures.c 8 Jun 2009 19:20:23 -0000 @@ -42,6 +42,13 @@ locations in the virtual memory space, one location writable and another executable. */ # define FFI_MMAP_EXEC_WRIT 1 +# define HAVE_MNTENT 1 +# endif +# if defined(X86_WIN32) || defined(X86_WIN64) +/* Windows systems may have Data Execution Protection (DEP) enabled, + which requires the use of VirtualMalloc/VirtualFree to alloc/free + executable memory. */ +# define FFI_MMAP_EXEC_WRIT 1 # endif #endif @@ -60,7 +67,11 @@ #define USE_LOCKS 1 #define USE_DL_PREFIX 1 +#ifdef __GNUC__ +#ifndef USE_BUILTIN_FFS #define USE_BUILTIN_FFS 1 +#endif +#endif /* We need to use mmap, not sbrk. */ #define HAVE_MORECORE 0 @@ -90,10 +101,15 @@ #include <sys/stat.h> #include <fcntl.h> #include <errno.h> +#ifndef _MSC_VER #include <unistd.h> +#endif #include <string.h> #include <stdio.h> +#if !defined(X86_WIN32) && !defined(X86_WIN64) +#ifdef HAVE_MNTENT #include <mntent.h> +#endif /* HAVE_MNTENT */ #include <sys/param.h> #include <pthread.h> @@ -150,6 +166,7 @@ #define is_selinux_enabled() 0 #endif +#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ /* Declare all functions defined in dlmalloc.c as static. */ static void *dlmalloc(size_t); @@ -168,9 +185,11 @@ static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED; static void dlmalloc_stats(void) MAYBE_UNUSED; +#if !defined(X86_WIN32) && !defined(X86_WIN64) /* Use these for mmap and munmap within dlmalloc.c. */ static void *dlmmap(void *, size_t, int, int, int, off_t); static int dlmunmap(void *, size_t); +#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ #define mmap dlmmap #define munmap dlmunmap @@ -180,6 +199,8 @@ #undef mmap #undef munmap +#if !defined(X86_WIN32) && !defined(X86_WIN64) + /* A mutex used to synchronize access to *exec* variables in this file. */ static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -232,6 +253,7 @@ return open_temp_exec_file_dir (value); } +#ifdef HAVE_MNTENT /* Open a temporary file in an executable and writable mount point listed in the mounts file. Subsequent calls with the same mounts keep searching for mount points in the same file. Providing NULL @@ -278,6 +300,7 @@ return fd; } } +#endif /* HAVE_MNTENT */ /* Instructions to look for a location to hold a temporary file that can be mapped in for execution. */ @@ -292,8 +315,10 @@ { open_temp_exec_file_dir, "/var/tmp", 0 }, { open_temp_exec_file_dir, "/dev/shm", 0 }, { open_temp_exec_file_env, "HOME", 0 }, +#ifdef HAVE_MNTENT { open_temp_exec_file_mnt, "/etc/mtab", 1 }, { open_temp_exec_file_mnt, "/proc/mounts", 1 }, +#endif /* HAVE_MNTENT */ }; /* Current index into open_temp_exec_file_opts. */ @@ -489,6 +514,8 @@ } #endif +#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ + /* Allocate a chunk of memory with the given size. Returns a pointer to the writable address, and sets *CODE to the executable corresponding virtual address. */ Index: src/dlmalloc.c =================================================================== RCS file: /cvs/libffi/libffi/src/dlmalloc.c,v retrieving revision 1.1 diff -u -b -w -r1.1 dlmalloc.c --- src/dlmalloc.c 29 Jan 2008 15:16:43 -0000 1.1 +++ src/dlmalloc.c 8 Jun 2009 19:20:24 -0000 @@ -1140,9 +1140,9 @@ /*------------------------------ internal #includes ---------------------- */ -#ifdef WIN32 +#ifdef _MSC_VER #pragma warning( disable : 4146 ) /* no "unsigned" warnings */ -#endif /* WIN32 */ +#endif /* _MSC_VER */ #include <stdio.h> /* for printing in malloc_stats */ @@ -1315,14 +1315,14 @@ /* Win32 MMAP via VirtualAlloc */ static void* win32mmap(size_t size) { - void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); + void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE); return (ptr != 0)? ptr: MFAIL; } /* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ static void* win32direct_mmap(size_t size) { void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, - PAGE_READWRITE); + PAGE_EXECUTE_READWRITE); return (ptr != 0)? ptr: MFAIL; } Index: src/prep_cif.c =================================================================== RCS file: /cvs/libffi/libffi/src/prep_cif.c,v retrieving revision 1.7 diff -u -b -w -r1.7 prep_cif.c --- src/prep_cif.c 15 Feb 2008 01:24:05 -0000 1.7 +++ src/prep_cif.c 8 Jun 2009 19:20:24 -0000 @@ -39,9 +39,11 @@ FFI_ASSERT(arg != NULL); - FFI_ASSERT(arg->elements != NULL); FFI_ASSERT(arg->size == 0); - FFI_ASSERT(arg->alignment == 0); + + if (arg->elements == NULL || arg->alignment != 0) { + return FFI_BAD_TYPEDEF; + } ptr = &(arg->elements[0]); @@ -93,7 +95,12 @@ ffi_type **ptr; FFI_ASSERT(cif != NULL); - FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI)); + /* FIXME: most targets have a broken definition of FFI_LAST_ABI */ + /* + if (abi < FFI_FIRST_ABI || abi > FFI_LAST_ABI) { + return FFI_BAD_ABI; + } + */ cif->abi = abi; cif->arg_types = atypes; Index: src/x86/ffi.c =================================================================== RCS file: /cvs/libffi/libffi/src/x86/ffi.c,v retrieving revision 1.15 diff -u -b -w -r1.15 ffi.c --- src/x86/ffi.c 3 Apr 2008 18:57:34 -0000 1.15 +++ src/x86/ffi.c 8 Jun 2009 19:20:24 -0000 @@ -28,7 +28,11 @@ DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ -#ifndef __x86_64__ +#if !defined(__x86_64__) || defined(_WIN64) + +#ifdef _WIN64 +#include <windows.h> +#endif #include <ffi.h> #include <ffi_common.h> @@ -47,10 +51,15 @@ argp = stack; - if (ecif->cif->flags == FFI_TYPE_STRUCT) + if (ecif->cif->flags == FFI_TYPE_STRUCT +#ifdef X86_WIN64 + && (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2 + && ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8) +#endif + ) { *(void **) argp = ecif->rvalue; - argp += 4; + argp += sizeof(void*); } p_argv = ecif->avalue; @@ -62,41 +71,59 @@ size_t z; /* Align if necessary */ - if ((sizeof(int) - 1) & (unsigned) argp) - argp = (char *) ALIGN(argp, sizeof(int)); + if ((sizeof(void*) - 1) & (size_t) argp) + argp = (char *) ALIGN(argp, sizeof(void*)); z = (*p_arg)->size; - if (z < sizeof(int)) +#ifdef X86_WIN64 + if (z > sizeof(ffi_arg) + || ((*p_arg)->type == FFI_TYPE_STRUCT + && (z != 1 && z != 2 && z != 4 && z != 8)) +#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE + || ((*p_arg)->type == FFI_TYPE_LONGDOUBLE) +#endif + ) + { + z = sizeof(ffi_arg); + *(void **)argp = *p_argv; + } + else if ((*p_arg)->type == FFI_TYPE_FLOAT) { - z = sizeof(int); + memcpy(argp, *p_argv, z); + } + else +#endif + if (z < sizeof(ffi_arg)) + { + z = sizeof(ffi_arg); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + *(ffi_sarg *) argp = (ffi_sarg)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + *(ffi_arg *) argp = (ffi_arg)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + *(ffi_sarg *) argp = (ffi_sarg)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + *(ffi_arg *) argp = (ffi_arg)*(UINT16 *)(* p_argv); break; case FFI_TYPE_SINT32: - *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv); + *(ffi_sarg *) argp = (ffi_sarg)*(SINT32 *)(* p_argv); break; case FFI_TYPE_UINT32: - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + *(ffi_arg *) argp = (ffi_arg)*(UINT32 *)(* p_argv); break; case FFI_TYPE_STRUCT: - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + *(ffi_arg *) argp = *(ffi_arg *)(* p_argv); break; default: @@ -108,7 +135,11 @@ memcpy(argp, *p_argv, z); } p_argv++; +#ifdef X86_WIN64 + argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); +#else argp += z; +#endif } return; @@ -124,21 +155,32 @@ #ifdef X86 case FFI_TYPE_STRUCT: #endif -#if defined(X86) || defined(X86_DARWIN) +#if defined(X86) || defined(X86_DARWIN) || defined(X86_WIN64) case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: #endif +#ifdef X86_WIN64 + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: +#endif case FFI_TYPE_SINT64: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: +#ifndef X86_WIN64 +#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE case FFI_TYPE_LONGDOUBLE: +#endif +#endif cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_UINT64: +#ifdef X86_WIN64 + case FFI_TYPE_POINTER: +#endif cif->flags = FFI_TYPE_SINT64; break; @@ -154,7 +196,11 @@ } else if (cif->rtype->size == 4) { +#ifdef X86_WIN64 + cif->flags = FFI_TYPE_SMALL_STRUCT_4B; +#else cif->flags = FFI_TYPE_INT; /* same as int type */ +#endif } else if (cif->rtype->size == 8) { @@ -163,12 +209,23 @@ else { cif->flags = FFI_TYPE_STRUCT; +#ifdef X86_WIN64 + // allocate space for return value pointer + cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); +#endif } break; #endif default: +#ifdef X86_WIN64 + cif->flags = FFI_TYPE_SINT64; + break; + case FFI_TYPE_INT: + cif->flags = FFI_TYPE_SINT32; +#else cif->flags = FFI_TYPE_INT; +#endif break; } @@ -176,6 +233,22 @@ cif->bytes = (cif->bytes + 15) & ~0xF; #endif +#ifdef X86_WIN64 + { + unsigned int i; + ffi_type **ptr; + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + if (((*ptr)->alignment - 1) & cif->bytes) + cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment); + cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG); + } + } + // ensure space for storing four registers + cif->bytes += 4 * sizeof(ffi_arg); +#endif + return FFI_OK; } @@ -187,6 +260,11 @@ unsigned, unsigned, unsigned *, void (*fn)(void)); #endif /* X86_WIN32 */ +#ifdef X86_WIN64 +extern int +ffi_call_win64(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); +#endif void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { @@ -198,17 +276,52 @@ /* 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)) +#ifdef X86_WIN64 + if (rvalue == NULL + && cif->flags == FFI_TYPE_STRUCT + && cif->rtype->size != 1 && cif->rtype->size != 2 + && cif->rtype->size != 4 && cif->rtype->size != 8) + { + ecif.rvalue = alloca((cif->rtype->size + 0xF) & ~0xF); + } +#else + if (rvalue == NULL + && cif->flags == FFI_TYPE_STRUCT) { ecif.rvalue = alloca(cif->rtype->size); } +#endif else ecif.rvalue = rvalue; switch (cif->abi) { +#ifdef X86_WIN64 + case FFI_WIN64: + { + // Make copies of all struct arguments + // NOTE: not sure if responsibility should be here or in caller + unsigned int i; + for (i=0; i < cif->nargs;i++) { + size_t size = cif->arg_types[i]->size; + if ((cif->arg_types[i]->type == FFI_TYPE_STRUCT + && (size != 1 && size != 2 && size != 4 && size != 8)) +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || cif->arg_types[i]->type == FFI_TYPE_LONGDOUBLE +#endif + ) + { + void *local = alloca(size); + memcpy(local, avalue[i], size); + avalue[i] = local; + } + } + ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + } + break; +#else case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); @@ -219,6 +332,7 @@ ecif.rvalue, fn); break; #endif /* X86_WIN32 */ +#endif /* X86_WIN64 */ default: FFI_ASSERT(0); break; @@ -240,9 +354,42 @@ void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) __attribute__ ((regparm(1))); #endif +#ifdef X86_WIN64 +void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); +#endif /* This function is jumped to by the trampoline */ +#ifdef X86_WIN64 +void * FFI_HIDDEN +ffi_closure_win64_inner (ffi_closure *closure, void *args) { + ffi_cif *cif; + void **arg_area; + void *result; + void *resp = &result; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will change RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, &resp, arg_area, cif); + + (closure->fun) (cif, resp, arg_area, closure->user_data); + + /* The result is returned in rax. This does the right thing for + result types except for floats; we have to 'mov xmm0, rax' in the + caller to correct this. + TODO: structure sizes of 3 5 6 7 are returned by reference, too!!! + */ + return cif->rtype->size > sizeof(void *) ? resp : *(void **)resp; +} + +#else unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (closure, respp, args) ffi_closure *closure; @@ -259,7 +406,7 @@ /* this call will initialize ARG_AREA, such that each * element in that array points to the corresponding * value on the stack; and if the function returns - * a structure, it will re-set RESP to point to the + * a structure, it will change RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); @@ -268,6 +415,7 @@ return cif->flags; } +#endif /* !X86_WIN64 */ static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, @@ -280,10 +428,20 @@ argp = stack; +#ifdef X86_WIN64 + if (cif->rtype->size > sizeof(ffi_arg) + || (cif->flags == FFI_TYPE_STRUCT + && (cif->rtype->size != 1 && cif->rtype->size != 2 + && cif->rtype->size != 4 && cif->rtype->size != 8))) { + *rvalue = *(void **) argp; + argp += sizeof(void *); + } +#else if ( cif->flags == FFI_TYPE_STRUCT ) { *rvalue = *(void **) argp; - argp += 4; + argp += sizeof(void *); } +#endif p_argv = avalue; @@ -292,23 +450,58 @@ size_t z; /* Align if necessary */ - if ((sizeof(int) - 1) & (unsigned) argp) { - argp = (char *) ALIGN(argp, sizeof(int)); + if ((sizeof(void*) - 1) & (size_t) argp) { + argp = (char *) ALIGN(argp, sizeof(void*)); } +#ifdef X86_WIN64 + if ((*p_arg)->size > sizeof(ffi_arg) + || ((*p_arg)->type == FFI_TYPE_STRUCT + && ((*p_arg)->size != 1 && (*p_arg)->size != 2 + && (*p_arg)->size != 4 && (*p_arg)->size != 8))) + { + z = sizeof(void *); + *p_argv = *(void **)argp; + } + else +#endif + { z = (*p_arg)->size; /* because we're little endian, this is what it turns into. */ *p_argv = (void*) argp; + } p_argv++; +#ifdef X86_WIN64 + argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); +#else argp += z; +#endif } return; } +#define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + void* __fun = (void*)(FUN); \ + void* __ctx = (void*)(CTX); \ + *(unsigned char*) &__tramp[0] = 0x41; \ + *(unsigned char*) &__tramp[1] = 0xbb; \ + *(unsigned int*) &__tramp[2] = MASK; /* mov $mask, %r11 */ \ + *(unsigned char*) &__tramp[6] = 0x48; \ + *(unsigned char*) &__tramp[7] = 0xb8; \ + *(void**) &__tramp[8] = __ctx; /* mov __ctx, %rax */ \ + *(unsigned char *) &__tramp[16] = 0x49; \ + *(unsigned char *) &__tramp[17] = 0xba; \ + *(void**) &__tramp[18] = __fun; /* mov __fun, %r10 */ \ + *(unsigned char *) &__tramp[26] = 0x41; \ + *(unsigned char *) &__tramp[27] = 0xff; \ + *(unsigned char *) &__tramp[28] = 0xe2; /* jmp %r10 */ \ + } + /* How to make a trampoline. Derived from gcc/config/i386/i386.c. */ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ @@ -345,6 +538,18 @@ void *user_data, void *codeloc) { +#ifdef X86_WIN64 +#define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE) +#define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0) + if (cif->abi == FFI_WIN64) + { + int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3); + FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0], + &ffi_closure_win64, + codeloc, mask); + /* make sure we can execute here */ + } +#else if (cif->abi == FFI_SYSV) { FFI_INIT_TRAMPOLINE (&closure->tramp[0], @@ -358,7 +563,8 @@ &ffi_closure_STDCALL, (void*)codeloc, cif->bytes); } -#endif +#endif /* X86_WIN32 */ +#endif /* !X86_WIN64 */ else { return FFI_BAD_ABI; @@ -472,4 +678,5 @@ #endif -#endif /* __x86_64__ */ +#endif /* !__x86_64__ || X86_WIN64 */ + Index: src/x86/ffi64.c =================================================================== RCS file: /cvs/libffi/libffi/src/x86/ffi64.c,v retrieving revision 1.4 diff -u -b -w -r1.4 ffi64.c --- src/x86/ffi64.c 26 Feb 2008 17:34:36 -0000 1.4 +++ src/x86/ffi64.c 8 Jun 2009 19:20:24 -0000 @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2002, 2007 Bo Thorsen <bo@suse.de> + ffi64.c - Copyright (c) 2002, 2007 Bo Thorsen <bo@suse.de> Copyright (c) 2008 Red Hat, Inc. x86-64 Foreign Function Interface Index: src/x86/ffitarget.h =================================================================== RCS file: /cvs/libffi/libffi/src/x86/ffitarget.h,v retrieving revision 1.5 diff -u -b -w -r1.5 ffitarget.h --- src/x86/ffitarget.h 15 Feb 2008 01:24:06 -0000 1.5 +++ src/x86/ffitarget.h 8 Jun 2009 19:20:24 -0000 @@ -36,11 +36,26 @@ #define X86 #endif +#ifdef X86_WIN64 +#define FFI_SIZEOF_ARG 8 +#define USE_BUILTIN_FFS 0 // not yet implemented in mingw-64 +#endif + /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM +#ifdef X86_WIN64 +#ifdef _MSC_VER +typedef unsigned __int64 ffi_arg; +typedef __int64 ffi_sarg; +#else +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#endif +#else typedef unsigned long ffi_arg; typedef signed long ffi_sarg; +#endif typedef enum ffi_abi { FFI_FIRST_ABI = 0, @@ -53,6 +68,11 @@ FFI_DEFAULT_ABI = FFI_SYSV, #endif +#ifdef X86_WIN64 + FFI_WIN64, + FFI_DEFAULT_ABI = FFI_WIN64, +#else + /* ---- Intel x86 and AMD x86-64 - */ #if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__)) FFI_SYSV, @@ -63,6 +83,7 @@ FFI_DEFAULT_ABI = FFI_UNIX64, #endif #endif +#endif /* X86_WIN64 */ FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 } ffi_abi; @@ -73,6 +94,7 @@ #define FFI_CLOSURES 1 #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) +#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) #define FFI_TRAMPOLINE_SIZE 24 @@ -81,10 +103,18 @@ #ifdef X86_WIN32 #define FFI_TRAMPOLINE_SIZE 13 #else +#ifdef X86_WIN64 +#define FFI_TRAMPOLINE_SIZE 29 +#define FFI_NATIVE_RAW_API 0 +#define FFI_NO_RAW_API 1 +#else #define FFI_TRAMPOLINE_SIZE 10 #endif +#endif +#ifndef X86_WIN64 #define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ #endif +#endif #endif Index: src/x86/win64.S =================================================================== RCS file: src/x86/win64.S diff -N src/x86/win64.S --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/x86/win64.S 8 Jun 2009 19:20:24 -0000 @@ -0,0 +1,462 @@ +#define LIBFFI_ASM +#include <fficonfig.h> +#include <ffi.h> + +/* Constants for ffi_call_win64 */ +#define STACK 0 +#define PREP_ARGS_FN 32 +#define ECIF 40 +#define CIF_BYTES 48 +#define CIF_FLAGS 56 +#define RVALUE 64 +#define FN 72 + +/* ffi_call_win64 (void (*prep_args_fn)(char *, extended_cif *), + extended_cif *ecif, unsigned bytes, unsigned flags, + unsigned *rvalue, void (*fn)()); + */ + +#ifdef _MSC_VER +PUBLIC ffi_call_win64 + +EXTRN __chkstk:NEAR +EXTRN ffi_closure_win64_inner:NEAR + +_TEXT SEGMENT + +;;; ffi_closure_win64 will be called with these registers set: +;;; rax points to 'closure' +;;; r11 contains a bit mask that specifies which of the +;;; first four parameters are float or double +;;; +;;; It must move the parameters passed in registers to their stack location, +;;; call ffi_closure_win64_inner for the actual work, then return the result. +;;; +ffi_closure_win64 PROC FRAME + ;; copy register arguments onto stack + test r11, 1 + jne first_is_float + mov QWORD PTR [rsp+8], rcx + jmp second +first_is_float: + movlpd QWORD PTR [rsp+8], xmm0 + +second: + test r11, 2 + jne second_is_float + mov QWORD PTR [rsp+16], rdx + jmp third +second_is_float: + movlpd QWORD PTR [rsp+16], xmm1 + +third: + test r11, 4 + jne third_is_float + mov QWORD PTR [rsp+24], r8 + jmp fourth +third_is_float: + movlpd QWORD PTR [rsp+24], xmm2 + +fourth: + test r11, 8 + jne fourth_is_float + mov QWORD PTR [rsp+32], r9 + jmp done +fourth_is_float: + movlpd QWORD PTR [rsp+32], xmm3 + +done: + .ALLOCSTACK 40 + sub rsp, 40 + .ENDPROLOG + mov rcx, rax ; context is first parameter + mov rdx, rsp ; stack is second parameter + add rdx, 48 ; point to start of arguments + mov rax, ffi_closure_win64_inner + call rax ; call the real closure function + add rsp, 40 + movd xmm0, rax ; If the closure returned a float, + ; ffi_closure_win64_inner wrote it to rax + ret 0 +ffi_closure_win64 ENDP + +ffi_call_win64 PROC FRAME + ;; copy registers onto stack + mov QWORD PTR [rsp+32], r9 + mov QWORD PTR [rsp+24], r8 + mov QWORD PTR [rsp+16], rdx + mov QWORD PTR [rsp+8], rcx + .PUSHREG rbp + push rbp + .ALLOCSTACK 48 + sub rsp, 48 ; 00000030H + .SETFRAME rbp, 32 + lea rbp, QWORD PTR [rsp+32] + .ENDPROLOG + + mov eax, DWORD PTR CIF_BYTES[rbp] + add rax, 15 + and rax, -16 + call __chkstk + sub rsp, rax + lea rax, QWORD PTR [rsp+32] + mov QWORD PTR STACK[rbp], rax + + mov rdx, QWORD PTR ECIF[rbp] + mov rcx, QWORD PTR STACK[rbp] + call QWORD PTR PREP_ARGS_FN[rbp] + + mov rsp, QWORD PTR STACK[rbp] + + movlpd xmm3, QWORD PTR [rsp+24] + movd r9, xmm3 + + movlpd xmm2, QWORD PTR [rsp+16] + movd r8, xmm2 + + movlpd xmm1, QWORD PTR [rsp+8] + movd rdx, xmm1 + + movlpd xmm0, QWORD PTR [rsp] + movd rcx, xmm0 + + call QWORD PTR FN[rbp] +ret_struct4b$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_4B + jne ret_struct2b$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov DWORD PTR [rcx], eax + jmp ret_void$ + +ret_struct2b$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_2B + jne ret_struct1b$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov WORD PTR [rcx], ax + jmp ret_void$ + +ret_struct1b$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_1B + jne ret_uint8$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov BYTE PTR [rcx], al + jmp ret_void$ + +ret_uint8$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT8 + jne ret_sint8$ + + mov rcx, QWORD PTR RVALUE[rbp] + movzx rax, al + mov QWORD PTR [rcx], rax + jmp ret_void$ + +ret_sint8$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT8 + jne ret_uint16$ + + mov rcx, QWORD PTR RVALUE[rbp] + movsx rax, al + mov QWORD PTR [rcx], rax + jmp ret_void$ + +ret_uint16$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT16 + jne ret_sint16$ + + mov rcx, QWORD PTR RVALUE[rbp] + movzx rax, ax + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_sint16$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT16 + jne ret_uint32$ + + mov rcx, QWORD PTR RVALUE[rbp] + movsx rax, ax + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_uint32$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT32 + jne ret_sint32$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov eax, eax + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_sint32$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT32 + jne ret_float$ + + mov rcx, QWORD PTR RVALUE[rbp] + cdqe + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_float$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_FLOAT + jne SHORT ret_double$ + + mov rax, QWORD PTR RVALUE[rbp] + movss DWORD PTR [rax], xmm0 + jmp SHORT ret_void$ + +ret_double$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_DOUBLE + jne SHORT ret_sint64$ + + mov rax, QWORD PTR RVALUE[rbp] + movlpd QWORD PTR [rax], xmm0 + jmp SHORT ret_void$ + +ret_sint64$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT64 + jne ret_void$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_void$: + xor rax, rax + + lea rsp, QWORD PTR [rbp+16] + pop rbp + ret 0 +ffi_call_win64 ENDP +_TEXT ENDS +END +#else +.text + +.extern ___chkstk +.extern _ffi_closure_win64_inner + +# ffi_closure_win64 will be called with these registers set: +# rax points to 'closure' +# r11 contains a bit mask that specifies which of the +# first four parameters are float or double +# +# It must move the parameters passed in registers to their stack location, +# call ffi_closure_win64_inner for the actual work, then return the result. +# + .balign 16 + .globl _ffi_closure_win64 +_ffi_closure_win64: + # copy register arguments onto stack + test $1,%r11 + jne .Lfirst_is_float + mov %rcx, 8(%rsp) + jmp .Lsecond +.Lfirst_is_float: + movlpd %xmm0, 8(%rsp) + +.Lsecond: + test $2, %r11 + jne .Lsecond_is_float + mov %rdx, 16(%rsp) + jmp .Lthird +.Lsecond_is_float: + movlpd %xmm1, 16(%rsp) + +.Lthird: + test $4, %r11 + jne .Lthird_is_float + mov %r8,24(%rsp) + jmp .Lfourth +.Lthird_is_float: + movlpd %xmm2, 24(%rsp) + +.Lfourth: + test $8, %r11 + jne .Lfourth_is_float + mov %r9, 32(%rsp) + jmp .Ldone +.Lfourth_is_float: + movlpd %xmm3, 32(%rsp) + +.Ldone: +#.ALLOCSTACK 40 + sub $40, %rsp +#.ENDPROLOG + mov %rax, %rcx # context is first parameter + mov %rsp, %rdx # stack is second parameter + add $48, %rdx # point to start of arguments + mov $_ffi_closure_win64_inner, %rax + callq *%rax # call the real closure function + add $40, %rsp + movq %rax, %xmm0 # If the closure returned a float, + # ffi_closure_win64_inner wrote it to rax + retq +.ffi_closure_win64_end: + + .balign 16 + .globl _ffi_call_win64 +_ffi_call_win64: + # copy registers onto stack + mov %r9,32(%rsp) + mov %r8,24(%rsp) + mov %rdx,16(%rsp) + mov %rcx,8(%rsp) + #.PUSHREG rbp + push %rbp + #.ALLOCSTACK 48 + sub $48,%rsp + #.SETFRAME rbp, 32 + lea 32(%rsp),%rbp + #.ENDPROLOG + + mov CIF_BYTES(%rbp),%eax + add $15, %rax + and $-16, %rax + callq ___chkstk + cmpq $0x1000, %rax + jb Lch_done +Lch_probe: + subq $0x1000,%rsp + orl $0x0, (%rsp) + subq $0x1000,%rax + cmpq $0x1000,%rax + ja Lch_probe +Lch_done: + subq %rax, %rsp + orl $0x0, (%rsp) + lea 32(%rsp), %rax + mov %rax, STACK(%rbp) + + mov ECIF(%rbp), %rdx + mov STACK(%rbp), %rcx + callq *PREP_ARGS_FN(%rbp) + + mov STACK(%rbp), %rsp + + movlpd 24(%rsp), %xmm3 + movd %xmm3, %r9 + + movlpd 16(%rsp), %xmm2 + movd %xmm2, %r8 + + movlpd 8(%rsp), %xmm1 + movd %xmm1, %rdx + + movlpd (%rsp), %xmm0 + movd %xmm0, %rcx + + callq *FN(%rbp) +.Lret_struct4b: + cmpl $FFI_TYPE_SMALL_STRUCT_4B, CIF_FLAGS(%rbp) + jne .Lret_struct2b + + mov RVALUE(%rbp), %rcx + mov %eax, (%rcx) + jmp .Lret_void + +.Lret_struct2b: + cmpl $FFI_TYPE_SMALL_STRUCT_2B, CIF_FLAGS(%rbp) + jne .Lret_struct1b + + mov RVALUE(%rbp), %rcx + mov %ax, (%rcx) + jmp .Lret_void + +.Lret_struct1b: + cmpl $FFI_TYPE_SMALL_STRUCT_1B, CIF_FLAGS(%rbp) + jne .Lret_uint8 + + mov RVALUE(%rbp), %rcx + mov %al, (%rcx) + jmp .Lret_void + +.Lret_uint8: + cmpl $FFI_TYPE_UINT8, CIF_FLAGS(%rbp) + jne .Lret_sint8 + + mov RVALUE(%rbp), %rcx + movzbq %al, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint8: + cmpl $FFI_TYPE_SINT8, CIF_FLAGS(%rbp) + jne .Lret_uint16 + + mov RVALUE(%rbp), %rcx + movsbq %al, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_uint16: + cmpl $FFI_TYPE_UINT16, CIF_FLAGS(%rbp) + jne .Lret_sint16 + + mov RVALUE(%rbp), %rcx + movzwq %ax, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint16: + cmpl $FFI_TYPE_SINT16, CIF_FLAGS(%rbp) + jne .Lret_uint32 + + mov RVALUE(%rbp), %rcx + movswq %ax, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_uint32: + cmpl $FFI_TYPE_UINT32, CIF_FLAGS(%rbp) + jne .Lret_sint32 + + mov RVALUE(%rbp), %rcx + movl %eax, %eax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint32: + cmpl $FFI_TYPE_SINT32, CIF_FLAGS(%rbp) + jne .Lret_float + + mov RVALUE(%rbp), %rcx + cltq + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_float: + cmpl $FFI_TYPE_FLOAT, CIF_FLAGS(%rbp) + jne .Lret_double + + mov RVALUE(%rbp), %rax + movss %xmm0, (%rax) + jmp .Lret_void + +.Lret_double: + cmpl $FFI_TYPE_DOUBLE, CIF_FLAGS(%rbp) + jne .Lret_sint64 + + mov RVALUE(%rbp), %rax + movlpd %xmm0, (%rax) + jmp .Lret_void + +.Lret_sint64: + cmpl $FFI_TYPE_SINT64, CIF_FLAGS(%rbp) + jne .Lret_void + + mov RVALUE(%rbp), %rcx + mov %rax, (%rcx) + jmp .Lret_void + +.Lret_void: + xor %rax, %rax + + lea 16(%rbp), %rsp + pop %rbp + retq +.ffi_call_win64_end: +#endif /* !_MSC_VER */ + ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-09 18:08 ` PATCH libffi win64 support Timothy Wall @ 2009-06-10 9:45 ` Andrew Haley 2009-06-10 10:54 ` Timothy Wall 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-10 9:45 UTC (permalink / raw) To: Timothy Wall; +Cc: libffi-discuss Timothy Wall wrote: > 2009-06-08 Timothy Wall <twall@users.sf.net> > > * Makefile.am, > configure.ac, > include/ffi.h.in, > include/ffi_common.h, > src/closures.c, > src/dlmalloc.c, > src/x86/ffi.c, > src/x86/ffitarget.h, > src/x86/win64.S (new), > README: Added win64 support (mingw or MSVC) > * ltcf-c.sh: properly escape cygwin/w32 path > * man/ffi_call.3: Clarify size requirements for return value. > * src/x86/ffi64.c: Fix filename in comment. Please commit this and let me know as soon as you've done so. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-10 9:45 ` Andrew Haley @ 2009-06-10 10:54 ` Timothy Wall 2009-06-12 14:21 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Timothy Wall @ 2009-06-10 10:54 UTC (permalink / raw) To: Andrew Haley; +Cc: libffi-discuss applied. On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote: > Timothy Wall wrote: >> 2009-06-08 Timothy Wall <twall@users.sf.net> >> >> * Makefile.am, >> configure.ac, >> include/ffi.h.in, >> include/ffi_common.h, >> src/closures.c, >> src/dlmalloc.c, >> src/x86/ffi.c, >> src/x86/ffitarget.h, >> src/x86/win64.S (new), >> README: Added win64 support (mingw or MSVC) >> * ltcf-c.sh: properly escape cygwin/w32 path >> * man/ffi_call.3: Clarify size requirements for return value. >> * src/x86/ffi64.c: Fix filename in comment. > > Please commit this and let me know as soon as you've done so. > > Andrew. > > ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-10 10:54 ` Timothy Wall @ 2009-06-12 14:21 ` Andrew Haley 2009-06-12 15:02 ` Timothy Wall 2009-06-12 15:23 ` Timothy Wall 0 siblings, 2 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-12 14:21 UTC (permalink / raw) To: Timothy Wall; +Cc: libffi-discuss Timothy Wall wrote: > applied. > > On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote: > >> Timothy Wall wrote: >>> 2009-06-08 Timothy Wall <twall@users.sf.net> >>> >>> * Makefile.am, >>> configure.ac, >>> include/ffi.h.in, >>> include/ffi_common.h, >>> src/closures.c, >>> src/dlmalloc.c, >>> src/x86/ffi.c, >>> src/x86/ffitarget.h, >>> src/x86/win64.S (new), >>> README: Added win64 support (mingw or MSVC) >>> * ltcf-c.sh: properly escape cygwin/w32 path >>> * man/ffi_call.3: Clarify size requirements for return value. >>> * src/x86/ffi64.c: Fix filename in comment. >> >> Please commit this and let me know as soon as you've done so. I've got a few new test failures. They're of the form libffi/testsuite/libffi.call/cls_align_sint64.c:80: warning: format '%ld' expects type 'long int', but argument 3 has type 'long long int' It's because of changes like this: - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); which prints out a long long as an int64. This is wrong, since the type is "long long" and the printf format must match the declaration of the object being printed. Andrew. 2009-06-12 Andrew Haley <aph@redhat.com> * ChangeLog.libffi: testsuite/libffi.call/cls_align_sint64.c, testsuite/libffi.call/cls_align_uint64.c, testsuite/libffi.call/cls_ulonglong.c, testsuite/libffi.call/return_ll1.c, testsuite/libffi.call/stret_medium2.c: Fix printf format specifiers. testsuite/libffi.special/unwindtest.cc: include stdint.h Index: testsuite/libffi.call/cls_align_sint64.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_sint64.c,v retrieving revision 1.4 diff -u -r1.4 cls_align_sint64.c --- testsuite/libffi.call/cls_align_sint64.c 11 Jun 2009 14:27:28 -0000 1.4 +++ testsuite/libffi.call/cls_align_sint64.c 12 Jun 2009 14:15:30 -0000 @@ -22,7 +22,7 @@ result.b = a1.b + a2.b; result.c = a1.c + a2.c; - printf("%d %" PRId64 " %d %d %" PRId64 " %d: %d %" PRId64 " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + printf("%d %lld %d %d %lld %d: %d %lld %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } @@ -77,14 +77,14 @@ ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); Index: testsuite/libffi.call/cls_align_uint64.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_align_uint64.c,v retrieving revision 1.4 diff -u -r1.4 cls_align_uint64.c --- testsuite/libffi.call/cls_align_uint64.c 11 Jun 2009 14:27:28 -0000 1.4 +++ testsuite/libffi.call/cls_align_uint64.c 12 Jun 2009 14:15:30 -0000 @@ -23,7 +23,7 @@ result.b = a1.b + a2.b; result.c = a1.c + a2.c; - printf("%d %" PRId64 " %d %d %" PRId64 " %d: %d %" PRId64 " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + printf("%d %llu %d %d %llu %d: %d %llu %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } @@ -78,14 +78,14 @@ ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + printf("res: %d %llu %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + printf("res: %d %llu %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); Index: testsuite/libffi.call/cls_ulonglong.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/cls_ulonglong.c,v retrieving revision 1.4 diff -u -r1.4 cls_ulonglong.c --- testsuite/libffi.call/cls_ulonglong.c 11 Jun 2009 14:27:28 -0000 1.4 +++ testsuite/libffi.call/cls_ulonglong.c 12 Jun 2009 14:15:30 -0000 @@ -12,7 +12,7 @@ { *(unsigned long long *)resp= *(unsigned long long *)args[0]; - printf("%" PRIu64 ": %" PRIu64 "\n",*(unsigned long long *)args[0], + printf("%llu: %llu\n",*(unsigned long long *)args[0], *(unsigned long long *)(resp)); } typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long); @@ -34,12 +34,12 @@ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); res = (*((cls_ret_ulonglong)code))(214LL); /* { dg-output "214: 214" } */ - printf("res: %" PRId64 "\n", res); + printf("res: %llu\n", res); /* { dg-output "\nres: 214" } */ res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ - printf("res: %" PRId64 "\n", res); + printf("res: %llu\n", res); /* { dg-output "\nres: 9223372035854775808" } */ exit(0); Index: testsuite/libffi.call/return_ll1.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/return_ll1.c,v retrieving revision 1.3 diff -u -r1.3 return_ll1.c --- testsuite/libffi.call/return_ll1.c 11 Jun 2009 14:27:28 -0000 1.3 +++ testsuite/libffi.call/return_ll1.c 12 Jun 2009 14:15:30 -0000 @@ -36,7 +36,7 @@ ll2 = 11111111; ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); - printf("res: %" PRId64 ", %" PRId64 "\n", rlonglong, ll0 + ll1 + ll2); + printf("res: %lld, %lld\n", rlonglong, ll0 + ll1 + ll2); /* { dg-output "res: 11111133333222, 11111133333222" } */ exit(0); } Index: testsuite/libffi.call/stret_medium2.c =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.call/stret_medium2.c,v retrieving revision 1.3 diff -u -r1.3 stret_medium2.c --- testsuite/libffi.call/stret_medium2.c 11 Jun 2009 14:27:28 -0000 1.3 +++ testsuite/libffi.call/stret_medium2.c 12 Jun 2009 14:15:30 -0000 @@ -39,7 +39,7 @@ result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; - printf("%g %g %g %g %g %g %g %g %" PRId64 "\n", result.a, result.b, result.c, + printf("%g %g %g %g %g %g %g %g %lld\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i); return result; @@ -107,7 +107,7 @@ ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 16" } */ - printf("res: %g %g %g %g %g %g %g %g %" PRId64 "\n", res_dbl.a, res_dbl.b, res_dbl.c, + printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ @@ -116,7 +116,7 @@ res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ - printf("res: %g %g %g %g %g %g %g %g %" PRId64 "\n", res_dbl.a, res_dbl.b, res_dbl.c, + printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ Index: testsuite/libffi.special/unwindtest.cc =================================================================== RCS file: /cvs/libffi/libffi/testsuite/libffi.special/unwindtest.cc,v retrieving revision 1.4 diff -u -r1.4 unwindtest.cc --- testsuite/libffi.special/unwindtest.cc 11 Jun 2009 14:27:28 -0000 1.4 +++ testsuite/libffi.special/unwindtest.cc 12 Jun 2009 14:15:30 -0000 @@ -6,6 +6,7 @@ /* { dg-do run } */ #include "ffitestcxx.h" +#include <stdint.h> void closure_test_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 14:21 ` Andrew Haley @ 2009-06-12 15:02 ` Timothy Wall 2009-06-12 15:08 ` Kai Tietz 2009-06-12 15:17 ` Andrew Haley 2009-06-12 15:23 ` Timothy Wall 1 sibling, 2 replies; 91+ messages in thread From: Timothy Wall @ 2009-06-12 15:02 UTC (permalink / raw) To: Andrew Haley; +Cc: libffi-discuss On Jun 12, 2009, at 10:20 AM, Andrew Haley wrote: > Timothy Wall wrote: >> applied. >> >> On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote: >> >>> Timothy Wall wrote: >>>> 2009-06-08 Timothy Wall <twall@users.sf.net> >>>> >>>> * Makefile.am, >>>> configure.ac, >>>> include/ffi.h.in, >>>> include/ffi_common.h, >>>> src/closures.c, >>>> src/dlmalloc.c, >>>> src/x86/ffi.c, >>>> src/x86/ffitarget.h, >>>> src/x86/win64.S (new), >>>> README: Added win64 support (mingw or MSVC) >>>> * ltcf-c.sh: properly escape cygwin/w32 path >>>> * man/ffi_call.3: Clarify size requirements for return value. >>>> * src/x86/ffi64.c: Fix filename in comment. >>> >>> Please commit this and let me know as soon as you've done so. > > I've got a few new test failures. They're of the form > > libffi/testsuite/libffi.call/cls_align_sint64.c:80: warning: format > '%ld' expects type 'long int', but argument 3 has type 'long long int' > > It's because of changes like this: > > - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); > + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, > res_dbl.c); > > which prints out a long long as an int64. This is wrong, since > the type is "long long" and the printf format must match the > declaration of the object being printed. When compiling with mingw(64), the underlying runtime library doesn't recognize "lld" (which is what PRId64 evaluates to on my OSX), but rather expects "I64" or some such (properly represented by PRId64 with mingw). If PRId64 is evaluating to "%ld", then perhaps that's a bug in the inttypes.h header. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 15:02 ` Timothy Wall @ 2009-06-12 15:08 ` Kai Tietz 2009-06-12 15:17 ` Andrew Haley 1 sibling, 0 replies; 91+ messages in thread From: Kai Tietz @ 2009-06-12 15:08 UTC (permalink / raw) To: Timothy Wall; +Cc: Andrew Haley, libffi-discuss 2009/6/12 Timothy Wall <twalljava@dev.java.net>: > > On Jun 12, 2009, at 10:20 AM, Andrew Haley wrote: > >> Timothy Wall wrote: >>> >>> applied. >>> >>> On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote: >>> >>>> Timothy Wall wrote: >>>>> >>>>> 2009-06-08 Timothy Wall <twall@users.sf.net> >>>>> >>>>> * Makefile.am, >>>>> configure.ac, >>>>> include/ffi.h.in, >>>>> include/ffi_common.h, >>>>> src/closures.c, >>>>> src/dlmalloc.c, >>>>> src/x86/ffi.c, >>>>> src/x86/ffitarget.h, >>>>> src/x86/win64.S (new), >>>>> README: Added win64 support (mingw or MSVC) >>>>> * ltcf-c.sh: properly escape cygwin/w32 path >>>>> * man/ffi_call.3: Clarify size requirements for return value. >>>>> * src/x86/ffi64.c: Fix filename in comment. >>>> >>>> Please commit this and let me know as soon as you've done so. >> >> I've got a few new test failures. They're of the form >> >> libffi/testsuite/libffi.call/cls_align_sint64.c:80: warning: format '%ld' >> expects type 'long int', but argument 3 has type 'long long int' >> >> It's because of changes like this: >> >> - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >> + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >> >> which prints out a long long as an int64. This is wrong, since >> the type is "long long" and the printf format must match the >> declaration of the object being printed. > > When compiling with mingw(64), the underlying runtime library doesn't > recognize "lld" (which is what PRId64 evaluates to on my OSX), but rather > expects "I64" or some such (properly represented by PRId64 with mingw). > > If PRId64 is evaluating to "%ld", then perhaps that's a bug in the > inttypes.h header. > Well, possibly the define PRIdMAX is more acurate here. Because on system were 'long' has scalar width of 64-bit and type 'long long' has a bigger size, it still will fit. But as Timothy said, for mingw(32/64) using runtime printf methods, the width specifier 'll' needs not to exist. IIRC MS defines it with runtime version 8.0 (and above), but older versions don't have this. Cheers, Kai -- | (\_/) This is Bunny. Copy and paste | (='.'=) Bunny into your signature to help | (")_(") him gain world domination ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 15:02 ` Timothy Wall 2009-06-12 15:08 ` Kai Tietz @ 2009-06-12 15:17 ` Andrew Haley 1 sibling, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-12 15:17 UTC (permalink / raw) To: libffi-discuss Timothy Wall wrote: > > On Jun 12, 2009, at 10:20 AM, Andrew Haley wrote: > >> Timothy Wall wrote: >>> applied. >>> >>> On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote: >>> >>>> Timothy Wall wrote: >>>>> 2009-06-08 Timothy Wall <twall@users.sf.net> >>>>> >>>>> * Makefile.am, >>>>> configure.ac, >>>>> include/ffi.h.in, >>>>> include/ffi_common.h, >>>>> src/closures.c, >>>>> src/dlmalloc.c, >>>>> src/x86/ffi.c, >>>>> src/x86/ffitarget.h, >>>>> src/x86/win64.S (new), >>>>> README: Added win64 support (mingw or MSVC) >>>>> * ltcf-c.sh: properly escape cygwin/w32 path >>>>> * man/ffi_call.3: Clarify size requirements for return value. >>>>> * src/x86/ffi64.c: Fix filename in comment. >>>> >>>> Please commit this and let me know as soon as you've done so. >> >> I've got a few new test failures. They're of the form >> >> libffi/testsuite/libffi.call/cls_align_sint64.c:80: warning: format >> '%ld' expects type 'long int', but argument 3 has type 'long long int' >> >> It's because of changes like this: >> >> - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >> + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >> >> which prints out a long long as an int64. This is wrong, since >> the type is "long long" and the printf format must match the >> declaration of the object being printed. > > When compiling with mingw(64), the underlying runtime library doesn't > recognize "lld" (which is what PRId64 evaluates to on my OSX), but > rather expects "I64" or some such (properly represented by PRId64 with > mingw). > > If PRId64 is evaluating to "%ld", then perhaps that's a bug in the > inttypes.h header. Why do you think it's a bug in the inttypes.h header? PRId64 is perfectly OK for an int64_t, but it's not OK for a long long. Both are 64-bit ints, but they are different types. You can't just substitute a type that happens to be the same size. If we're to use PRId64 then we have to change the type of the arg to int64_t. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 14:21 ` Andrew Haley 2009-06-12 15:02 ` Timothy Wall @ 2009-06-12 15:23 ` Timothy Wall 2009-06-12 15:44 ` Andrew Haley 1 sibling, 1 reply; 91+ messages in thread From: Timothy Wall @ 2009-06-12 15:23 UTC (permalink / raw) To: Andrew Haley; +Cc: libffi-discuss On Jun 12, 2009, at 10:20 AM, Andrew Haley wrote: > Timothy Wall wrote: >> applied. >> >> On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote: >> >>> Timothy Wall wrote: >>>> 2009-06-08 Timothy Wall <twall@users.sf.net> >>>> >>>> * Makefile.am, >>>> configure.ac, >>>> include/ffi.h.in, >>>> include/ffi_common.h, >>>> src/closures.c, >>>> src/dlmalloc.c, >>>> src/x86/ffi.c, >>>> src/x86/ffitarget.h, >>>> src/x86/win64.S (new), >>>> README: Added win64 support (mingw or MSVC) >>>> * ltcf-c.sh: properly escape cygwin/w32 path >>>> * man/ffi_call.3: Clarify size requirements for return value. >>>> * src/x86/ffi64.c: Fix filename in comment. >>> >>> Please commit this and let me know as soon as you've done so. > > I've got a few new test failures. They're of the form > > libffi/testsuite/libffi.call/cls_align_sint64.c:80: warning: format > '%ld' expects type 'long int', but argument 3 has type 'long long int' > > It's because of changes like this: > > - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); > + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, > res_dbl.c); > > which prints out a long long as an int64. This is wrong, since > the type is "long long" and the printf format must match the > declaration of the object being printed. I see that on 64-bit linux, PRId64 evaluates to "ld". "long int" is the same size as "long long int", but gcc is still complaining. Can you instead cast the "long long int" argument to int64_t or something to remove the warning? ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 15:23 ` Timothy Wall @ 2009-06-12 15:44 ` Andrew Haley 2009-06-12 15:46 ` NightStrike 2009-06-16 15:57 ` NightStrike 0 siblings, 2 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-12 15:44 UTC (permalink / raw) To: Timothy Wall; +Cc: libffi-discuss Timothy Wall wrote: > > On Jun 12, 2009, at 10:20 AM, Andrew Haley wrote: > >> Timothy Wall wrote: >>> applied. >>> >>> On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote: >>> >>>> Timothy Wall wrote: >>>>> 2009-06-08 Timothy Wall <twall@users.sf.net> >>>>> >>>>> * Makefile.am, >>>>> configure.ac, >>>>> include/ffi.h.in, >>>>> include/ffi_common.h, >>>>> src/closures.c, >>>>> src/dlmalloc.c, >>>>> src/x86/ffi.c, >>>>> src/x86/ffitarget.h, >>>>> src/x86/win64.S (new), >>>>> README: Added win64 support (mingw or MSVC) >>>>> * ltcf-c.sh: properly escape cygwin/w32 path >>>>> * man/ffi_call.3: Clarify size requirements for return value. >>>>> * src/x86/ffi64.c: Fix filename in comment. >>>> >>>> Please commit this and let me know as soon as you've done so. >> >> I've got a few new test failures. They're of the form >> >> libffi/testsuite/libffi.call/cls_align_sint64.c:80: warning: format >> '%ld' expects type 'long int', but argument 3 has type 'long long int' >> >> It's because of changes like this: >> >> - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >> + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >> >> which prints out a long long as an int64. This is wrong, since >> the type is "long long" and the printf format must match the >> declaration of the object being printed. > > I see that on 64-bit linux, PRId64 evaluates to "ld". "long int" is > the same size as "long long int", but gcc is still complaining. Can you > instead cast the "long long int" argument to int64_t or something to > remove the warning? Hmm. I guess under the circumstances that's the right thing to do, but it's pretty evil in a test case that's suppose to test long long. Is the Windows library going to get fixed to accept %lld in the forseeable future? If so, we could just xfail it until then. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 15:44 ` Andrew Haley @ 2009-06-12 15:46 ` NightStrike 2009-06-12 15:53 ` Andrew Haley 2009-06-16 15:57 ` NightStrike 1 sibling, 1 reply; 91+ messages in thread From: NightStrike @ 2009-06-12 15:46 UTC (permalink / raw) To: Andrew Haley; +Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz On Fri, Jun 12, 2009 at 11:44 AM, Andrew Haley<aph@redhat.com> wrote: > Timothy Wall wrote: >> >> On Jun 12, 2009, at 10:20 AM, Andrew Haley wrote: >> >>> Timothy Wall wrote: >>>> applied. >>>> >>>> On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote: >>>> >>>>> Timothy Wall wrote: >>>>>> 2009-06-08 Timothy Wall <twall@users.sf.net> >>>>>> >>>>>> * Makefile.am, >>>>>> configure.ac, >>>>>> include/ffi.h.in, >>>>>> include/ffi_common.h, >>>>>> src/closures.c, >>>>>> src/dlmalloc.c, >>>>>> src/x86/ffi.c, >>>>>> src/x86/ffitarget.h, >>>>>> src/x86/win64.S (new), >>>>>> README: Added win64 support (mingw or MSVC) >>>>>> * ltcf-c.sh: properly escape cygwin/w32 path >>>>>> * man/ffi_call.3: Clarify size requirements for return value. >>>>>> * src/x86/ffi64.c: Fix filename in comment. >>>>> >>>>> Please commit this and let me know as soon as you've done so. >>> >>> I've got a few new test failures. They're of the form >>> >>> libffi/testsuite/libffi.call/cls_align_sint64.c:80: warning: format >>> '%ld' expects type 'long int', but argument 3 has type 'long long int' >>> >>> It's because of changes like this: >>> >>> - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >>> + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >>> >>> which prints out a long long as an int64. This is wrong, since >>> the type is "long long" and the printf format must match the >>> declaration of the object being printed. >> >> I see that on 64-bit linux, PRId64 evaluates to "ld". "long int" is >> the same size as "long long int", but gcc is still complaining. Can you >> instead cast the "long long int" argument to int64_t or something to >> remove the warning? > > Hmm. I guess under the circumstances that's the right thing to do, > but it's pretty evil in a test case that's suppose to test long long. > Is the Windows library going to get fixed to accept %lld in the > forseeable future? If so, we could just xfail it until then. It's not really a bug per se. It's a feature of the platform. If the test case is testing a type that doesn't exist on a given platform, maybe the proper thing to do is mark it UNSUPPORTED, as opposed to XFAIL. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 15:46 ` NightStrike @ 2009-06-12 15:53 ` Andrew Haley 2009-06-12 19:17 ` Timothy Wall 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-12 15:53 UTC (permalink / raw) To: NightStrike; +Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz NightStrike wrote: > On Fri, Jun 12, 2009 at 11:44 AM, Andrew Haley<aph@redhat.com> wrote: >> Timothy Wall wrote: >>> On Jun 12, 2009, at 10:20 AM, Andrew Haley wrote: >>> >>>> Timothy Wall wrote: >>>>> applied. >>>>> >>>>> On Jun 10, 2009, at 5:45 AM, Andrew Haley wrote: >>>>> >>>>>> Timothy Wall wrote: >>>>>>> 2009-06-08 Timothy Wall <twall@users.sf.net> >>>>>>> >>>>>>> * Makefile.am, >>>>>>> configure.ac, >>>>>>> include/ffi.h.in, >>>>>>> include/ffi_common.h, >>>>>>> src/closures.c, >>>>>>> src/dlmalloc.c, >>>>>>> src/x86/ffi.c, >>>>>>> src/x86/ffitarget.h, >>>>>>> src/x86/win64.S (new), >>>>>>> README: Added win64 support (mingw or MSVC) >>>>>>> * ltcf-c.sh: properly escape cygwin/w32 path >>>>>>> * man/ffi_call.3: Clarify size requirements for return value. >>>>>>> * src/x86/ffi64.c: Fix filename in comment. >>>>>> Please commit this and let me know as soon as you've done so. >>>> I've got a few new test failures. They're of the form >>>> >>>> libffi/testsuite/libffi.call/cls_align_sint64.c:80: warning: format >>>> '%ld' expects type 'long int', but argument 3 has type 'long long int' >>>> >>>> It's because of changes like this: >>>> >>>> - printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >>>> + printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); >>>> >>>> which prints out a long long as an int64. This is wrong, since >>>> the type is "long long" and the printf format must match the >>>> declaration of the object being printed. >>> I see that on 64-bit linux, PRId64 evaluates to "ld". "long int" is >>> the same size as "long long int", but gcc is still complaining. Can you >>> instead cast the "long long int" argument to int64_t or something to >>> remove the warning? >> Hmm. I guess under the circumstances that's the right thing to do, >> but it's pretty evil in a test case that's suppose to test long long. >> Is the Windows library going to get fixed to accept %lld in the >> forseeable future? If so, we could just xfail it until then. > > It's not really a bug per se. It's a feature of the platform. I suppose you could argue that a part of Standard C that is missing is just a feature of a platform rather than a bug, but I find that pretty hard to believe. > If the test case is testing a type that doesn't exist on a given > platform, maybe the proper thing to do is mark it UNSUPPORTED, as > opposed to XFAIL. That's not the problem: it has the type but not the printf format specifier, or so it seems. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 15:53 ` Andrew Haley @ 2009-06-12 19:17 ` Timothy Wall 2009-06-12 20:03 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Timothy Wall @ 2009-06-12 19:17 UTC (permalink / raw) To: Andrew Haley; +Cc: NightStrike, libffi-discuss, Kai Tietz, Kai Tietz On Jun 12, 2009, at 11:53 AM, Andrew Haley wrote: > >>>> I see that on 64-bit linux, PRId64 evaluates to "ld". "long >>>> int" is >>>> the same size as "long long int", but gcc is still complaining. >>>> Can you >>>> instead cast the "long long int" argument to int64_t or something >>>> to >>>> remove the warning? > >>> Hmm. I guess under the circumstances that's the right thing to do, >>> but it's pretty evil in a test case that's suppose to test long >>> long. >>> Is the Windows library going to get fixed to accept %lld in the >>> forseeable future? If so, we could just xfail it until then. >> >> It's not really a bug per se. It's a feature of the platform. > > I suppose you could argue that a part of Standard C that is missing is > just a feature of a platform rather than a bug, but I find that pretty > hard to believe. > >> If the test case is testing a type that doesn't exist on a given >> platform, maybe the proper thing to do is mark it UNSUPPORTED, as >> opposed to XFAIL. > > That's not the problem: it has the type but not the printf format > specifier, or so it seems. I don't think PRIdMAX would work either; on my linux it's mapped to the "ld" as well. Since there's no PRIxxx defined that explicitly maps to long long, we could put one in ffitest.h and use that. Something like: #ifdef WIN64 #define PRIdLL PRId64 #define PRIuLL PRIu64 #else #define PRIdLL lld #define PRIuLL llu #endif ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 19:17 ` Timothy Wall @ 2009-06-12 20:03 ` Andrew Haley 2009-06-12 20:31 ` Timothy Wall 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-12 20:03 UTC (permalink / raw) To: Timothy Wall; +Cc: NightStrike, libffi-discuss, Kai Tietz, Kai Tietz Timothy Wall wrote: > > On Jun 12, 2009, at 11:53 AM, Andrew Haley wrote: > >> >>>>> I see that on 64-bit linux, PRId64 evaluates to "ld". "long int" is >>>>> the same size as "long long int", but gcc is still complaining. >>>>> Can you >>>>> instead cast the "long long int" argument to int64_t or something to >>>>> remove the warning? >> >>>> Hmm. I guess under the circumstances that's the right thing to do, >>>> but it's pretty evil in a test case that's suppose to test long long. >>>> Is the Windows library going to get fixed to accept %lld in the >>>> forseeable future? If so, we could just xfail it until then. >>> >>> It's not really a bug per se. It's a feature of the platform. >> >> I suppose you could argue that a part of Standard C that is missing is >> just a feature of a platform rather than a bug, but I find that pretty >> hard to believe. >> >>> If the test case is testing a type that doesn't exist on a given >>> platform, maybe the proper thing to do is mark it UNSUPPORTED, as >>> opposed to XFAIL. >> >> That's not the problem: it has the type but not the printf format >> specifier, or so it seems. > > I don't think PRIdMAX would work either; on my linux it's mapped to the > "ld" as well. > > Since there's no PRIxxx defined that explicitly maps to long long, we > could put one in ffitest.h and use that. > Something like: > > #ifdef WIN64 > #define PRIdLL PRId64 > #define PRIuLL PRIu64 > #else > #define PRIdLL lld > #define PRIuLL llu > #endif Sounds OK. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 20:03 ` Andrew Haley @ 2009-06-12 20:31 ` Timothy Wall 0 siblings, 0 replies; 91+ messages in thread From: Timothy Wall @ 2009-06-12 20:31 UTC (permalink / raw) To: Andrew Haley; +Cc: NightStrike, libffi-discuss, Kai Tietz On Jun 12, 2009, at 4:03 PM, Andrew Haley wrote: >> >> I don't think PRIdMAX would work either; on my linux it's mapped to >> the >> "ld" as well. >> >> Since there's no PRIxxx defined that explicitly maps to long long, we >> could put one in ffitest.h and use that. >> Something like: >> >> #ifdef WIN64 >> #define PRIdLL PRId64 >> #define PRIuLL PRIu64 >> #else >> #define PRIdLL lld >> #define PRIuLL llu >> #endif > > Sounds OK. Here's the correct snippet: /* Provide an appropriate "long long" print format. */ #if defined(X86_WIN32) || defined(X86_WIN64) #define PRIdLL PRId64 #define PRIuLL PRIu64 #else #define PRIdLL "lld" #define PRIuLL "llu" #endif NOTE: apparently "lld" will work on OSX 10.2 and later; inttypes.h on OSX defines the PRIdMAX as "jd" to work with prior OS versions. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-12 15:44 ` Andrew Haley 2009-06-12 15:46 ` NightStrike @ 2009-06-16 15:57 ` NightStrike 2009-06-16 16:03 ` NightStrike 2009-06-16 16:31 ` PATCH libffi win64 support Andrew Haley 1 sibling, 2 replies; 91+ messages in thread From: NightStrike @ 2009-06-16 15:57 UTC (permalink / raw) To: Andrew Haley Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches On Fri, Jun 12, 2009 at 11:44 AM, Andrew Haley<aph@redhat.com> wrote: > Hmm. I guess under the circumstances that's the right thing to do, > but it's pretty evil in a test case that's suppose to test long long. > Is the Windows library going to get fixed to accept %lld in the > forseeable future? If so, we could just xfail it until then. > > Andrew. > > Andrew, Are all of Tim's patches now committed to gcc? I ask because I get this trying to using the libffi in the gcc repo: configure: error: "libffi has not been ported to x86_64-w64-mingw32." ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 15:57 ` NightStrike @ 2009-06-16 16:03 ` NightStrike 2009-06-16 16:26 ` Andrew Haley 2009-06-16 16:31 ` PATCH libffi win64 support Andrew Haley 1 sibling, 1 reply; 91+ messages in thread From: NightStrike @ 2009-06-16 16:03 UTC (permalink / raw) To: Andrew Haley Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches On Tue, Jun 16, 2009 at 11:57 AM, NightStrike<nightstrike@gmail.com> wrote: > On Fri, Jun 12, 2009 at 11:44 AM, Andrew Haley<aph@redhat.com> wrote: >> Hmm. I guess under the circumstances that's the right thing to do, >> but it's pretty evil in a test case that's suppose to test long long. >> Is the Windows library going to get fixed to accept %lld in the >> forseeable future? If so, we could just xfail it until then. >> >> Andrew. >> >> > > Andrew, > > Are all of Tim's patches now committed to gcc? I ask because I get > this trying to using the libffi in the gcc repo: > > configure: error: "libffi has not been ported to x86_64-w64-mingw32." > It looks like you might just have to regenerate configure ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 16:03 ` NightStrike @ 2009-06-16 16:26 ` Andrew Haley 2009-06-16 17:58 ` Ralf Wildenhues 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-16 16:26 UTC (permalink / raw) To: NightStrike Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches NightStrike wrote: > On Tue, Jun 16, 2009 at 11:57 AM, NightStrike<nightstrike@gmail.com> wrote: >> On Fri, Jun 12, 2009 at 11:44 AM, Andrew Haley<aph@redhat.com> wrote: >>> Hmm. I guess under the circumstances that's the right thing to do, >>> but it's pretty evil in a test case that's suppose to test long long. >>> Is the Windows library going to get fixed to accept %lld in the >>> forseeable future? If so, we could just xfail it until then. >> >> Are all of Tim's patches now committed to gcc? I ask because I get >> this trying to using the libffi in the gcc repo: >> >> configure: error: "libffi has not been ported to x86_64-w64-mingw32." >> > > It looks like you might just have to regenerate configure I did, about five times, and it made no difference. I wonder if there might be some autoconf weirdness with timestamps or checksums or somesuch. Never mind, it's OK now. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 16:26 ` Andrew Haley @ 2009-06-16 17:58 ` Ralf Wildenhues 2009-06-16 18:20 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: Ralf Wildenhues @ 2009-06-16 17:58 UTC (permalink / raw) To: Andrew Haley Cc: NightStrike, Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches * Andrew Haley wrote on Tue, Jun 16, 2009 at 06:25:30PM CEST: > NightStrike wrote: > > On Tue, Jun 16, 2009 at 11:57 AM, NightStrike<nightstrike@gmail.com> wrote: > >> configure: error: "libffi has not been ported to x86_64-w64-mingw32." > > > > It looks like you might just have to regenerate configure > > I did, about five times, and it made no difference. I wonder if there > might be some autoconf weirdness with timestamps or checksums or somesuch. autoconf without --force looks at time stamps of input files, yes. Cheers, Ralf ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 17:58 ` Ralf Wildenhues @ 2009-06-16 18:20 ` Andrew Haley 2009-06-16 19:11 ` Ralf Wildenhues 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-16 18:20 UTC (permalink / raw) To: Ralf Wildenhues, Andrew Haley, NightStrike, Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches Ralf Wildenhues wrote: > * Andrew Haley wrote on Tue, Jun 16, 2009 at 06:25:30PM CEST: >> NightStrike wrote: >>> On Tue, Jun 16, 2009 at 11:57 AM, NightStrike<nightstrike@gmail.com> wrote: >>>> configure: error: "libffi has not been ported to x86_64-w64-mingw32." >>> It looks like you might just have to regenerate configure >> I did, about five times, and it made no difference. I wonder if there >> might be some autoconf weirdness with timestamps or checksums or somesuch. > > autoconf without --force looks at time stamps of input files, yes. Oh, no! That is a classic case of an accident waiting to happen. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 18:20 ` Andrew Haley @ 2009-06-16 19:11 ` Ralf Wildenhues 2009-06-17 12:36 ` Dave Korn 0 siblings, 1 reply; 91+ messages in thread From: Ralf Wildenhues @ 2009-06-16 19:11 UTC (permalink / raw) To: Andrew Haley Cc: NightStrike, Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches * Andrew Haley wrote on Tue, Jun 16, 2009 at 08:19:39PM CEST: > Ralf Wildenhues wrote: > > > > autoconf without --force looks at time stamps of input files, yes. > > Oh, no! That is a classic case of an accident waiting to happen. Well, it's also a nontrivial speedup in common use cases. Cheers, Ralf ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 19:11 ` Ralf Wildenhues @ 2009-06-17 12:36 ` Dave Korn 2009-06-17 12:53 ` Andrew Haley 2009-06-17 17:51 ` autom4te caching (was: PATCH libffi win64 support) Ralf Wildenhues 0 siblings, 2 replies; 91+ messages in thread From: Dave Korn @ 2009-06-17 12:36 UTC (permalink / raw) To: Ralf Wildenhues, Andrew Haley, NightStrike, Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches Ralf Wildenhues wrote: > * Andrew Haley wrote on Tue, Jun 16, 2009 at 08:19:39PM CEST: >> Ralf Wildenhues wrote: >>> autoconf without --force looks at time stamps of input files, yes. >> Oh, no! That is a classic case of an accident waiting to happen. > > Well, it's also a nontrivial speedup in common use cases. > > Cheers, > Ralf ? I would have thought "running autoconf" doesn't count as a "common" operation but as a rare and almost always explicitly user-directed one. The risk/benefit tradeoff here seems wrong to me. cheers, DaveK ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-17 12:36 ` Dave Korn @ 2009-06-17 12:53 ` Andrew Haley 2009-06-17 14:21 ` Dave Korn 2009-06-17 17:51 ` autom4te caching (was: PATCH libffi win64 support) Ralf Wildenhues 1 sibling, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-17 12:53 UTC (permalink / raw) To: Dave Korn; +Cc: libffi-discuss, GCC Patches Dave Korn wrote: > Ralf Wildenhues wrote: >> * Andrew Haley wrote on Tue, Jun 16, 2009 at 08:19:39PM CEST: >>> Ralf Wildenhues wrote: >>>> autoconf without --force looks at time stamps of input files, yes. >>> Oh, no! That is a classic case of an accident waiting to happen. >> Well, it's also a nontrivial speedup in common use cases. >> >> Cheers, >> Ralf > > ? I would have thought "running autoconf" doesn't count as a "common" > operation but as a rare and almost always explicitly user-directed one. The > risk/benefit tradeoff here seems wrong to me. me2. I was wondering if a patch to change this behaviour to using a checkssum rather than a time stamp might be accepted. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-17 12:53 ` Andrew Haley @ 2009-06-17 14:21 ` Dave Korn 0 siblings, 0 replies; 91+ messages in thread From: Dave Korn @ 2009-06-17 14:21 UTC (permalink / raw) To: Andrew Haley; +Cc: Dave Korn, libffi-discuss, GCC Patches Andrew Haley wrote: > Dave Korn wrote: >> Ralf Wildenhues wrote: >>> * Andrew Haley wrote on Tue, Jun 16, 2009 at 08:19:39PM CEST: >>>> Ralf Wildenhues wrote: >>>>> autoconf without --force looks at time stamps of input files, yes. >>>> Oh, no! That is a classic case of an accident waiting to happen. >>> Well, it's also a nontrivial speedup in common use cases. >>> >>> Cheers, >>> Ralf >> ? I would have thought "running autoconf" doesn't count as a "common" >> operation but as a rare and almost always explicitly user-directed one. The >> risk/benefit tradeoff here seems wrong to me. > > me2. I was wondering if a patch to change this behaviour to using > a checkssum rather than a time stamp might be accepted. > > Andrew. I'd suggest that the optimisation could be removed altogether; timestamp-based dependency tracking belongs in make - even though that would also have been tricked in this case, but then autoconf itself should run unconditionally, so the manual reconfiguring would have worked. But I dunno if maybe the autoconf guys have been down this road before and what the reasons for implementing it in autoconf itself were when it was done. cheers, DaveK ^ permalink raw reply [flat|nested] 91+ messages in thread
* autom4te caching (was: PATCH libffi win64 support) 2009-06-17 12:36 ` Dave Korn 2009-06-17 12:53 ` Andrew Haley @ 2009-06-17 17:51 ` Ralf Wildenhues 1 sibling, 0 replies; 91+ messages in thread From: Ralf Wildenhues @ 2009-06-17 17:51 UTC (permalink / raw) To: Dave Korn Cc: Andrew Haley, NightStrike, Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches This discussion is verging on the off-list for the copied lists. Please consider redirecting followups to <autoconf@gnu.org>. * Dave Korn wrote on Wed, Jun 17, 2009 at 02:13:13PM CEST: > Ralf Wildenhues wrote: > > * Andrew Haley wrote on Tue, Jun 16, 2009 at 08:19:39PM CEST: > >> Ralf Wildenhues wrote: > >>> autoconf without --force looks at time stamps of input files, yes. > >> Oh, no! That is a classic case of an accident waiting to happen. > > > > Well, it's also a nontrivial speedup in common use cases. > > ? I would have thought "running autoconf" doesn't count as a "common" > operation but as a rare and almost always explicitly user-directed one. The > risk/benefit tradeoff here seems wrong to me. First off, whether autoconf, or any autotools for that matter, are run commonly or not, depends on how a project handles this. Projects that do not use maintainer-mode can run them quite often during development. Now, all of aclocal, autoconf, autoheader, and automake, under the hood use autom4te which in turn uses m4 in order to parse parts of the configure.ac and various included and provided macro files. Only the autoconf program actually creates the configure script as a result of that, but the other programs may for example just use some trace output (e.g., automake wants to know which variables are AC_SUBSTed, so that it can build a list of "VARIABLE = @VARIABLE@" lines, and autoheader wants to know symbols which are AC_DEFINEd). To cut a long story short, if configure.ac is changed, it is very common that m4 would be invoked several times. This would be quite costly. The caching which autom4te implements improves this situation quite noticeably for common setups. We are speaking not of 1-5% speedup here, but 30% or more, looking at the time all autotools take to run. You can turn off autom4te caching. This is documented in <http://www.gnu.org/software/autoconf/manual/html_node/Customizing-autom4te.html>. As to explicit user direction: No, I hardly ever call any of the autotools explicitly. One of my first steps for the autotools upgrade for GCC will be to fix the rebuilding rules so that they run reliably from 'make', and do _not_ require running autotools manually. Of course, with --enable-maintainer-mode only, certainly, before anybody gets all nervous here. And yes, I will post more about this soonish. Cheers, Ralf ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 15:57 ` NightStrike 2009-06-16 16:03 ` NightStrike @ 2009-06-16 16:31 ` Andrew Haley 2009-06-16 17:19 ` NightStrike 1 sibling, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-16 16:31 UTC (permalink / raw) To: NightStrike Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches NightStrike wrote: > On Fri, Jun 12, 2009 at 11:44 AM, Andrew Haley<aph@redhat.com> wrote: >> Hmm. I guess under the circumstances that's the right thing to do, >> but it's pretty evil in a test case that's suppose to test long long. >> Is the Windows library going to get fixed to accept %lld in the >> forseeable future? If so, we could just xfail it until then. > Andrew, > > Are all of Tim's patches now committed to gcc? I ask because I get > this trying to using the libffi in the gcc repo: > > configure: error: "libffi has not been ported to x86_64-w64-mingw32." OK, fixed. Andrew. 2009-06-16 Andrew Haley <aph@redhat.com> * configure.ac (TARGETDIR): Add missing blank lines. * configure: Regenerate. =================================================================== --- configure.ac (revision 148536) +++ configure.ac (working copy) @@ -145,9 +145,11 @@ x86_64-*-darwin*) TARGET=X86_DARWIN; TARGETDIR=x86 ;; + x86_64-*-cygwin* | x86_64-*-mingw*) TARGET=X86_WIN64; TARGETDIR=x86 ;; + x86_64-*-*) TARGET=X86_64; TARGETDIR=x86 ;; ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 16:31 ` PATCH libffi win64 support Andrew Haley @ 2009-06-16 17:19 ` NightStrike 2009-06-16 17:37 ` Andrew Haley 2009-06-16 17:57 ` Ralf Wildenhues 0 siblings, 2 replies; 91+ messages in thread From: NightStrike @ 2009-06-16 17:19 UTC (permalink / raw) To: Andrew Haley Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches On Tue, Jun 16, 2009 at 12:31 PM, Andrew Haley<aph@redhat.com> wrote: > NightStrike wrote: >> On Fri, Jun 12, 2009 at 11:44 AM, Andrew Haley<aph@redhat.com> wrote: >>> Hmm. I guess under the circumstances that's the right thing to do, >>> but it's pretty evil in a test case that's suppose to test long long. >>> Is the Windows library going to get fixed to accept %lld in the >>> forseeable future? If so, we could just xfail it until then. > >> Andrew, >> >> Are all of Tim's patches now committed to gcc? I ask because I get >> this trying to using the libffi in the gcc repo: >> >> configure: error: "libffi has not been ported to x86_64-w64-mingw32." > > OK, fixed. Now libtool is choking. I get all kinds of errors like: ./libtool: line 1116: X-Wall: command not found ./libtool: line 1116: X-g: command not found ./libtool: line 1116: X-fexceptions: command not found ./libtool: line 1116: X-g: command not found ./libtool: line 1116: X-O2: command not found ./libtool: line 1116: X-MT: command not found ./libtool: line 1116: Xsrc/debug.lo: No such file or directory ./libtool: line 1116: X-MD: command not found ./libtool: line 1116: X-MP: command not found ./libtool: line 1116: X-MF: command not found ./libtool: line 1116: Xsrc/.deps/debug.Tpo: No such file or directory ./libtool: line 1116: X-c: command not found ./libtool: line 1167: Xsrc/debug.lo: No such file or directory ./libtool: line 1172: libtool: compile: cannot determine name of library object from `': command not found I don't know why everything is preceded by an X. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 17:19 ` NightStrike @ 2009-06-16 17:37 ` Andrew Haley 2009-06-16 17:38 ` NightStrike 2009-06-16 17:57 ` Ralf Wildenhues 1 sibling, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-16 17:37 UTC (permalink / raw) To: NightStrike Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches NightStrike wrote: > On Tue, Jun 16, 2009 at 12:31 PM, Andrew Haley<aph@redhat.com> wrote: >> NightStrike wrote: >>> On Fri, Jun 12, 2009 at 11:44 AM, Andrew Haley<aph@redhat.com> wrote: >>>> Hmm. I guess under the circumstances that's the right thing to do, >>>> but it's pretty evil in a test case that's suppose to test long long. >>>> Is the Windows library going to get fixed to accept %lld in the >>>> forseeable future? If so, we could just xfail it until then. >>> Andrew, >>> >>> Are all of Tim's patches now committed to gcc? I ask because I get >>> this trying to using the libffi in the gcc repo: >>> >>> configure: error: "libffi has not been ported to x86_64-w64-mingw32." >> OK, fixed. > > Now libtool is choking. I get all kinds of errors like: > > ./libtool: line 1116: X-Wall: command not found > ./libtool: line 1116: X-g: command not found > ./libtool: line 1116: X-fexceptions: command not found > ./libtool: line 1116: X-g: command not found > ./libtool: line 1116: X-O2: command not found > ./libtool: line 1116: X-MT: command not found > ./libtool: line 1116: Xsrc/debug.lo: No such file or directory > ./libtool: line 1116: X-MD: command not found > ./libtool: line 1116: X-MP: command not found > ./libtool: line 1116: X-MF: command not found > ./libtool: line 1116: Xsrc/.deps/debug.Tpo: No such file or directory > ./libtool: line 1116: X-c: command not found > ./libtool: line 1167: Xsrc/debug.lo: No such file or directory > ./libtool: line 1172: libtool: compile: cannot determine name of > library object from `': command not found I never touched it, m'lud. libffi in gcc inherits its libtool stuff from gcc's toplev. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 17:37 ` Andrew Haley @ 2009-06-16 17:38 ` NightStrike 2009-06-16 17:42 ` NightStrike 0 siblings, 1 reply; 91+ messages in thread From: NightStrike @ 2009-06-16 17:38 UTC (permalink / raw) To: Andrew Haley Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches On Tue, Jun 16, 2009 at 1:36 PM, Andrew Haley<aph@redhat.com> wrote: > I never touched it, m'lud. libffi in gcc inherits its libtool stuff > from gcc's toplev. > > Andrew. > Looks like it might be a problem on my end. I'll get back to you. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 17:38 ` NightStrike @ 2009-06-16 17:42 ` NightStrike 0 siblings, 0 replies; 91+ messages in thread From: NightStrike @ 2009-06-16 17:42 UTC (permalink / raw) To: Andrew Haley Cc: Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches On Tue, Jun 16, 2009 at 1:38 PM, NightStrike<nightstrike@gmail.com> wrote: > On Tue, Jun 16, 2009 at 1:36 PM, Andrew Haley<aph@redhat.com> wrote: >> I never touched it, m'lud. libffi in gcc inherits its libtool stuff >> from gcc's toplev. >> >> Andrew. >> > > Looks like it might be a problem on my end. I'll get back to you. > Ok, so I caused that when I modified top level configure to allow building libffi like so: Index: configure.ac =================================================================== --- configure.ac (revision 148542) +++ configure.ac (working copy) -727,7 +727,7 @@ ;; x86_64-*-mingw*) target_configdirs="$target_configdirs target-winsup" - noconfigdirs="$noconfigdirs expect target-libgloss target-newlib ${libgcj}" + noconfigdirs="$noconfigdirs expect target-libgloss target-newlib" ;; *-*-cygwin*) target_configdirs="$target_configdirs target-libtermcap target-winsup" ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 17:19 ` NightStrike 2009-06-16 17:37 ` Andrew Haley @ 2009-06-16 17:57 ` Ralf Wildenhues 2009-06-17 2:24 ` NightStrike 1 sibling, 1 reply; 91+ messages in thread From: Ralf Wildenhues @ 2009-06-16 17:57 UTC (permalink / raw) To: NightStrike Cc: Andrew Haley, Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches * NightStrike wrote on Tue, Jun 16, 2009 at 07:19:27PM CEST: > > Now libtool is choking. I get all kinds of errors like: > > ./libtool: line 1116: X-Wall: command not found This happens when you mix an ltmain.sh script from 1.5.x with macro files (libtool.m4 etc.) from 2.2.x or vice versa. One way, the inconsistency is caught at configure time, the other it should be. Cheers, Ralf ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: PATCH libffi win64 support 2009-06-16 17:57 ` Ralf Wildenhues @ 2009-06-17 2:24 ` NightStrike 0 siblings, 0 replies; 91+ messages in thread From: NightStrike @ 2009-06-17 2:24 UTC (permalink / raw) To: Ralf Wildenhues, NightStrike, Andrew Haley, Timothy Wall, libffi-discuss, Kai Tietz, Kai Tietz, GCC Patches On Tue, Jun 16, 2009 at 1:56 PM, Ralf Wildenhues<Ralf.Wildenhues@gmx.de> wrote: > * NightStrike wrote on Tue, Jun 16, 2009 at 07:19:27PM CEST: >> >> Now libtool is choking. I get all kinds of errors like: >> >> ./libtool: line 1116: X-Wall: command not found > > This happens when you mix an ltmain.sh script from 1.5.x with macro > files (libtool.m4 etc.) from 2.2.x or vice versa. One way, the > inconsistency is caught at configure time, the other it should be. > > Cheers, > Ralf > Using just autoconf instead of autoreconf (Thanks, Ian!) worked. libffi now compiles (and does so perfectly! Wow, Tim! There wasn't a single warning, even!) Now starts the very long, arduous road of getting boehm-gc to do something besides barf all over the make output. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 16:22 ` Tom Tromey 2009-06-08 16:35 ` Andrew Haley @ 2009-06-08 16:48 ` NightStrike 2009-06-08 16:50 ` NightStrike 2009-06-08 18:25 ` Ralf Wildenhues 2 siblings, 1 reply; 91+ messages in thread From: NightStrike @ 2009-06-08 16:48 UTC (permalink / raw) To: tromey Cc: Ralf Wildenhues, Andrew Haley, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List On Mon, Jun 8, 2009 at 12:21 PM, Tom Tromey<tromey@redhat.com> wrote: >>>>>> "Ralf" == Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes: > > Ralf> Would standalone libffi be willing to accept into its tree > Ralf> configury parts that are only active in the GCC tree? > > If this is possible, why have a separate libffi repository at all? > You could just tell developers to: > > svn co svn://gcc.gnu.org/svn/gcc/trunk/libffi > > Tom > This would be ideal. This whole "keep the same stuff in multiple places and hope they're in synch" situation is terrible. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 16:48 ` libffi merge NightStrike @ 2009-06-08 16:50 ` NightStrike 0 siblings, 0 replies; 91+ messages in thread From: NightStrike @ 2009-06-08 16:50 UTC (permalink / raw) To: tromey Cc: Ralf Wildenhues, Andrew Haley, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List On Mon, Jun 8, 2009 at 12:48 PM, NightStrike<nightstrike@gmail.com> wrote: > On Mon, Jun 8, 2009 at 12:21 PM, Tom Tromey<tromey@redhat.com> wrote: >>>>>>> "Ralf" == Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes: >> >> Ralf> Would standalone libffi be willing to accept into its tree >> Ralf> configury parts that are only active in the GCC tree? >> >> If this is possible, why have a separate libffi repository at all? >> You could just tell developers to: >> >> svn co svn://gcc.gnu.org/svn/gcc/trunk/libffi >> >> Tom >> > > This would be ideal. This whole "keep the same stuff in multiple > places and hope they're in synch" situation is terrible. > Also, I'm kind of sure that you can use svn externals to just link the libffi directory in gcc's repo to the libffi repository. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 16:22 ` Tom Tromey 2009-06-08 16:35 ` Andrew Haley 2009-06-08 16:48 ` libffi merge NightStrike @ 2009-06-08 18:25 ` Ralf Wildenhues 2009-06-08 18:33 ` Andrew Haley 2 siblings, 1 reply; 91+ messages in thread From: Ralf Wildenhues @ 2009-06-08 18:25 UTC (permalink / raw) To: Tom Tromey Cc: Andrew Haley, NightStrike, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Hello Tom, * Tom Tromey wrote on Mon, Jun 08, 2009 at 06:21:44PM CEST: > >>>>> "Ralf" == Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes: > > Ralf> Would standalone libffi be willing to accept into its tree > Ralf> configury parts that are only active in the GCC tree? > > If this is possible, why have a separate libffi repository at all? > You could just tell developers to: > > svn co svn://gcc.gnu.org/svn/gcc/trunk/libffi Sorry to have given the impression, but what I meant was that I think it is possible to have almost zero differences in configure.ac and Makefile.am files; the trees however also store generated files. For one, I wouldn't know to eliminate the ACLOCAL_AMFLAGS setting used in gcc/libffi/Makefile.am, leading to differences in the aclocal.m4 file. And the AM_ENABLE_MULTILIB in configure.ac can easily be made conditional at the m4 level (i.e., at autoconf run time), but probably leaves at least some traces if only done at configure run time. Cheers, Ralf ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 18:25 ` Ralf Wildenhues @ 2009-06-08 18:33 ` Andrew Haley 0 siblings, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-08 18:33 UTC (permalink / raw) To: Ralf Wildenhues, Tom Tromey, Andrew Haley, NightStrike, Andreas Tobler, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Ralf Wildenhues wrote: > Hello Tom, > > * Tom Tromey wrote on Mon, Jun 08, 2009 at 06:21:44PM CEST: >>>>>>> "Ralf" == Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes: >> Ralf> Would standalone libffi be willing to accept into its tree >> Ralf> configury parts that are only active in the GCC tree? >> >> If this is possible, why have a separate libffi repository at all? >> You could just tell developers to: >> >> svn co svn://gcc.gnu.org/svn/gcc/trunk/libffi > > Sorry to have given the impression, but what I meant was that I think > it is possible to have almost zero differences in configure.ac and > Makefile.am files; the trees however also store generated files. > > For one, I wouldn't know to eliminate the ACLOCAL_AMFLAGS setting used > in gcc/libffi/Makefile.am, leading to differences in the aclocal.m4 > file. And the AM_ENABLE_MULTILIB in configure.ac can easily be made > conditional at the m4 level (i.e., at autoconf run time), but probably > leaves at least some traces if only done at configure run time. Yeah, and I don't think we need to. A few small differences like this IMO don't hurt at all. Once everything is in sync, keeping it in sync is easy. The problem has been that there has been a fair bit of divergence that looks to me like it was intended. But never mind that, we're nearly there now. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 13:40 ` Andrew Haley 2009-06-05 17:24 ` Andreas Tobler @ 2009-06-08 17:03 ` Andrew Haley 2009-06-09 10:34 ` H.J. Lu 2009-06-08 17:16 ` Andrew Haley 2009-06-09 10:16 ` Andrew Haley 3 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-08 17:03 UTC (permalink / raw) Cc: libffi-discuss, gcc-patches Testsuite, libffi -> gcc, try again. 2009-06-08 Andrew Haley <aph@redhat.com> * testsuite/libffi.call/err_bad_abi.c: Add xfails. * testsuite/libffi.call/cls_longdouble_va.c: Add xfails. * testsuite/libffi.call/cls_dbls_struct.c: Add xfail x86_64-*-linux-*. * testsuite/libffi.call/err_bad_typedef.c: Add xfails. * testsuite/libffi.call/stret_medium2.c: Add __UNUSED__ to args. * testsuite/libffi.call/stret_medium.c: Likewise. * testsuite/libffi.call/stret_large2.c: Likewise. * testsuite/libffi.call/stret_large.c: Likewise. 2008-12-26 Timothy Wall <twall@users.sf.net> * testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_align_longdouble.c, testsuite/libffi.call/cls_align_longdouble_split.c, testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected failures on x86_64 cygwin/mingw. 2008-12-22 Timothy Wall <twall@users.sf.net> * testsuite/libffi.call/closure_fn0.c, testsuite/libffi.call/closure_fn1.c, testsuite/libffi.call/closure_fn2.c, testsuite/libffi.call/closure_fn3.c, testsuite/libffi.call/closure_fn4.c, testsuite/libffi.call/closure_fn5.c, testsuite/libffi.call/closure_fn6.c, testsuite/libffi.call/closure_loc_fn0.c, testsuite/libffi.call/closure_stdcall.c, testsuite/libffi.call/cls_align_pointer.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c: use portable cast from pointer to integer (intptr_t). * testsuite/libffi.call/cls_longdouble.c: disable for win64. 2008-07-24 Anthony Green <green@redhat.com> * testsuite/libffi.call/cls_dbls_struct.c, testsuite/libffi.call/cls_double_va.c, testsuite/libffi.call/cls_longdouble.c, testsuite/libffi.call/cls_longdouble_va.c, testsuite/libffi.call/cls_pointer.c, testsuite/libffi.call/cls_pointer_stack.c, testsuite/libffi.call/err_bad_abi.c: Clean up failures from compiler warnings. 2008-03-04 Anthony Green <green@redhat.com> Blake Chaffin hos@tamanegi.org * testsuite/libffi.call/cls_align_longdouble_split2.c testsuite/libffi.call/cls_align_longdouble_split.c testsuite/libffi.call/cls_dbls_struct.c testsuite/libffi.call/cls_double_va.c testsuite/libffi.call/cls_longdouble.c testsuite/libffi.call/cls_longdouble_va.c testsuite/libffi.call/cls_pointer.c testsuite/libffi.call/cls_pointer_stack.c testsuite/libffi.call/err_bad_abi.c testsuite/libffi.call/err_bad_typedef.c testsuite/libffi.call/stret_large2.c testsuite/libffi.call/stret_large.c testsuite/libffi.call/stret_medium2.c testsuite/libffi.call/stret_medium.c: New tests from Apple. Index: testsuite/libffi.call/stret_medium.c =================================================================== --- testsuite/libffi.call/stret_medium.c (revision 0) +++ testsuite/libffi.call/stret_medium.c (revision 0) @@ -0,0 +1,132 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +typedef struct struct_72byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + double i; +} struct_72byte; + +struct_72byte cls_struct_72byte_fn( + struct_72byte b0, + struct_72byte b1, + struct_72byte b2, + struct_72byte b3) +{ + struct_72byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + + printf("%g %g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i); + + return result; +} + +static void +cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) +{ + struct_72byte b0, b1, b2, b3; + + b0 = *(struct_72byte*)(args[0]); + b1 = *(struct_72byte*)(args[1]); + b2 = *(struct_72byte*)(args[2]); + b3 = *(struct_72byte*)(args[3]); + + *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[5]; + ffi_type* cls_struct_fields[10]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 }; + struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 }; + struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 }; + struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 }; + struct_72byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_double; + cls_struct_fields[9] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK); + + res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, + struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + exit(0); +} Index: testsuite/libffi.call/cls_align_longdouble_split2.c =================================================================== --- testsuite/libffi.call/cls_align_longdouble_split2.c (revision 0) +++ testsuite/libffi.call/cls_align_longdouble_split2.c (revision 0) @@ -0,0 +1,120 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of long double. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/18/2007 +*/ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ + +#include "ffitest.h" + +typedef struct cls_struct_align { + long double a; + long double b; + long double c; + long double d; + long double e; + double f; + long double g; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn( + cls_struct_align a1, + cls_struct_align a2) +{ + struct cls_struct_align r; + + r.a = a1.a + a2.a; + r.b = a1.b + a2.b; + r.c = a1.c + a2.c; + r.d = a1.d + a2.d; + r.e = a1.e + a2.e; + r.f = a1.f + a2.f; + r.g = a1.g + a2.g; + + printf("%Lg %Lg %Lg %Lg %Lg %g %Lg %Lg %Lg %Lg %Lg %Lg %g %Lg: " + "%Lg %Lg %Lg %Lg %Lg %g %Lg\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, + r.a, r.b, r.c, r.d, r.e, r.f, r.g); + + return r; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[3]; + ffi_type* cls_struct_fields[8]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_longdouble; + cls_struct_fields[1] = &ffi_type_longdouble; + cls_struct_fields[2] = &ffi_type_longdouble; + cls_struct_fields[3] = &ffi_type_longdouble; + cls_struct_fields[4] = &ffi_type_longdouble; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_longdouble; + cls_struct_fields[7] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + exit(0); +} Index: testsuite/libffi.call/err_bad_abi.c =================================================================== --- testsuite/libffi.call/err_bad_abi.c (revision 0) +++ testsuite/libffi.call/err_bad_abi.c (revision 0) @@ -0,0 +1,45 @@ +/* Area: ffi_prep_cif, ffi_prep_closure + Purpose: Test error return for bad ABIs. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* i*86-*-linux-* x86_64-*-linux-* } } */ +#include "ffitest.h" + +static void +dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, + void** args __UNUSED__, void* userdata __UNUSED__) +{} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args[1]; + ffi_type* arg_types[1]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + arg_types[0] = NULL; + args[0] = NULL; + + CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, + arg_types) == FFI_BAD_ABI); + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, + arg_types) == FFI_OK); + + cif.abi= 255; + + CHECK(ffi_prep_closure(pcl, &cif, dummy_fn, NULL) == FFI_BAD_ABI); + + exit(0); +} Index: testsuite/libffi.call/cls_pointer.c =================================================================== --- testsuite/libffi.call/cls_pointer.c (revision 0) +++ testsuite/libffi.call/cls_pointer.c (revision 0) @@ -0,0 +1,82 @@ +/* Area: ffi_call, closure_call + Purpose: Check pointer arguments. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +void* cls_pointer_fn(void* a1, void* a2) +{ + void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + + printf("0x%08x 0x%08x: 0x%08x\n", + (unsigned int)(uintptr_t) a1, + (unsigned int)(uintptr_t) a2, + (unsigned int)(uintptr_t) result); + + return result; +} + +static void +cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + void* a1 = *(void**)(args[0]); + void* a2 = *(void**)(args[1]); + + *(void**)resp = cls_pointer_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure* pcl; + void* args[3]; +// ffi_type cls_pointer_type; + ffi_type* arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + +/* cls_pointer_type.size = sizeof(void*); + cls_pointer_type.alignment = 0; + cls_pointer_type.type = FFI_TYPE_POINTER; + cls_pointer_type.elements = NULL;*/ + + void* arg1 = (void*)0x12345678; + void* arg2 = (void*)0x89abcdef; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_pointer; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, + arg_types) == FFI_OK); + + args[0] = &arg1; + args[1] = &arg2; + args[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_pointer_fn), &res, args); + /* { dg-output "0x12345678 0x89abcdef: 0x9be02467" } */ + printf("res: 0x%08x\n", (unsigned int) res); + /* { dg-output "\nres: 0x9be02467" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK); + + res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2); + /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ + printf("res: 0x%08x\n", (unsigned int) res); + /* { dg-output "\nres: 0x9be02467" } */ + + exit(0); +} Index: testsuite/libffi.call/stret_large.c =================================================================== --- testsuite/libffi.call/stret_large.c (revision 0) +++ testsuite/libffi.call/stret_large.c (revision 0) @@ -0,0 +1,153 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +// 13 FPRs: 104 bytes +// 14 FPRs: 112 bytes + +typedef struct struct_108byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + double i; + double j; + double k; + double l; + double m; + int n; +} struct_108byte; + +struct_108byte cls_struct_108byte_fn( + struct_108byte b0, + struct_108byte b1, + struct_108byte b2, + struct_108byte b3) +{ + struct_108byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + result.j = b0.j + b1.j + b2.j + b3.j; + result.k = b0.k + b1.k + b2.k + b3.k; + result.l = b0.l + b1.l + b2.l + b3.l; + result.m = b0.m + b1.m + b2.m + b3.m; + result.n = b0.n + b1.n + b2.n + b3.n; + + printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i, + result.j, result.k, result.l, result.m, result.n); + + return result; +} + +static void +cls_struct_108byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) +{ + struct_108byte b0, b1, b2, b3; + + b0 = *(struct_108byte*)(args[0]); + b1 = *(struct_108byte*)(args[1]); + b2 = *(struct_108byte*)(args[2]); + b3 = *(struct_108byte*)(args[3]); + + *(struct_108byte*)resp = cls_struct_108byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[5]; + ffi_type* cls_struct_fields[15]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 }; + struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 }; + struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 }; + struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 }; + struct_108byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_double; + cls_struct_fields[9] = &ffi_type_double; + cls_struct_fields[10] = &ffi_type_double; + cls_struct_fields[11] = &ffi_type_double; + cls_struct_fields[12] = &ffi_type_double; + cls_struct_fields[13] = &ffi_type_sint32; + cls_struct_fields[14] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_108byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_108byte_gn, NULL) == FFI_OK); + + res_dbl = ((struct_108byte(*)(struct_108byte, struct_108byte, + struct_108byte, struct_108byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + + exit(0); +} Index: testsuite/libffi.call/err_bad_typedef.c =================================================================== --- testsuite/libffi.call/err_bad_typedef.c (revision 0) +++ testsuite/libffi.call/err_bad_typedef.c (revision 0) @@ -0,0 +1,35 @@ +/* Area: ffi_prep_cif + Purpose: Test error return for bad typedefs. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* i*86-*-linux-* x86_64-*-linux-* } } */ +#include "ffitest.h" + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + ffi_type* arg_types[1]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + arg_types[0] = NULL; + + ffi_type badType = ffi_type_void; + + badType.size = 0; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType, + arg_types) == FFI_BAD_TYPEDEF); + + exit(0); +} Index: testsuite/libffi.call/cls_align_longdouble_split.c =================================================================== --- testsuite/libffi.call/cls_align_longdouble_split.c (revision 0) +++ testsuite/libffi.call/cls_align_longdouble_split.c (revision 0) @@ -0,0 +1,140 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of long double. + Limitations: none. + PR: none. + Originator: <hos@tamanegi.org> 20031203 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ + +#include "ffitest.h" + +typedef struct cls_struct_align { + long double a; + long double b; + long double c; + long double d; + long double e; + long double f; + long double g; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn( + cls_struct_align a1, + cls_struct_align a2) +{ + struct cls_struct_align r; + + r.a = a1.a + a2.a; + r.b = a1.b + a2.b; + r.c = a1.c + a2.c; + r.d = a1.d + a2.d; + r.e = a1.e + a2.e; + r.f = a1.f + a2.f; + r.g = a1.g + a2.g; + + printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: " + "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, + r.a, r.b, r.c, r.d, r.e, r.f, r.g); + + return r; +} + +cls_struct_align cls_struct_align_fn2( + cls_struct_align a1) +{ + struct cls_struct_align r; + + r.a = a1.a + 1; + r.b = a1.b + 1; + r.c = a1.c + 1; + r.d = a1.d + 1; + r.e = a1.e + 1; + r.f = a1.f + 1; + r.g = a1.g + 1; + + printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg: " + "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + r.a, r.b, r.c, r.d, r.e, r.f, r.g); + + return r; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[3]; + ffi_type* cls_struct_fields[8]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_longdouble; + cls_struct_fields[1] = &ffi_type_longdouble; + cls_struct_fields[2] = &ffi_type_longdouble; + cls_struct_fields[3] = &ffi_type_longdouble; + cls_struct_fields[4] = &ffi_type_longdouble; + cls_struct_fields[5] = &ffi_type_longdouble; + cls_struct_fields[6] = &ffi_type_longdouble; + cls_struct_fields[7] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); + /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + exit(0); +} Index: testsuite/libffi.call/closure_fn1.c =================================================================== --- testsuite/libffi.call/closure_fn1.c (revision 148170) +++ testsuite/libffi.call/closure_fn1.c (working copy) @@ -21,7 +21,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)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)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]), @@ -32,7 +32,7 @@ (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); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type1)(float, float, float, float, signed short, Index: testsuite/libffi.call/closure_fn3.c =================================================================== --- testsuite/libffi.call/closure_fn3.c (revision 148170) +++ testsuite/libffi.call/closure_fn3.c (working copy) @@ -20,7 +20,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)(*(float *)args[14]) + *(int *)args[15] + (intptr_t)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]), @@ -30,7 +30,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)(*(float *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: testsuite/libffi.call/closure_fn5.c =================================================================== --- testsuite/libffi.call/closure_fn5.c (revision 148170) +++ testsuite/libffi.call/closure_fn5.c (working copy) @@ -24,7 +24,7 @@ (int)*(unsigned long long *)args[12] + (int)*(unsigned long long *)args[13] + (int)*(unsigned long long *)args[14] + - *(int *)args[15] + (int)(long)userdata; + *(int *)args[15] + (intptr_t)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], @@ -43,7 +43,7 @@ (int)*(unsigned long long *)args[13], (int)*(unsigned long long *)args[14], *(int *)args[15], - (int)(long)userdata, (int)*(ffi_arg *)resp); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: testsuite/libffi.call/cls_longdouble.c =================================================================== --- testsuite/libffi.call/cls_longdouble.c (revision 0) +++ testsuite/libffi.call/cls_longdouble.c (revision 0) @@ -0,0 +1,111 @@ +/* Area: ffi_call, closure_call + Purpose: Check long double arguments. + Limitations: none. + PR: none. + Originator: Blake Chaffin */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ + +#include "ffitest.h" + +long double cls_ldouble_fn( + long double a1, + long double a2, + long double a3, + long double a4, + long double a5, + long double a6, + long double a7, + long double a8) +{ + long double r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8; + + printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: %Lg\n", + a1, a2, a3, a4, a5, a6, a7, a8, r); + + return r; +} + +static void +cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + long double a1 = *(long double*)args[0]; + long double a2 = *(long double*)args[1]; + long double a3 = *(long double*)args[2]; + long double a4 = *(long double*)args[3]; + long double a5 = *(long double*)args[4]; + long double a6 = *(long double*)args[5]; + long double a7 = *(long double*)args[6]; + long double a8 = *(long double*)args[7]; + + *(long double*)resp = cls_ldouble_fn( + a1, a2, a3, a4, a5, a6, a7, a8); +} + +int main(void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure* pcl; + void* args[9]; + ffi_type* arg_types[9]; + long double res = 0; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + long double arg1 = 1; + long double arg2 = 2; + long double arg3 = 3; + long double arg4 = 4; + long double arg5 = 5; + long double arg6 = 6; + long double arg7 = 7; + long double arg8 = 8; + + arg_types[0] = &ffi_type_longdouble; + arg_types[1] = &ffi_type_longdouble; + arg_types[2] = &ffi_type_longdouble; + arg_types[3] = &ffi_type_longdouble; + arg_types[4] = &ffi_type_longdouble; + arg_types[5] = &ffi_type_longdouble; + arg_types[6] = &ffi_type_longdouble; + arg_types[7] = &ffi_type_longdouble; + arg_types[8] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 8, &ffi_type_longdouble, + arg_types) == FFI_OK); + + args[0] = &arg1; + args[1] = &arg2; + args[2] = &arg3; + args[3] = &arg4; + args[4] = &arg5; + args[5] = &arg6; + args[6] = &arg7; + args[7] = &arg8; + args[8] = NULL; + + ffi_call(&cif, FFI_FN(cls_ldouble_fn), &res, args); + /* { dg-output "1 2 3 4 5 6 7 8: 36" } */ + printf("res: %Lg\n", res); + /* { dg-output "\nres: 36" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_ldouble_gn, NULL) == FFI_OK); + + res = ((long double(*)(long double, long double, long double, long double, + long double, long double, long double, long double))(pcl))(arg1, arg2, + arg3, arg4, arg5, arg6, arg7, arg8); + /* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */ + printf("res: %Lg\n", res); + /* { dg-output "\nres: 36" } */ + + return 0; +} Index: testsuite/libffi.call/cls_double_va.c =================================================================== --- testsuite/libffi.call/cls_double_va.c (revision 0) +++ testsuite/libffi.call/cls_double_va.c (revision 0) @@ -0,0 +1,64 @@ +/* Area: ffi_call, closure_call + Purpose: Test doubles passed in variable argument lists. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +static void +cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + char* format = *(char**)args[0]; + double doubleValue = *(double*)args[1]; + + *(ffi_arg*)resp = printf(format, doubleValue); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args[3]; + ffi_type* arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + char* format = "%.1f\n"; + double doubleArg = 7; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_double; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + arg_types) == FFI_OK); + + args[0] = &format; + args[1] = &doubleArg; + args[2] = NULL; + + ffi_call(&cif, FFI_FN(printf), &res, args); + // { dg-output "7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + CHECK(ffi_prep_closure(pcl, &cif, cls_double_va_fn, NULL) == FFI_OK); + + res = ((int(*)(char*, double))(pcl))(format, doubleArg); + // { dg-output "\n7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + exit(0); +} Index: testsuite/libffi.call/cls_pointer_stack.c =================================================================== --- testsuite/libffi.call/cls_pointer_stack.c (revision 0) +++ testsuite/libffi.call/cls_pointer_stack.c (revision 0) @@ -0,0 +1,148 @@ +/* Area: ffi_call, closure_call + Purpose: Check pointer arguments across multiple hideous stack frames. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/7/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +static long dummyVar; + +long dummy_func( + long double a1, char b1, + long double a2, char b2, + long double a3, char b3, + long double a4, char b4) +{ + return a1 + b1 + a2 + b2 + a3 + b3 + a4 + b4; +} + +void* cls_pointer_fn2(void* a1, void* a2) +{ + long double trample1 = (intptr_t)a1 + (intptr_t)a2; + char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; + long double trample3 = (intptr_t)trample1 + (intptr_t)a1; + char trample4 = trample2 + ((char*)&a1)[1]; + long double trample5 = (intptr_t)trample3 + (intptr_t)a2; + char trample6 = trample4 + ((char*)&a2)[1]; + long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; + char trample8 = trample6 + trample2; + + dummyVar = dummy_func(trample1, trample2, trample3, trample4, + trample5, trample6, trample7, trample8); + + void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + + printf("0x%08x 0x%08x: 0x%08x\n", + (unsigned int)(uintptr_t) a1, + (unsigned int)(uintptr_t) a2, + (unsigned int)(uintptr_t) result); + + return result; +} + +void* cls_pointer_fn1(void* a1, void* a2) +{ + long double trample1 = (intptr_t)a1 + (intptr_t)a2; + char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; + long double trample3 = (intptr_t)trample1 + (intptr_t)a1; + char trample4 = trample2 + ((char*)&a1)[1]; + long double trample5 = (intptr_t)trample3 + (intptr_t)a2; + char trample6 = trample4 + ((char*)&a2)[1]; + long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; + char trample8 = trample6 + trample2; + + dummyVar = dummy_func(trample1, trample2, trample3, trample4, + trample5, trample6, trample7, trample8); + + void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + + printf("0x%08x 0x%08x: 0x%08x\n", + (unsigned int)(intptr_t) a1, + (unsigned int)(intptr_t) a2, + (unsigned int)(intptr_t) result); + + result = cls_pointer_fn2(result, a1); + + return result; +} + +static void +cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + void* a1 = *(void**)(args[0]); + void* a2 = *(void**)(args[1]); + + long double trample1 = (intptr_t)a1 + (intptr_t)a2; + char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; + long double trample3 = (intptr_t)trample1 + (intptr_t)a1; + char trample4 = trample2 + ((char*)&a1)[1]; + long double trample5 = (intptr_t)trample3 + (intptr_t)a2; + char trample6 = trample4 + ((char*)&a2)[1]; + long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; + char trample8 = trample6 + trample2; + + dummyVar = dummy_func(trample1, trample2, trample3, trample4, + trample5, trample6, trample7, trample8); + + *(void**)resp = cls_pointer_fn1(a1, a2); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure* pcl; + void* args[3]; +// ffi_type cls_pointer_type; + ffi_type* arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + +/* cls_pointer_type.size = sizeof(void*); + cls_pointer_type.alignment = 0; + cls_pointer_type.type = FFI_TYPE_POINTER; + cls_pointer_type.elements = NULL;*/ + + void* arg1 = (void*)0x01234567; + void* arg2 = (void*)0x89abcdef; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_pointer; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, + arg_types) == FFI_OK); + + args[0] = &arg1; + args[1] = &arg2; + args[2] = NULL; + + printf("\n"); + ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); + + printf("res: 0x%08x\n", (unsigned int) res); + // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } + // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } + // { dg-output "\nres: 0x8bf258bd" } + + CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK); + + res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2); + + printf("res: 0x%08x\n", (unsigned int) res); + // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } + // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } + // { dg-output "\nres: 0x8bf258bd" } + + exit(0); +} Index: testsuite/libffi.call/closure_loc_fn0.c =================================================================== --- testsuite/libffi.call/closure_loc_fn0.c (revision 0) +++ testsuite/libffi.call/closure_loc_fn0.c (revision 0) @@ -0,0 +1,95 @@ +/* Area: closure_call + Purpose: Check multiple values passing from different type. + Also, exceed the limit of gpr and fpr registers on PowerPC + Darwin. + Limitations: none. + PR: none. + Originator: <andreast@gcc.gnu.org> 20030828 */ + + + + +/* { dg-do run } */ +#include "ffitest.h" + +static void +closure_loc_test_fn0(ffi_cif* cif __UNUSED__, 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] + (intptr_t)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)(intptr_t)userdata, (int)*(ffi_arg *)resp); + +} + +typedef int (*closure_loc_test_type0)(unsigned long long, int, unsigned long long, + int, signed short, unsigned long long, int, + int, double, int, int, float, int, int, + int, int); + +int main (void) +{ + ffi_cif cif; + ffi_closure *pcl; + ffi_type * cl_arg_types[17]; + int res; + void *codeloc; + + cl_arg_types[0] = &ffi_type_uint64; + cl_arg_types[1] = &ffi_type_sint; + cl_arg_types[2] = &ffi_type_uint64; + cl_arg_types[3] = &ffi_type_sint; + cl_arg_types[4] = &ffi_type_sshort; + cl_arg_types[5] = &ffi_type_uint64; + cl_arg_types[6] = &ffi_type_sint; + cl_arg_types[7] = &ffi_type_sint; + cl_arg_types[8] = &ffi_type_double; + cl_arg_types[9] = &ffi_type_sint; + cl_arg_types[10] = &ffi_type_sint; + cl_arg_types[11] = &ffi_type_float; + cl_arg_types[12] = &ffi_type_sint; + cl_arg_types[13] = &ffi_type_sint; + cl_arg_types[14] = &ffi_type_sint; + cl_arg_types[15] = &ffi_type_sint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + pcl = ffi_closure_alloc(sizeof(ffi_closure), &codeloc); + CHECK(pcl != NULL); + CHECK(codeloc != NULL); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0, + (void *) 3 /* userdata */, codeloc) == FFI_OK); + + CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0); + + res = (*((closure_loc_test_type0)codeloc)) + (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, + 19, 21, 1); + /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 680" } */ + exit(0); +} Index: testsuite/libffi.call/cls_dbls_struct.c =================================================================== --- testsuite/libffi.call/cls_dbls_struct.c (revision 0) +++ testsuite/libffi.call/cls_dbls_struct.c (revision 0) @@ -0,0 +1,75 @@ +/* Area: ffi_call, closure_call + Purpose: Check double arguments in structs. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/23/2007 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef struct Dbls { + double x; + double y; +} Dbls; + +void +closure_test_fn(Dbls p) +{ + printf("%.1f %.1f\n", p.x, p.y); +} + +void +closure_test_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, + void** args, void* userdata __UNUSED__) +{ + closure_test_fn(*(Dbls*)args[0]); +} + +int main(int argc __UNUSED__, char** argv __UNUSED__) +{ + ffi_cif cif; + +#ifndef USING_MMAP + static ffi_closure cl; +#endif + + ffi_closure* pcl; + ffi_type* cl_arg_types[1]; + +#ifdef USING_MMAP + pcl = allocate_mmap(sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + ffi_type ts1_type; + ffi_type* ts1_type_elements[4]; + + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + + ts1_type_elements[0] = &ffi_type_double; + ts1_type_elements[1] = &ffi_type_double; + ts1_type_elements[2] = NULL; + + cl_arg_types[0] = &ts1_type; + + Dbls arg = { 1.0, 2.0 }; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_void, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure(pcl, &cif, closure_test_gn, NULL) == FFI_OK); + + ((void*(*)(Dbls))(pcl))(arg); + /* { dg-output "1.0 2.0\n" { xfail x86_64-*-linux-* } } */ + + closure_test_fn(arg); + /* { dg-output "1.0 2.0\n" } */ + + return 0; +} Index: testsuite/libffi.call/stret_large2.c =================================================================== --- testsuite/libffi.call/stret_large2.c (revision 0) +++ testsuite/libffi.call/stret_large2.c (revision 0) @@ -0,0 +1,156 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +// 13 FPRs: 104 bytes +// 14 FPRs: 112 bytes + +typedef struct struct_116byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + double i; + double j; + double k; + double l; + double m; + double n; + int o; +} struct_116byte; + +struct_116byte cls_struct_116byte_fn( + struct_116byte b0, + struct_116byte b1, + struct_116byte b2, + struct_116byte b3) +{ + struct_116byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + result.j = b0.j + b1.j + b2.j + b3.j; + result.k = b0.k + b1.k + b2.k + b3.k; + result.l = b0.l + b1.l + b2.l + b3.l; + result.m = b0.m + b1.m + b2.m + b3.m; + result.n = b0.n + b1.n + b2.n + b3.n; + result.o = b0.o + b1.o + b2.o + b3.o; + + printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i, + result.j, result.k, result.l, result.m, result.n, result.o); + + return result; +} + +static void +cls_struct_116byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) +{ + struct_116byte b0, b1, b2, b3; + + b0 = *(struct_116byte*)(args[0]); + b1 = *(struct_116byte*)(args[1]); + b2 = *(struct_116byte*)(args[2]); + b3 = *(struct_116byte*)(args[3]); + + *(struct_116byte*)resp = cls_struct_116byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[5]; + ffi_type* cls_struct_fields[16]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 }; + struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 }; + struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 }; + struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 }; + struct_116byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_double; + cls_struct_fields[9] = &ffi_type_double; + cls_struct_fields[10] = &ffi_type_double; + cls_struct_fields[11] = &ffi_type_double; + cls_struct_fields[12] = &ffi_type_double; + cls_struct_fields[13] = &ffi_type_double; + cls_struct_fields[14] = &ffi_type_sint32; + cls_struct_fields[15] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_116byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_116byte_gn, NULL) == FFI_OK); + + res_dbl = ((struct_116byte(*)(struct_116byte, struct_116byte, + struct_116byte, struct_116byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + + exit(0); +} Index: testsuite/libffi.call/cls_align_longdouble.c =================================================================== --- testsuite/libffi.call/cls_align_longdouble.c (revision 148170) +++ testsuite/libffi.call/cls_align_longdouble.c (working copy) @@ -4,7 +4,7 @@ PR: none. Originator: <hos@tamanegi.org> 20031203 */ -/* { dg-do run } */ +/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" Index: testsuite/libffi.call/ffitest.h =================================================================== --- testsuite/libffi.call/ffitest.h (revision 148170) +++ testsuite/libffi.call/ffitest.h (working copy) @@ -2,6 +2,8 @@ #include <stdio.h> #include <string.h> #include <fcntl.h> +#include <stdint.h> +#include <inttypes.h> #include <ffi.h> #include "fficonfig.h" Index: testsuite/libffi.call/closure_fn0.c =================================================================== --- testsuite/libffi.call/closure_fn0.c (revision 148170) +++ testsuite/libffi.call/closure_fn0.c (working copy) @@ -25,7 +25,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)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)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]), @@ -37,7 +37,7 @@ (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); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: testsuite/libffi.call/closure_fn2.c =================================================================== --- testsuite/libffi.call/closure_fn2.c (revision 148170) +++ testsuite/libffi.call/closure_fn2.c (working copy) @@ -20,7 +20,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)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)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]), @@ -30,7 +30,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)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: testsuite/libffi.call/cls_longdouble_va.c =================================================================== --- testsuite/libffi.call/cls_longdouble_va.c (revision 0) +++ testsuite/libffi.call/cls_longdouble_va.c (revision 0) @@ -0,0 +1,64 @@ +/* Area: ffi_call, closure_call + Purpose: Test long doubles passed in variable argument lists. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */ +#include "ffitest.h" + +static void +cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + char* format = *(char**)args[0]; + long double ldValue = *(long double*)args[1]; + + *(ffi_arg*)resp = printf(format, ldValue); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args[3]; + ffi_type* arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + char* format = "%L.1f\n"; + long double ldArg = 7; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_longdouble; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + arg_types) == FFI_OK); + + args[0] = &format; + args[1] = &ldArg; + args[2] = NULL; + + ffi_call(&cif, FFI_FN(printf), &res, args); + // { dg-output "7.0" { xfail i*86-*-linux-* x86_64-*-linux-* } } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" { xfail i*86-*-linux-* x86_64-*-linux-* } } + + CHECK(ffi_prep_closure(pcl, &cif, cls_longdouble_va_fn, NULL) == FFI_OK); + + res = ((int(*)(char*, long double))(pcl))(format, ldArg); + // { dg-output "\n7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + exit(0); +} Index: testsuite/libffi.call/closure_stdcall.c =================================================================== --- testsuite/libffi.call/closure_stdcall.c (revision 0) +++ testsuite/libffi.call/closure_stdcall.c (revision 0) @@ -0,0 +1,72 @@ +/* Area: closure_call (stdcall convention) + Purpose: Check handling when caller expects stdcall callee + Limitations: none. + PR: none. + Originator: <twalljava@dev.java.net> */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +#include "ffitest.h" + +static void +closure_test_stdcall(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(int *)args[0] + (int)(*(int *)args[1]) + + (int)(*(int *)args[2]) + (int)(*(int *)args[3]) + + (int)(intptr_t)userdata; + + printf("%d %d %d %d: %d\n", + (int)*(int *)args[0], (int)(*(int *)args[1]), + (int)(*(int *)args[2]), (int)(*(int *)args[3]), + (int)*(ffi_arg *)resp); + +} + +typedef int (__stdcall *closure_test_type0)(int, int, int, int); + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + ffi_type * cl_arg_types[17]; + int res; + void* sp_pre; + void* sp_post; + char buf[1024]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cl_arg_types[0] = &ffi_type_uint; + cl_arg_types[1] = &ffi_type_uint; + cl_arg_types[2] = &ffi_type_uint; + cl_arg_types[3] = &ffi_type_uint; + cl_arg_types[4] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 4, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure(pcl, &cif, closure_test_stdcall, + (void *) 3 /* userdata */) == FFI_OK); + + asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); + res = (*(closure_test_type0)pcl)(0, 1, 2, 3); + asm volatile (" movl %%esp,%0" : "=g" (sp_post)); + /* { dg-output "0 1 2 3: 9" } */ + + printf("res: %d\n",res); + /* { dg-output "\nres: 9" } */ + + sprintf(buf, "mismatch: pre=%p vs post=%p", sp_pre, sp_post); + printf("stack pointer %s\n", (sp_pre == sp_post ? "match" : buf)); + /* { dg-output "\nstack pointer match" } */ + exit(0); +} Index: testsuite/libffi.call/closure_fn4.c =================================================================== --- testsuite/libffi.call/closure_fn4.c (revision 148170) +++ testsuite/libffi.call/closure_fn4.c (working copy) @@ -25,7 +25,7 @@ (int)*(unsigned long long *)args[12] + (int)*(unsigned long long *)args[13] + (int)*(unsigned long long *)args[14] + - *(int *)args[15] + (int)(long)userdata; + *(int *)args[15] + (intptr_t)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], @@ -44,7 +44,7 @@ (int)*(unsigned long long *)args[13], (int)*(unsigned long long *)args[14], *(int *)args[15], - (int)(long)userdata, (int)*(ffi_arg *)resp); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: testsuite/libffi.call/stret_medium2.c =================================================================== --- testsuite/libffi.call/stret_medium2.c (revision 0) +++ testsuite/libffi.call/stret_medium2.c (revision 0) @@ -0,0 +1,132 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +typedef struct struct_72byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + long long i; +} struct_72byte; + +struct_72byte cls_struct_72byte_fn( + struct_72byte b0, + struct_72byte b1, + struct_72byte b2, + struct_72byte b3) +{ + struct_72byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + + printf("%g %g %g %g %g %g %g %g %lld\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i); + + return result; +} + +static void +cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) +{ + struct_72byte b0, b1, b2, b3; + + b0 = *(struct_72byte*)(args[0]); + b1 = *(struct_72byte*)(args[1]); + b2 = *(struct_72byte*)(args[2]); + b3 = *(struct_72byte*)(args[3]); + + *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args_dbl[5]; + ffi_type* cls_struct_fields[10]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 }; + struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 }; + struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 }; + struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 }; + struct_72byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_sint64; + cls_struct_fields[9] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK); + + res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, + struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + exit(0); +} Index: testsuite/libffi.call/closure_fn6.c =================================================================== --- testsuite/libffi.call/closure_fn6.c (revision 148170) +++ testsuite/libffi.call/closure_fn6.c (working copy) @@ -23,7 +23,7 @@ (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(double *)args[14]) + (int)*(double *)args[15] + - (int)(long)userdata; + (intptr_t)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], @@ -36,7 +36,7 @@ (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(double *)args[14]), (int)(*(double *)args[15]), - (int)(long)userdata, (int)*(ffi_arg *)resp); + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } Index: testsuite/libffi.call/cls_align_pointer.c =================================================================== --- testsuite/libffi.call/cls_align_pointer.c (revision 148170) +++ testsuite/libffi.call/cls_align_pointer.c (working copy) @@ -19,11 +19,13 @@ struct cls_struct_align result; result.a = a1.a + a2.a; - result.b = (void *)((unsigned long)a1.b + (unsigned long)a2.b); + result.b = (void *)((uintptr_t)a1.b + (uintptr_t)a2.b); result.c = a1.c + a2.c; - printf("%d %lu %d %d %lu %d: %d %lu %d\n", a1.a, (unsigned long)a1.b, a1.c, - a2.a, (unsigned long)a2.b, a2.c, result.a, (unsigned long)result.b, + printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n", + a1.a, (uintptr_t)a1.b, a1.c, + a2.a, (uintptr_t)a2.b, a2.c, + result.a, (uintptr_t)result.b, result.c); return result; @@ -87,14 +89,14 @@ ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %lu %d\n", res_dbl.a, (unsigned long)res_dbl.b, res_dbl.c); + printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %lu %d\n", res_dbl.a, (unsigned long)res_dbl.b, res_dbl.c); + printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-08 17:03 ` Andrew Haley @ 2009-06-09 10:34 ` H.J. Lu 2009-06-09 10:39 ` Andrew Haley 0 siblings, 1 reply; 91+ messages in thread From: H.J. Lu @ 2009-06-09 10:34 UTC (permalink / raw) To: Andrew Haley; +Cc: libffi-discuss, gcc-patches On Mon, Jun 8, 2009 at 10:02 AM, Andrew Haley<aph@redhat.com> wrote: > Testsuite, libffi -> gcc, try again. > > 2009-06-08 Andrew Haley <aph@redhat.com> > > * testsuite/libffi.call/err_bad_abi.c: Add xfails. > * testsuite/libffi.call/cls_longdouble_va.c: Add xfails. > * testsuite/libffi.call/cls_dbls_struct.c: Add xfail x86_64-*-linux-*. > * testsuite/libffi.call/err_bad_typedef.c: Add xfails. > > * testsuite/libffi.call/stret_medium2.c: Add __UNUSED__ to args. > * testsuite/libffi.call/stret_medium.c: Likewise. > * testsuite/libffi.call/stret_large2.c: Likewise. > * testsuite/libffi.call/stret_large.c: Likewise. > > 2008-12-26 Timothy Wall <twall@users.sf.net> > > * testsuite/libffi.call/cls_longdouble.c, > testsuite/libffi.call/cls_longdouble_va.c, > testsuite/libffi.call/cls_align_longdouble.c, > testsuite/libffi.call/cls_align_longdouble_split.c, > testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected > failures on x86_64 cygwin/mingw. > > 2008-12-22 Timothy Wall <twall@users.sf.net> > > * testsuite/libffi.call/closure_fn0.c, > testsuite/libffi.call/closure_fn1.c, > testsuite/libffi.call/closure_fn2.c, > testsuite/libffi.call/closure_fn3.c, > testsuite/libffi.call/closure_fn4.c, > testsuite/libffi.call/closure_fn5.c, > testsuite/libffi.call/closure_fn6.c, > testsuite/libffi.call/closure_loc_fn0.c, > testsuite/libffi.call/closure_stdcall.c, > testsuite/libffi.call/cls_align_pointer.c, > testsuite/libffi.call/cls_pointer.c, > testsuite/libffi.call/cls_pointer_stack.c: use portable cast from > pointer to integer (intptr_t). > * testsuite/libffi.call/cls_longdouble.c: disable for win64. > > 2008-07-24 Anthony Green <green@redhat.com> > > * testsuite/libffi.call/cls_dbls_struct.c, > testsuite/libffi.call/cls_double_va.c, > testsuite/libffi.call/cls_longdouble.c, > testsuite/libffi.call/cls_longdouble_va.c, > testsuite/libffi.call/cls_pointer.c, > testsuite/libffi.call/cls_pointer_stack.c, > testsuite/libffi.call/err_bad_abi.c: Clean up failures from > compiler warnings. > > 2008-03-04 Anthony Green <green@redhat.com> > Blake Chaffin > hos@tamanegi.org > > * testsuite/libffi.call/cls_align_longdouble_split2.c > testsuite/libffi.call/cls_align_longdouble_split.c > testsuite/libffi.call/cls_dbls_struct.c > testsuite/libffi.call/cls_double_va.c > testsuite/libffi.call/cls_longdouble.c > testsuite/libffi.call/cls_longdouble_va.c > testsuite/libffi.call/cls_pointer.c > testsuite/libffi.call/cls_pointer_stack.c > testsuite/libffi.call/err_bad_abi.c > testsuite/libffi.call/err_bad_typedef.c > testsuite/libffi.call/stret_large2.c > testsuite/libffi.call/stret_large.c > testsuite/libffi.call/stret_medium2.c > testsuite/libffi.call/stret_medium.c: New tests from Apple. I think this caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40385 H.J. -- ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-09 10:34 ` H.J. Lu @ 2009-06-09 10:39 ` Andrew Haley 0 siblings, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-09 10:39 UTC (permalink / raw) To: H.J. Lu; +Cc: libffi-discuss, gcc-patches H.J. Lu wrote: > On Mon, Jun 8, 2009 at 10:02 AM, Andrew Haley<aph@redhat.com> wrote: >> Testsuite, libffi -> gcc, try again. > I think this caused: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40385 We need to either fix the bugs on IA64 or XFAIL the tests. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 13:40 ` Andrew Haley 2009-06-05 17:24 ` Andreas Tobler 2009-06-08 17:03 ` Andrew Haley @ 2009-06-08 17:16 ` Andrew Haley 2009-06-09 10:16 ` Andrew Haley 3 siblings, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-08 17:16 UTC (permalink / raw) Cc: libffi-discuss, gcc-patches README, libffi -> gcc. Andrew. 2009-06-08 Andrew Haley <aph@redhat.com> * README: Import from libffi 3.0.8. Index: README =================================================================== --- README (revision 148170) +++ README (working copy) @@ -4,10 +4,8 @@ Status ====== -libffi-2.00 has not been released yet! This is a development snapshot! - -libffi-1.20 was released on October 5, 1998. Check the libffi web -page for updates: <URL:http://sources.redhat.com/libffi/>. +libffi-3.0.8 was released on December 19, 2008. Check the libffi web +page for updates: <URL:http://sourceware.org/libffi/>. What is libffi? @@ -32,7 +30,7 @@ call any function specified by a call interface description at run time. -Ffi stands for Foreign Function Interface. A foreign function +FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The libffi library really only provides the lowest, machine dependent @@ -41,38 +39,36 @@ between the two languages. -Supported Platforms and Prerequisites -===================================== - -Libffi has been ported to: - - SunOS 4.1.3 & Solaris 2.x (SPARC-V8, SPARC-V9) - - Irix 5.3 & 6.2 (System V/o32 & n32) - - Intel x86 - Linux (System V ABI) - - Alpha - Linux and OSF/1 - - m68k - Linux (System V ABI) - - PowerPC - Linux (System V ABI, Darwin, AIX) +Supported Platforms +=================== - ARM - Linux (System V ABI) - -Libffi has been tested with the egcs 1.0.2 gcc compiler. Chances are -that other versions will work. Libffi has also been built and tested -with the SGI compiler tools. - -On PowerPC, the tests failed (see the note below). - -You must use GNU make to build libffi. SGI's make will not work. -Sun's probably won't either. - -If you port libffi to another platform, please let me know! I assume -that some will be easy (x86 NetBSD), and others will be more difficult -(HP). +Libffi has been ported to many different platforms, although this +release was only tested on: + arm oabi linux + arm eabi linux + hppa linux + mips o32 linux (little endian) + powerpc darwin + powerpc freebsd + powerpc64 linux + sparc solaris + sparc64 freebsd + sparc64 solaris + x86 cygwin + x86 darwin + x86 freebsd + x86 linux + x86 openbsd + x86 solaris + x86-64 darwin + x86-64 linux + x86-64 OS X + x86-64 freebsd + x86-64 solaris + +Please send additional platform test results to +libffi-discuss@sourceware.org. Installing libffi ================= @@ -101,216 +97,17 @@ Configure has many other options. Use "configure --help" to see them all. Once configure has finished, type "make". Note that you must be using -GNU make. SGI's make will not work. Sun's probably won't either. -You can ftp GNU make from prep.ai.mit.edu:/pub/gnu. +GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu. -To ensure that libffi is working as advertised, type "make test". +To ensure that libffi is working as advertised, type "make check". +This will require that you have DejaGNU installed. To install the library and header files, type "make install". -Using libffi -============ - - The Basics - ---------- - -Libffi assumes that you have a pointer to the function you wish to -call and that you know the number and types of arguments to pass it, -as well as the return type of the function. - -The first thing you must do is create an ffi_cif object that matches -the signature of the function you wish to call. The cif in ffi_cif -stands for Call InterFace. To prepare a call interface object, use the -following function: - -ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, - unsigned int nargs, - ffi_type *rtype, ffi_type **atypes); - - CIF is a pointer to the call interface object you wish - to initialize. - - ABI is an enum that specifies the calling convention - to use for the call. FFI_DEFAULT_ABI defaults - to the system's native calling convention. Other - ABI's may be used with care. They are system - specific. - - NARGS is the number of arguments this function accepts. - libffi does not yet support vararg functions. - - RTYPE is a pointer to an ffi_type structure that represents - the return type of the function. Ffi_type objects - describe the types of values. libffi provides - ffi_type objects for many of the native C types: - signed int, unsigned int, signed char, unsigned char, - etc. There is also a pointer ffi_type object and - a void ffi_type. Use &ffi_type_void for functions that - don't return values. - - ATYPES is a vector of ffi_type pointers. ARGS must be NARGS long. - If NARGS is 0, this is ignored. - - -ffi_prep_cif will return a status code that you are responsible -for checking. It will be one of the following: - - FFI_OK - All is good. - - FFI_BAD_TYPEDEF - One of the ffi_type objects that ffi_prep_cif - came across is bad. - - -Before making the call, the VALUES vector should be initialized -with pointers to the appropriate argument values. - -To call the the function using the initialized ffi_cif, use the -ffi_call function: - -void ffi_call(ffi_cif *cif, void *fn, void *rvalue, void **avalues); - - CIF is a pointer to the ffi_cif initialized specifically - for this function. - - FN is a pointer to the function you want to call. - - RVALUE is a pointer to a chunk of memory that is to hold the - result of the function call. Currently, it must be - at least one word in size (except for the n32 version - under Irix 6.x, which must be a pointer to an 8 byte - aligned value (a long long). It must also be at least - word aligned (depending on the return type, and the - system's alignment requirements). If RTYPE is - &ffi_type_void, this is ignored. If RVALUE is NULL, - the return value is discarded. - - AVALUES is a vector of void* that point to the memory locations - holding the argument values for a call. - If NARGS is 0, this is ignored. - - -If you are expecting a return value from FN it will have been stored -at RVALUE. - - - - An Example - ---------- - -Here is a trivial example that calls puts() a few times. - - #include <stdio.h> - #include <ffi.h> - - int main() - { - ffi_cif cif; - ffi_type *args[1]; - void *values[1]; - char *s; - int rc; - - /* Initialize the argument info vectors */ - args[0] = &ffi_type_pointer; - values[0] = &s; - - /* Initialize the cif */ - if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_uint, args) == FFI_OK) - { - s = "Hello World!"; - ffi_call(&cif, puts, &rc, values); - /* rc now holds the result of the call to puts */ - - /* values holds a pointer to the function's arg, so to - call puts() again all we need to do is change the - value of s */ - s = "This is cool!"; - ffi_call(&cif, puts, &rc, values); - } - - return 0; - } - - - - Aggregate Types - --------------- - -Although libffi has no special support for unions or bit-fields, it is -perfectly happy passing structures back and forth. You must first -describe the structure to libffi by creating a new ffi_type object -for it. Here is the definition of ffi_type: - - typedef struct _ffi_type - { - unsigned size; - short alignment; - short type; - struct _ffi_type **elements; - } ffi_type; - -All structures must have type set to FFI_TYPE_STRUCT. You may set -size and alignment to 0. These will be calculated and reset to the -appropriate values by ffi_prep_cif(). - -elements is a NULL terminated array of pointers to ffi_type objects -that describe the type of the structure elements. These may, in turn, -be structure elements. - -The following example initializes a ffi_type object representing the -tm struct from Linux's time.h: - - struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; - /* Those are for future use. */ - long int __tm_gmtoff__; - __const char *__tm_zone__; - }; - - { - ffi_type tm_type; - ffi_type *tm_type_elements[12]; - int i; - - tm_type.size = tm_type.alignment = 0; - tm_type.elements = &tm_type_elements; - - for (i = 0; i < 9; i++) - tm_type_elements[i] = &ffi_type_sint; - - tm_type_elements[9] = &ffi_type_slong; - tm_type_elements[10] = &ffi_type_pointer; - tm_type_elements[11] = NULL; - - /* tm_type can now be used to represent tm argument types and - return types for ffi_prep_cif() */ - } - - - Platform Specific Notes ======================= - Intel x86 - --------- - -There are no known problems with the x86 port. - - Sun SPARC - SunOS 4.1.3 & Solaris 2.x - ------------------------------------- - -You must use GNU Make to build libffi on Sun platforms. - MIPS - Irix 5.3 & 6.x --------------------- @@ -339,13 +136,6 @@ You must use GNU Make to build libffi on SGI platforms. - ARM - System V ABI - ------------------ - -The ARM port was performed on a NetWinder running ARM Linux ELF -(2.0.31) and gcc 2.8.1. - - PowerPC System V ABI -------------------- @@ -375,6 +165,42 @@ History ======= +3.0.7 Nov-11-08 + Fix for ppc FreeBSD. + (thanks to Andreas Tobler) + +3.0.6 Jul-17-08 + Fix for closures on sh. + Mark the sh/sh64 stack as non-executable. + (both thanks to Kaz Kojima) + +3.0.5 Apr-3-08 + Fix libffi.pc file. + Fix #define ARM for IcedTea users. + Fix x86 closure bug. + +3.0.4 Feb-24-08 + Fix x86 OpenBSD configury. + +3.0.3 Feb-22-08 + Enable x86 OpenBSD thanks to Thomas Heller, and + x86-64 FreeBSD thanks to Björn König and Andreas Tobler. + Clean up test instruction in README. + +3.0.2 Feb-21-08 + Improved x86 FreeBSD support. + Thanks to Björn König. + +3.0.1 Feb-15-08 + Fix instruction cache flushing bug on MIPS. + Thanks to David Daney. + +3.0.0 Feb-15-08 + Many changes, mostly thanks to the GCC project. + Cygnus Solutions is now Red Hat. + + [10 years go by...] + 1.20 Oct-5-98 Raffaele Sena produces ARM port. @@ -458,34 +284,56 @@ Authors & Credits ================= -libffi was written by Anthony Green <green@cygnus.com>. +libffi was originally written by Anthony Green <green@redhat.com>. + +The developers of the GNU Compiler Collection project have made +innumerable valuable contributions. See the ChangeLog file for +details. -Portions of libffi were derived from Gianni Mariani's free gencall -library for Silicon Graphics machines. +Some of the ideas behind libffi were inspired by Gianni Mariani's free +gencall library for Silicon Graphics machines. The closure mechanism was designed and implemented by Kresten Krab Thorup. -The Sparc port was derived from code contributed by the fine folks at -Visible Decisions Inc <http://www.vdi.com>. Further enhancements were -made by Gordon Irlam at Cygnus Solutions <http://www.cygnus.com>. - -The Alpha port was written by Richard Henderson at Cygnus Solutions. - -Andreas Schwab ported libffi to m68k Linux and provided a number of -bug fixes. +Major processor architecture ports were contributed by the following +developers: -Geoffrey Keating ported libffi to the PowerPC. - -Raffaele Sena ported libffi to the ARM. +alpha Richard Henderson +arm Raffaele Sena +cris Simon Posnjak, Hans-Peter Nilsson +frv Anthony Green +ia64 Hans Boehm +m32r Kazuhiro Inaoka +m68k Andreas Schwab +mips Anthony Green, Casey Marshall +mips64 David Daney +pa Randolph Chung, Dave Anglin, Andreas Tobler +powerpc Geoffrey Keating, Andreas Tobler, + David Edelsohn, John Hornkvist +powerpc64 Jakub Jelinek +s390 Gerhard Tonn, Ulrich Weigand +sh Kaz Kojima +sh64 Kaz Kojima +sparc Anthony Green, Gordon Irlam +x86 Anthony Green, Jon Beniston +x86-64 Bo Thorsen Jesper Skov and Andrew Haley both did more than their fair share of stepping through the code and tracking down bugs. -Thanks also to Tom Tromey for bug fixes and configuration help. +Thanks also to Tom Tromey for bug fixes, documentation and +configuration help. Thanks to Jim Blandy, who provided some useful feedback on the libffi interface. +Andreas Tobler has done a tremendous amount of work on the testsuite. + +Alex Oliva solved the executable page problem for SElinux. + +The list above is almost certainly incomplete and inaccurate. I'm +happy to make corrections or additions upon request. + If you have a problem, or have found a bug, please send a note to -green@cygnus.com. +green@redhat.com. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 13:40 ` Andrew Haley ` (2 preceding siblings ...) 2009-06-08 17:16 ` Andrew Haley @ 2009-06-09 10:16 ` Andrew Haley 2009-06-09 11:45 ` Joseph S. Myers 2009-06-09 15:24 ` Andrew Haley 3 siblings, 2 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-09 10:16 UTC (permalink / raw) Cc: libffi-discuss, gcc-patches, Java Patch List Merge docs and configury from libffi to cc. Bump libffi version. Andrew. 2009-06-08 Andrew Haley <aph@redhat.com> Import from libffi 3.0.8: * doc/libffi.texi: New file. * doc/libffi.info: Likewise. * doc/stamp-vti: Likewise. * man/Makefile.am: New file. * man/ffi_call.3: New file. * Makefile.am (EXTRA_DIST): Add src/x86/darwin64.S, src/dlmalloc.c. (nodist_libffi_la_SOURCES): Add X86_FREEBSD. * configure.ac: Bump version to 3.0.8. parisc*-*-linux*: Add. i386-*-freebsd* | i386-*-openbsd*: Add. powerpc-*-beos*: Add. AM_CONDITIONAL X86_FREEBSD: Add. AC_CONFIG_FILES: Add man/Makefile. * include/ffi.h.in (FFI_FN): Change void (*)() to void (*)(void). 2Index: include/ffi.h.in =================================================================== --- include/ffi.h.in (revision 148173) +++ include/ffi.h.in (working copy) @@ -1,5 +1,5 @@ /* -----------------------------------------------------------------*-C-*- - libffi @VERSION@ - Copyright (c) 1996-2003, 2007 Red Hat, Inc. + libffi @VERSION@ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -354,7 +354,7 @@ void **avalue); /* Useful for eliminating compiler warnings */ -#define FFI_FN(f) ((void (*)())f) +#define FFI_FN(f) ((void (*)(void))f) /* ---- Definitions shared with assembly code ---------------------------- */ Index: configure.ac =================================================================== --- configure.ac (revision 148170) +++ configure.ac (working copy) @@ -2,7 +2,7 @@ AC_PREREQ(2.59) -AC_INIT([libffi], [2.1], [http://gcc.gnu.org/bugs.html]) +AC_INIT([libffi], [3.0.8], [http://gcc.gnu.org/bugs.html]) AC_CONFIG_HEADERS([fficonfig.h]) AM_ENABLE_MULTILIB(, ..) @@ -63,7 +63,7 @@ TARGET=FRV; TARGETDIR=frv ;; - hppa*-*-linux*) + hppa*-*-linux* | parisc*-*-linux*) TARGET=PA_LINUX; TARGETDIR=pa ;; hppa*64-*-hpux*) @@ -73,6 +73,9 @@ TARGET=PA_HPUX; TARGETDIR=pa ;; + i386-*-freebsd* | i386-*-openbsd*) + TARGET=X86_FREEBSD; TARGETDIR=x86 + ;; i?86-win32* | i?86-*-cygwin* | i?86-*-mingw*) TARGET=X86_WIN32; TARGETDIR=x86 ;; @@ -105,7 +108,10 @@ TARGET=MIPS; TARGETDIR=mips ;; - powerpc*-*-linux*) + powerpc*-*-linux* | powerpc-*-sysv*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; + powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc ;; powerpc-*-darwin*) @@ -155,6 +161,7 @@ AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) +AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32) AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN) AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA) @@ -370,6 +377,6 @@ AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h) -AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile) +AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile) AC_OUTPUT Index: doc/libffi.texi =================================================================== --- doc/libffi.texi (revision 0) +++ doc/libffi.texi (revision 0) @@ -0,0 +1,541 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename libffi.info +@settitle libffi +@setchapternewpage off +@c %**end of header + +@c Merge the standard indexes into a single one. +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp + +@include version.texi + +@copying + +This manual is for Libffi, a portable foreign-function interface +library. + +Copyright @copyright{} 2008 Red Hat, Inc. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. A copy of the license is included in the +section entitled ``GNU General Public License''. + +@end quotation +@end copying + +@dircategory +@direntry +* libffi: (libffi). Portable foreign-function interface library. +@end direntry + +@titlepage +@title Libffi +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage + + +@ifnottex +@node Top +@top libffi + +@insertcopying + +@menu +* Introduction:: What is libffi? +* Using libffi:: How to use libffi. +* Missing Features:: Things libffi can't do. +* Index:: Index. +@end menu + +@end ifnottex + + +@node Introduction +@chapter What is libffi? + +Compilers for high level languages generate code that follow certain +conventions. These conventions are necessary, in part, for separate +compilation to work. One such convention is the @dfn{calling +convention}. The calling convention is a set of assumptions made by +the compiler about where function arguments will be found on entry to +a function. A calling convention also specifies where the return +value for a function is found. The calling convention is also +sometimes called the @dfn{ABI} or @dfn{Application Binary Interface}. +@cindex calling convention +@cindex ABI +@cindex Application Binary Interface + +Some programs may not know at the time of compilation what arguments +are to be passed to a function. For instance, an interpreter may be +told at run-time about the number and types of arguments used to call +a given function. @samp{Libffi} can be used in such programs to +provide a bridge from the interpreter program to compiled code. + +The @samp{libffi} library provides a portable, high level programming +interface to various calling conventions. This allows a programmer to +call any function specified by a call interface description at run +time. + +@acronym{FFI} stands for Foreign Function Interface. A foreign +function interface is the popular name for the interface that allows +code written in one language to call code written in another language. +The @samp{libffi} library really only provides the lowest, machine +dependent layer of a fully featured foreign function interface. A +layer must exist above @samp{libffi} that handles type conversions for +values passed between the two languages. +@cindex FFI +@cindex Foreign Function Interface + + +@node Using libffi +@chapter Using libffi + +@menu +* The Basics:: The basic libffi API. +* Simple Example:: A simple example. +* Types:: libffi type descriptions. +* Multiple ABIs:: Different passing styles on one platform. +* The Closure API:: Writing a generic function. +@end menu + + +@node The Basics +@section The Basics + +@samp{Libffi} assumes that you have a pointer to the function you wish +to call and that you know the number and types of arguments to pass +it, as well as the return type of the function. + +The first thing you must do is create an @code{ffi_cif} object that +matches the signature of the function you wish to call. This is a +separate step because it is common to make multiple calls using a +single @code{ffi_cif}. The @dfn{cif} in @code{ffi_cif} stands for +Call InterFace. To prepare a call interface object, use the function +@code{ffi_prep_cif}. +@cindex cif + +@findex ffi_prep_cif +@defun ffi_status ffi_prep_cif (ffi_cif *@var{cif}, ffi_abi @var{abi}, unsigned int @var{nargs}, ffi_type *@var{rtype}, ffi_type **@var{argtypes}) +This initializes @var{cif} according to the given parameters. + +@var{abi} is the ABI to use; normally @code{FFI_DEFAULT_ABI} is what +you want. @ref{Multiple ABIs} for more information. + +@var{nargs} is the number of arguments that this function accepts. +@samp{libffi} does not yet handle varargs functions; see @ref{Missing +Features} for more information. + +@var{rtype} is a pointer to an @code{ffi_type} structure that +describes the return type of the function. @xref{Types}. + +@var{argtypes} is a vector of @code{ffi_type} pointers. +@var{argtypes} must have @var{nargs} elements. If @var{nargs} is 0, +this argument is ignored. + +@code{ffi_prep_cif} returns a @code{libffi} status code, of type +@code{ffi_status}. This will be either @code{FFI_OK} if everything +worked properly; @code{FFI_BAD_TYPEDEF} if one of the @code{ffi_type} +objects is incorrect; or @code{FFI_BAD_ABI} if the @var{abi} parameter +is invalid. +@end defun + + +To call a function using an initialized @code{ffi_cif}, use the +@code{ffi_call} function: + +@findex ffi_call +@defun void ffi_call (ffi_cif *@var{cif}, void *@var{fn}, void *@var{rvalue}, void **@var{avalues}) +This calls the function @var{fn} according to the description given in +@var{cif}. @var{cif} must have already been prepared using +@code{ffi_prep_cif}. + +@var{rvalue} is a pointer to a chunk of memory that will hold the +result of the function call. This must be large enough to hold the +result and must be suitably aligned; it is the caller's responsibility +to ensure this. If @var{cif} declares that the function returns +@code{void} (using @code{ffi_type_void}), then @var{rvalue} is +ignored. If @var{rvalue} is @samp{NULL}, then the return value is +discarded. + +@var{avalues} is a vector of @code{void *} pointers that point to the +memory locations holding the argument values for a call. If @var{cif} +declares that the function has no arguments (i.e., @var{nargs} was 0), +then @var{avalues} is ignored. +@end defun + + +@node Simple Example +@section Simple Example + +Here is a trivial example that calls @code{puts} a few times. + +@example +#include <stdio.h> +#include <ffi.h> + +int main() +@{ + ffi_cif cif; + ffi_type *args[1]; + void *values[1]; + char *s; + int rc; + + /* Initialize the argument info vectors */ + args[0] = &ffi_type_pointer; + values[0] = &s; + + /* Initialize the cif */ + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uint, args) == FFI_OK) + @{ + s = "Hello World!"; + ffi_call(&cif, puts, &rc, values); + /* rc now holds the result of the call to puts */ + + /* values holds a pointer to the function's arg, so to + call puts() again all we need to do is change the + value of s */ + s = "This is cool!"; + ffi_call(&cif, puts, &rc, values); + @} + + return 0; +@} +@end example + + +@node Types +@section Types + +@menu +* Primitive Types:: Built-in types. +* Structures:: Structure types. +* Type Example:: Structure type example. +@end menu + +@node Primitive Types +@subsection Primitive Types + +@code{Libffi} provides a number of built-in type descriptors that can +be used to describe argument and return types: + +@table @code +@item ffi_type_void +@tindex ffi_type_void +The type @code{void}. This cannot be used for argument types, only +for return values. + +@item ffi_type_uint8 +@tindex ffi_type_uint8 +An unsigned, 8-bit integer type. + +@item ffi_type_sint8 +@tindex ffi_type_sint8 +A signed, 8-bit integer type. + +@item ffi_type_uint16 +@tindex ffi_type_uint16 +An unsigned, 16-bit integer type. + +@item ffi_type_sint16 +@tindex ffi_type_sint16 +A signed, 16-bit integer type. + +@item ffi_type_uint32 +@tindex ffi_type_uint32 +An unsigned, 32-bit integer type. + +@item ffi_type_sint32 +@tindex ffi_type_sint32 +A signed, 32-bit integer type. + +@item ffi_type_uint64 +@tindex ffi_type_uint64 +An unsigned, 64-bit integer type. + +@item ffi_type_sint64 +@tindex ffi_type_sint64 +A signed, 64-bit integer type. + +@item ffi_type_float +@tindex ffi_type_float +The C @code{float} type. + +@item ffi_type_double +@tindex ffi_type_double +The C @code{double} type. + +@item ffi_type_uchar +@tindex ffi_type_uchar +The C @code{unsigned char} type. + +@item ffi_type_schar +@tindex ffi_type_schar +The C @code{signed char} type. (Note that there is not an exact +equivalent to the C @code{char} type in @code{libffi}; ordinarily you +should either use @code{ffi_type_schar} or @code{ffi_type_uchar} +depending on whether @code{char} is signed.) + +@item ffi_type_ushort +@tindex ffi_type_ushort +The C @code{unsigned short} type. + +@item ffi_type_sshort +@tindex ffi_type_sshort +The C @code{short} type. + +@item ffi_type_uint +@tindex ffi_type_uint +The C @code{unsigned int} type. + +@item ffi_type_sint +@tindex ffi_type_sint +The C @code{int} type. + +@item ffi_type_ulong +@tindex ffi_type_ulong +The C @code{unsigned long} type. + +@item ffi_type_slong +@tindex ffi_type_slong +The C @code{long} type. + +@item ffi_type_longdouble +@tindex ffi_type_longdouble +On platforms that have a C @code{long double} type, this is defined. +On other platforms, it is not. + +@item ffi_type_pointer +@tindex ffi_type_pointer +A generic @code{void *} pointer. You should use this for all +pointers, regardless of their real type. +@end table + +Each of these is of type @code{ffi_type}, so you must take the address +when passing to @code{ffi_prep_cif}. + + +@node Structures +@subsection Structures + +Although @samp{libffi} has no special support for unions or +bit-fields, it is perfectly happy passing structures back and forth. +You must first describe the structure to @samp{libffi} by creating a +new @code{ffi_type} object for it. + +@tindex ffi_type +@deftp ffi_type +The @code{ffi_type} has the following members: +@table @code +@item size_t size +This is set by @code{libffi}; you should initialize it to zero. + +@item unsigned short alignment +This is set by @code{libffi}; you should initialize it to zero. + +@item unsigned short type +For a structure, this should be set to @code{FFI_TYPE_STRUCT}. + +@item ffi_type **elements +This is a @samp{NULL}-terminated array of pointers to @code{ffi_type} +objects. There is one element per field of the struct. +@end table +@end deftp + + +@node Type Example +@subsection Type Example + +The following example initializes a @code{ffi_type} object +representing the @code{tm} struct from Linux's @file{time.h}. + +Here is how the struct is defined: + +@example +struct tm @{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + /* Those are for future use. */ + long int __tm_gmtoff__; + __const char *__tm_zone__; +@}; +@end example + +Here is the corresponding code to describe this struct to +@code{libffi}: + +@example + @{ + ffi_type tm_type; + ffi_type *tm_type_elements[12]; + int i; + + tm_type.size = tm_type.alignment = 0; + tm_type.elements = &tm_type_elements; + + for (i = 0; i < 9; i++) + tm_type_elements[i] = &ffi_type_sint; + + tm_type_elements[9] = &ffi_type_slong; + tm_type_elements[10] = &ffi_type_pointer; + tm_type_elements[11] = NULL; + + /* tm_type can now be used to represent tm argument types and + return types for ffi_prep_cif() */ + @} +@end example + + +@node Multiple ABIs +@section Multiple ABIs + +A given platform may provide multiple different ABIs at once. For +instance, the x86 platform has both @samp{stdcall} and @samp{fastcall} +functions. + +@code{libffi} provides some support for this. However, this is +necessarily platform-specific. + +@c FIXME: document the platforms + +@node The Closure API +@section The Closure API + +@code{libffi} also provides a way to write a generic function -- a +function that can accept and decode any combination of arguments. +This can be useful when writing an interpreter, or to provide wrappers +for arbitrary functions. + +This facility is called the @dfn{closure API}. Closures are not +supported on all platforms; you can check the @code{FFI_CLOSURES} +define to determine whether they are supported on the current +platform. +@cindex closures +@cindex closure API +@findex FFI_CLOSURES + +Because closures work by assembling a tiny function at runtime, they +require special allocation on platforms that have a non-executable +heap. Memory management for closures is handled by a pair of +functions: + +@findex ffi_closure_alloca +@defun void *ffi_closure_alloc (size_t @var{size}, void **@var{code}) +Allocate a chunk of memory holding @var{size} bytes. This returns a +pointer to the writable address, and sets *@var{code} to the +corresponding executable address. + +@var{size} should be sufficient to hold a @code{ffi_closure} object. +@end defun + +@findex ffi_closure_free +@defun void ffi_closure_free (void *@var{writable}) +Free memory allocated using @code{ffi_closure_alloc}. The argument is +the writable address that was returned. +@end defun + + +Once you have allocated the memory for a closure, you must construct a +@code{ffi_cif} describing the function call. Finally you can prepare +the closure function: + +@findex ffi_prep_closure_loc +@defun ffi_status ffi_prep_closure_loc (ffi_closure *@var{closure}, ffi_cif *@var{cif}, void (*@var{fun}) (ffi_cif *@var{cif}, void *@var{ret}, void **@var{args}, void *@var{user_data}), void *@var{user_data}, void *@var{codeloc}) +Prepare a closure function. + +@var{closure} is the address of a @code{ffi_closure} object; this is +the writable address returned by @code{ffi_closure_alloc}. + +@var{cif} is the @code{ffi_cif} describing the function parameters. + +@var{user_data} is an arbitrary datum that is passed, uninterpreted, +to your closure function. + +@var{codeloc} is the executable address returned by +@code{ffi_closure_alloc}. + +@var{fun} is the function which will be called when the closure is +invoked. It is called with the arguments: +@table @var +@item cif +The @code{ffi_cif} passed to @code{ffi_prep_closure_loc}. + +@item ret +A pointer to the memory used for the function's return value. +@var{fun} must fill this, unless the function is declared as returning +@code{void}. +@c FIXME: is this NULL for void-returning functions? + +@item args +A vector of pointers to memory holding the arguments to the function. + +@item user_data +The same @var{user_data} that was passed to +@code{ffi_prep_closure_loc}. +@end table + +@code{ffi_prep_closure_loc} will return @code{FFI_OK} if everything +went ok, and something else on error. +@c FIXME: what? + +After calling @code{ffi_prep_closure_loc}, you can cast @var{codeloc} +to the appropriate pointer-to-function type. +@end defun + +@c FIXME: example + +You may see old code referring to @code{ffi_prep_closure}. This +function is deprecated, as it cannot handle the need for separate +writable and executable addresses. + + +@node Missing Features +@chapter Missing Features + +@code{libffi} is missing a few features. We welcome patches to add +support for these. + +@itemize @bullet +@item +There is no support for calling varargs functions. This may work on +some platforms, depending on how the ABI is defined, but it is not +reliable. + +@item +There is no support for bit fields in structures. + +@item +The closure API is + +@item +The ``raw'' API is undocumented. +@c argument promotion? +@c unions? +@c anything else? +@end itemize + + +@node Index +@unnumbered Index + +@printindex cp + +@bye Index: doc/stamp-vti =================================================================== --- doc/stamp-vti (revision 0) +++ doc/stamp-vti (revision 0) @@ -0,0 +1,4 @@ +@set UPDATED 14 February 2008 +@set UPDATED-MONTH February 2008 +@set EDITION 3.0.8 +@set VERSION 3.0.8 Index: doc/libffi.info =================================================================== --- doc/libffi.info (revision 0) +++ doc/libffi.info (revision 0) @@ -0,0 +1,533 @@ +This is doc/libffi.info, produced by makeinfo version 4.12 from +./doc/libffi.texi. + +This manual is for Libffi, a portable foreign-function interface +library. + + Copyright (C) 2008 Red Hat, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or + (at your option) any later version. A copy of the license is + included in the section entitled "GNU General Public License". + + +INFO-DIR-SECTION +START-INFO-DIR-ENTRY +* libffi: (libffi). Portable foreign-function interface library. +END-INFO-DIR-ENTRY + +\x1f +File: libffi.info, Node: Top, Next: Introduction, Up: (dir) + +libffi +****** + +This manual is for Libffi, a portable foreign-function interface +library. + + Copyright (C) 2008 Red Hat, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or + (at your option) any later version. A copy of the license is + included in the section entitled "GNU General Public License". + + +* Menu: + +* Introduction:: What is libffi? +* Using libffi:: How to use libffi. +* Missing Features:: Things libffi can't do. +* Index:: Index. + +\x1f +File: libffi.info, Node: Introduction, Next: Using libffi, Prev: Top, Up: Top + +1 What is libffi? +***************** + +Compilers for high level languages generate code that follow certain +conventions. These conventions are necessary, in part, for separate +compilation to work. One such convention is the "calling convention". +The calling convention is a set of assumptions made by the compiler +about where function arguments will be found on entry to a function. A +calling convention also specifies where the return value for a function +is found. The calling convention is also sometimes called the "ABI" or +"Application Binary Interface". + + Some programs may not know at the time of compilation what arguments +are to be passed to a function. For instance, an interpreter may be +told at run-time about the number and types of arguments used to call a +given function. `Libffi' can be used in such programs to provide a +bridge from the interpreter program to compiled code. + + The `libffi' library provides a portable, high level programming +interface to various calling conventions. This allows a programmer to +call any function specified by a call interface description at run time. + + FFI stands for Foreign Function Interface. A foreign function +interface is the popular name for the interface that allows code +written in one language to call code written in another language. The +`libffi' library really only provides the lowest, machine dependent +layer of a fully featured foreign function interface. A layer must +exist above `libffi' that handles type conversions for values passed +between the two languages. + +\x1f +File: libffi.info, Node: Using libffi, Next: Missing Features, Prev: Introduction, Up: Top + +2 Using libffi +************** + +* Menu: + +* The Basics:: The basic libffi API. +* Simple Example:: A simple example. +* Types:: libffi type descriptions. +* Multiple ABIs:: Different passing styles on one platform. +* The Closure API:: Writing a generic function. + +\x1f +File: libffi.info, Node: The Basics, Next: Simple Example, Up: Using libffi + +2.1 The Basics +============== + +`Libffi' assumes that you have a pointer to the function you wish to +call and that you know the number and types of arguments to pass it, as +well as the return type of the function. + + The first thing you must do is create an `ffi_cif' object that +matches the signature of the function you wish to call. This is a +separate step because it is common to make multiple calls using a +single `ffi_cif'. The "cif" in `ffi_cif' stands for Call InterFace. +To prepare a call interface object, use the function `ffi_prep_cif'. + + -- Function: ffi_status ffi_prep_cif (ffi_cif *CIF, ffi_abi ABI, + unsigned int NARGS, ffi_type *RTYPE, ffi_type **ARGTYPES) + This initializes CIF according to the given parameters. + + ABI is the ABI to use; normally `FFI_DEFAULT_ABI' is what you + want. *note Multiple ABIs:: for more information. + + NARGS is the number of arguments that this function accepts. + `libffi' does not yet handle varargs functions; see *note Missing + Features:: for more information. + + RTYPE is a pointer to an `ffi_type' structure that describes the + return type of the function. *Note Types::. + + ARGTYPES is a vector of `ffi_type' pointers. ARGTYPES must have + NARGS elements. If NARGS is 0, this argument is ignored. + + `ffi_prep_cif' returns a `libffi' status code, of type + `ffi_status'. This will be either `FFI_OK' if everything worked + properly; `FFI_BAD_TYPEDEF' if one of the `ffi_type' objects is + incorrect; or `FFI_BAD_ABI' if the ABI parameter is invalid. + + To call a function using an initialized `ffi_cif', use the +`ffi_call' function: + + -- Function: void ffi_call (ffi_cif *CIF, void *FN, void *RVALUE, void + **AVALUES) + This calls the function FN according to the description given in + CIF. CIF must have already been prepared using `ffi_prep_cif'. + + RVALUE is a pointer to a chunk of memory that will hold the result + of the function call. This must be large enough to hold the + result and must be suitably aligned; it is the caller's + responsibility to ensure this. If CIF declares that the function + returns `void' (using `ffi_type_void'), then RVALUE is ignored. + If RVALUE is `NULL', then the return value is discarded. + + AVALUES is a vector of `void *' pointers that point to the memory + locations holding the argument values for a call. If CIF declares + that the function has no arguments (i.e., NARGS was 0), then + AVALUES is ignored. + +\x1f +File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: Using libffi + +2.2 Simple Example +================== + +Here is a trivial example that calls `puts' a few times. + + #include <stdio.h> + #include <ffi.h> + + int main() + { + ffi_cif cif; + ffi_type *args[1]; + void *values[1]; + char *s; + int rc; + + /* Initialize the argument info vectors */ + args[0] = &ffi_type_pointer; + values[0] = &s; + + /* Initialize the cif */ + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uint, args) == FFI_OK) + { + s = "Hello World!"; + ffi_call(&cif, puts, &rc, values); + /* rc now holds the result of the call to puts */ + + /* values holds a pointer to the function's arg, so to + call puts() again all we need to do is change the + value of s */ + s = "This is cool!"; + ffi_call(&cif, puts, &rc, values); + } + + return 0; + } + +\x1f +File: libffi.info, Node: Types, Next: Multiple ABIs, Prev: Simple Example, Up: Using libffi + +2.3 Types +========= + +* Menu: + +* Primitive Types:: Built-in types. +* Structures:: Structure types. +* Type Example:: Structure type example. + +\x1f +File: libffi.info, Node: Primitive Types, Next: Structures, Up: Types + +2.3.1 Primitive Types +--------------------- + +`Libffi' provides a number of built-in type descriptors that can be +used to describe argument and return types: + +`ffi_type_void' + The type `void'. This cannot be used for argument types, only for + return values. + +`ffi_type_uint8' + An unsigned, 8-bit integer type. + +`ffi_type_sint8' + A signed, 8-bit integer type. + +`ffi_type_uint16' + An unsigned, 16-bit integer type. + +`ffi_type_sint16' + A signed, 16-bit integer type. + +`ffi_type_uint32' + An unsigned, 32-bit integer type. + +`ffi_type_sint32' + A signed, 32-bit integer type. + +`ffi_type_uint64' + An unsigned, 64-bit integer type. + +`ffi_type_sint64' + A signed, 64-bit integer type. + +`ffi_type_float' + The C `float' type. + +`ffi_type_double' + The C `double' type. + +`ffi_type_uchar' + The C `unsigned char' type. + +`ffi_type_schar' + The C `signed char' type. (Note that there is not an exact + equivalent to the C `char' type in `libffi'; ordinarily you should + either use `ffi_type_schar' or `ffi_type_uchar' depending on + whether `char' is signed.) + +`ffi_type_ushort' + The C `unsigned short' type. + +`ffi_type_sshort' + The C `short' type. + +`ffi_type_uint' + The C `unsigned int' type. + +`ffi_type_sint' + The C `int' type. + +`ffi_type_ulong' + The C `unsigned long' type. + +`ffi_type_slong' + The C `long' type. + +`ffi_type_longdouble' + On platforms that have a C `long double' type, this is defined. + On other platforms, it is not. + +`ffi_type_pointer' + A generic `void *' pointer. You should use this for all pointers, + regardless of their real type. + + Each of these is of type `ffi_type', so you must take the address +when passing to `ffi_prep_cif'. + +\x1f +File: libffi.info, Node: Structures, Next: Type Example, Prev: Primitive Types, Up: Types + +2.3.2 Structures +---------------- + +Although `libffi' has no special support for unions or bit-fields, it +is perfectly happy passing structures back and forth. You must first +describe the structure to `libffi' by creating a new `ffi_type' object +for it. + + -- ffi_type: + The `ffi_type' has the following members: + `size_t size' + This is set by `libffi'; you should initialize it to zero. + + `unsigned short alignment' + This is set by `libffi'; you should initialize it to zero. + + `unsigned short type' + For a structure, this should be set to `FFI_TYPE_STRUCT'. + + `ffi_type **elements' + This is a `NULL'-terminated array of pointers to `ffi_type' + objects. There is one element per field of the struct. + +\x1f +File: libffi.info, Node: Type Example, Prev: Structures, Up: Types + +2.3.3 Type Example +------------------ + +The following example initializes a `ffi_type' object representing the +`tm' struct from Linux's `time.h'. + + Here is how the struct is defined: + + struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + /* Those are for future use. */ + long int __tm_gmtoff__; + __const char *__tm_zone__; + }; + + Here is the corresponding code to describe this struct to `libffi': + + { + ffi_type tm_type; + ffi_type *tm_type_elements[12]; + int i; + + tm_type.size = tm_type.alignment = 0; + tm_type.elements = &tm_type_elements; + + for (i = 0; i < 9; i++) + tm_type_elements[i] = &ffi_type_sint; + + tm_type_elements[9] = &ffi_type_slong; + tm_type_elements[10] = &ffi_type_pointer; + tm_type_elements[11] = NULL; + + /* tm_type can now be used to represent tm argument types and + return types for ffi_prep_cif() */ + } + +\x1f +File: libffi.info, Node: Multiple ABIs, Next: The Closure API, Prev: Types, Up: Using libffi + +2.4 Multiple ABIs +================= + +A given platform may provide multiple different ABIs at once. For +instance, the x86 platform has both `stdcall' and `fastcall' functions. + + `libffi' provides some support for this. However, this is +necessarily platform-specific. + +\x1f +File: libffi.info, Node: The Closure API, Prev: Multiple ABIs, Up: Using libffi + +2.5 The Closure API +=================== + +`libffi' also provides a way to write a generic function - a function +that can accept and decode any combination of arguments. This can be +useful when writing an interpreter, or to provide wrappers for +arbitrary functions. + + This facility is called the "closure API". Closures are not +supported on all platforms; you can check the `FFI_CLOSURES' define to +determine whether they are supported on the current platform. + + Because closures work by assembling a tiny function at runtime, they +require special allocation on platforms that have a non-executable +heap. Memory management for closures is handled by a pair of functions: + + -- Function: void *ffi_closure_alloc (size_t SIZE, void **CODE) + Allocate a chunk of memory holding SIZE bytes. This returns a + pointer to the writable address, and sets *CODE to the + corresponding executable address. + + SIZE should be sufficient to hold a `ffi_closure' object. + + -- Function: void ffi_closure_free (void *WRITABLE) + Free memory allocated using `ffi_closure_alloc'. The argument is + the writable address that was returned. + + Once you have allocated the memory for a closure, you must construct +a `ffi_cif' describing the function call. Finally you can prepare the +closure function: + + -- Function: ffi_status ffi_prep_closure_loc (ffi_closure *CLOSURE, + ffi_cif *CIF, void (*FUN) (ffi_cif *CIF, void *RET, void + **ARGS, void *USER_DATA), void *USER_DATA, void *CODELOC) + Prepare a closure function. + + CLOSURE is the address of a `ffi_closure' object; this is the + writable address returned by `ffi_closure_alloc'. + + CIF is the `ffi_cif' describing the function parameters. + + USER_DATA is an arbitrary datum that is passed, uninterpreted, to + your closure function. + + CODELOC is the executable address returned by `ffi_closure_alloc'. + + FUN is the function which will be called when the closure is + invoked. It is called with the arguments: + CIF + The `ffi_cif' passed to `ffi_prep_closure_loc'. + + RET + A pointer to the memory used for the function's return value. + FUN must fill this, unless the function is declared as + returning `void'. + + ARGS + A vector of pointers to memory holding the arguments to the + function. + + USER_DATA + The same USER_DATA that was passed to `ffi_prep_closure_loc'. + + `ffi_prep_closure_loc' will return `FFI_OK' if everything went ok, + and something else on error. + + After calling `ffi_prep_closure_loc', you can cast CODELOC to the + appropriate pointer-to-function type. + + You may see old code referring to `ffi_prep_closure'. This function +is deprecated, as it cannot handle the need for separate writable and +executable addresses. + +\x1f +File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi, Up: Top + +3 Missing Features +****************** + +`libffi' is missing a few features. We welcome patches to add support +for these. + + * There is no support for calling varargs functions. This may work + on some platforms, depending on how the ABI is defined, but it is + not reliable. + + * There is no support for bit fields in structures. + + * The closure API is + + * The "raw" API is undocumented. + +\x1f +File: libffi.info, Node: Index, Prev: Missing Features, Up: Top + +Index +***** + + ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-09 10:16 ` Andrew Haley @ 2009-06-09 11:45 ` Joseph S. Myers 2009-06-09 12:14 ` Andrew Haley 2009-06-09 17:41 ` Ralf Wildenhues 2009-06-09 15:24 ` Andrew Haley 1 sibling, 2 replies; 91+ messages in thread From: Joseph S. Myers @ 2009-06-09 11:45 UTC (permalink / raw) To: Andrew Haley; +Cc: libffi-discuss, gcc-patches, Java Patch List On Tue, 9 Jun 2009, Andrew Haley wrote: > Merge docs and configury from libffi to cc. Bump libffi version. > > Andrew. > > 2009-06-08 Andrew Haley <aph@redhat.com> > > Import from libffi 3.0.8: > > * doc/libffi.texi: New file. > * doc/libffi.info: Likewise. We do not generally check .info files into the GCC repository; instead, we arrange for --enable-generated-files-in-srcdir to build them in the source directory (but the default to build them in the build directory so a source directory on a readonly filesystem or chmoded readonly works) for use when building release tarballs. libgomp provides a suitable example of such an automake-using directory with a Texinfo manual in GCC. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-09 11:45 ` Joseph S. Myers @ 2009-06-09 12:14 ` Andrew Haley 2009-06-09 14:58 ` Andrew Haley 2009-06-09 17:41 ` Ralf Wildenhues 1 sibling, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-09 12:14 UTC (permalink / raw) To: Joseph S. Myers; +Cc: libffi-discuss, gcc-patches, Java Patch List Joseph S. Myers wrote: > On Tue, 9 Jun 2009, Andrew Haley wrote: > >> Merge docs and configury from libffi to cc. Bump libffi version. >> >> Andrew. >> >> 2009-06-08 Andrew Haley <aph@redhat.com> >> >> Import from libffi 3.0.8: >> >> * doc/libffi.texi: New file. >> * doc/libffi.info: Likewise. > > We do not generally check .info files into the GCC repository; instead, we > arrange for --enable-generated-files-in-srcdir to build them in the source > directory (but the default to build them in the build directory so a > source directory on a readonly filesystem or chmoded readonly works) for > use when building release tarballs. libgomp provides a suitable example > of such an automake-using directory with a Texinfo manual in GCC. OK. I'm trying to minimize the differences with upstream, but I'll see what I can do. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-09 12:14 ` Andrew Haley @ 2009-06-09 14:58 ` Andrew Haley 0 siblings, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-09 14:58 UTC (permalink / raw) To: Joseph S. Myers; +Cc: libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Joseph S. Myers wrote: >> On Tue, 9 Jun 2009, Andrew Haley wrote: >> >>> Merge docs and configury from libffi to cc. Bump libffi version. >>> >>> Andrew. >>> >>> 2009-06-08 Andrew Haley <aph@redhat.com> >>> >>> Import from libffi 3.0.8: >>> >>> * doc/libffi.texi: New file. >>> * doc/libffi.info: Likewise. >> We do not generally check .info files into the GCC repository; instead, we >> arrange for --enable-generated-files-in-srcdir to build them in the source >> directory (but the default to build them in the build directory so a >> source directory on a readonly filesystem or chmoded readonly works) for >> use when building release tarballs. libgomp provides a suitable example >> of such an automake-using directory with a Texinfo manual in GCC. > > OK. I'm trying to minimize the differences with upstream, but I'll see > what I can do. This leads to a rather large change in libffi. I'll try to sort something out with upstream: it might be OK to make the same change there. Andrew. 2009-06-09 Andrew Haley <aph@redhat.com> * configure.ac: CX_CHECK_PROG_VER: Check for makeinfo generated-files-in-srcdir: New conditional. Create doc dir. * acinclude.m4: LIBFFI_ENABLE: New section. * doc/version.texi: New file. * doc/stamp-vti: New file. * Makefile.am (MAKEINFOFLAGS): New. (STAMP_GENINSRC, STAMP_BUILD_INFO, TEXINFO_TEX): New. (stamp-build-info): New. (doc/libffi.info): New. (stamp-geninsrc): New. (CLEANFILES, MAINTAINERCLEANFILES): New. * mdate-sh: New file. * aclocal.m4: Include acx.m4. Index: configure.ac =================================================================== --- configure.ac (revision 148309) +++ configure.ac (working copy) @@ -39,6 +39,27 @@ dnl The -no-testsuite modules omit the test subdir. AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) +# See if makeinfo has been installed and is modern enough +# that we can use it. +ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version], + [GNU texinfo.* \([0-9][0-9.]*\)], + [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*]) +AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes") + + +# We would like our source tree to be readonly. However when releases or +# pre-releases are generated, the flex/bison generated files as well as the +# various formats of manuals need to be included along with the rest of the +# sources. Therefore we have --enable-generated-files-in-srcdir to do +# just that. +AC_MSG_CHECKING([for --enable-generated-files-in-srcdir]) +LIBFFI_ENABLE(generated-files-in-srcdir, no, , + [put copies of generated files in source dir intended for creating source + tarballs for users without texinfo bison or flex.], + permit yes|no) +AC_MSG_RESULT($enable_generated_files_in_srcdir) +AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes) + TARGETDIR="unknown" case "$host" in alpha*-*-*) @@ -370,6 +391,7 @@ fi AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) +AC_CONFIG_COMMANDS(doc, [test -d doc || mkdir doc]) AC_CONFIG_COMMANDS(src, [ test -d src || mkdir src test -d src/$TARGETDIR || mkdir src/$TARGETDIR Index: doc/stamp-vti =================================================================== --- doc/stamp-vti (revision 148309) +++ doc/stamp-vti (working copy) @@ -1,4 +1,4 @@ -@set UPDATED 14 February 2008 -@set UPDATED-MONTH February 2008 +@set UPDATED 9 June 2009 +@set UPDATED-MONTH June 2009 @set EDITION 3.0.8 @set VERSION 3.0.8 Index: doc/version.texi =================================================================== --- doc/version.texi (revision 148309) +++ doc/version.texi (working copy) @@ -1,4 +1,4 @@ -@set UPDATED 14 February 2008 -@set UPDATED-MONTH February 2008 +@set UPDATED 9 June 2009 +@set UPDATED-MONTH June 2009 @set EDITION 3.0.8 @set VERSION 3.0.8 Index: acinclude.m4 =================================================================== --- acinclude.m4 (revision 148309) +++ acinclude.m4 (working copy) @@ -90,3 +90,41 @@ [Define if mmap with MAP_ANON(YMOUS) works.]) fi ]) + +dnl ---------------------------------------------------------------------- +dnl This whole bit snagged from libstdc++-v3. + +dnl +dnl LIBFFI_ENABLE +dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING) +dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c) +dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER) +dnl +dnl See docs/html/17_intro/configury.html#enable for documentation. +dnl +m4_define([LIBFFI_ENABLE],[dnl +m4_define([_g_switch],[--enable-$1])dnl +m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl + AC_ARG_ENABLE($1,_g_help, + m4_bmatch([$5], + [^permit ], + [[ + case "$enableval" in + m4_bpatsubst([$5],[permit ])) ;; + *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;; + dnl Idea for future: generate a URL pointing to + dnl "onlinedocs/configopts.html#whatever" + esac + ]], + [^$], + [[ + case "$enableval" in + yes|no) ;; + *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;; + esac + ]], + [[$5]]), + [enable_]m4_bpatsubst([$1],-,_)[=][$2]) +m4_undefine([_g_switch])dnl +m4_undefine([_g_help])dnl +]) Index: Makefile.am =================================================================== --- Makefile.am (revision 148309) +++ Makefile.am (working copy) @@ -31,6 +31,8 @@ src/pa/ffitarget.h src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ src/frv/ffi.c src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c +# Defines info, dvi, pdf and html targets +MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include info_TEXINFOS = doc/libffi.texi ## ################################################################ @@ -168,6 +170,39 @@ AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src AM_CCASFLAGS = $(AM_CPPFLAGS) +# Automake Documentation: +# If your package has Texinfo files in many directories, you can use the +# variable TEXINFO_TEX to tell Automake where to find the canonical +# `texinfo.tex' for your package. The value of this variable should be +# the relative path from the current `Makefile.am' to `texinfo.tex'. +TEXINFO_TEX = ../gcc/doc/include/texinfo.tex + +# AM_CONDITIONAL on configure option --generated-files-in-srcdir +if GENINSRC +STAMP_GENINSRC = stamp-geninsrc +else +STAMP_GENINSRC = +endif + +# AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO]) +if BUILD_INFO +STAMP_BUILD_INFO = stamp-build-info +else +STAMP_BUILD_INFO = +endif + +all-local: $(STAMP_GENINSRC) + +stamp-geninsrc: doc/libffi.info + cp -p $(top_builddir)/doc/libffi.info $(srcdir)/doc/libffi.info + @touch $@ + +doc/libffi.info: $(STAMP_BUILD_INFO) + +stamp-build-info: doc/libffi.texi + $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -o doc/libffi.info $(srcdir)/doc/libffi.texi + @touch $@ + # No install-html or install-pdf support in automake yet .PHONY: install-html install-pdf install-html: @@ -180,3 +215,6 @@ clean-recursive: clean-multi distclean-recursive: distclean-multi maintainer-clean-recursive: maintainer-clean-multi + +CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) doc/libffi.info +MAINTAINERCLEANFILES = $(srcdir)/doc/libffi.info Index: aclocal.m4 =================================================================== --- aclocal.m4 (revision 148309) +++ aclocal.m4 (working copy) @@ -905,6 +905,7 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([../config/acx.m4]) m4_include([../config/depstand.m4]) m4_include([../config/lead-dot.m4]) m4_include([../config/multi.m4]) Index: mdate-sh =================================================================== --- mdate-sh (revision 0) +++ mdate-sh (revision 0) @@ -0,0 +1,201 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2005-06-29.22 + +# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software +# Foundation, Inc. +# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +case $1 in + '') + echo "$0: No file. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification time of FILE. + +Report bugs to <bug-automake@gnu.org>. +EOF + exit $? + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit $? + ;; +esac + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +# GNU ls changes its time format in response to the TIME_STYLE +# variable. Since we cannot assume `unset' works, revert this +# variable to its documented default. +if test "${TIME_STYLE+set}" = set; then + TIME_STYLE=posix-long-iso + export TIME_STYLE +fi + +save_arg1=$1 + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi + +# A `ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named `Jan', or `Feb', etc. However, it's unlikely that `/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`ls -l -d /` + +# Find which argument is the month. +month= +command= +until test $month +do + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +# Get the extended ls output of the file or directory. +set dummy x`eval "$ls_command \"\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Because of the dummy argument above, month is in $2. +# +# On a POSIX system, we should have +# +# $# = 5 +# $1 = file size +# $2 = month +# $3 = day +# $4 = year or time +# $5 = filename +# +# On Darwin 7.7.0 and 7.6.0, we have +# +# $# = 4 +# $1 = day +# $2 = month +# $3 = year or time +# $4 = filename + +# Get the month. +case $2 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +case $3 in + ???*) day=$1;; + *) day=$3; shift;; +esac + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: Property changes on: mdate-sh ___________________________________________________________________ Added: svn:executable + * ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-09 11:45 ` Joseph S. Myers 2009-06-09 12:14 ` Andrew Haley @ 2009-06-09 17:41 ` Ralf Wildenhues 1 sibling, 0 replies; 91+ messages in thread From: Ralf Wildenhues @ 2009-06-09 17:41 UTC (permalink / raw) To: Joseph S. Myers Cc: Andrew Haley, libffi-discuss, gcc-patches, Java Patch List * Joseph S. Myers wrote on Tue, Jun 09, 2009 at 01:44:52PM CEST: > On Tue, 9 Jun 2009, Andrew Haley wrote: > > Import from libffi 3.0.8: > > > > * doc/libffi.texi: New file. > > * doc/libffi.info: Likewise. > > We do not generally check .info files into the GCC repository; You're probably aware of it already, but just in case: similarly, the doc/stamp-vti file should not be checked in either. Cheers, Ralf ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-09 10:16 ` Andrew Haley 2009-06-09 11:45 ` Joseph S. Myers @ 2009-06-09 15:24 ` Andrew Haley 1 sibling, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-09 15:24 UTC (permalink / raw) To: libffi-discuss, gcc-patches, Java Patch List x86/freebsd.S somehow got lost. Andrew. 2009-06-09 Andrew Haley <aph@redhat.com> * src/x86/freebsd.S: Add missing file. Index: src/x86/freebsd.S =================================================================== --- src/x86/freebsd.S (revision 0) +++ src/x86/freebsd.S (revision 0) @@ -0,0 +1,458 @@ +/* ----------------------------------------------------------------------- + freebsd.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. + Copyright (c) 2008 Björn König + + X86 Foreign Function Interface for FreeBSD + + 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 THE AUTHORS OR COPYRIGHT + HOLDERS 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 __x86_64__ + +#define LIBFFI_ASM +#include <fficonfig.h> +#include <ffi.h> + +.text + +.globl ffi_prep_args + + .align 4 +.globl ffi_call_SYSV + .type ffi_call_SYSV,@function + +ffi_call_SYSV: +.LFB1: + pushl %ebp +.LCFI0: + movl %esp,%ebp +.LCFI1: + /* Make room for all of the new args. */ + movl 16(%ebp),%ecx + subl %ecx,%esp + + movl %esp,%eax + + /* Place all of the ffi_prep_args in position */ + pushl 12(%ebp) + pushl %eax + call *8(%ebp) + + /* Return stack to previous state and call the function */ + addl $8,%esp + + call *28(%ebp) + + /* Load %ecx with the return type code */ + movl 20(%ebp),%ecx + + /* Protect %esi. We're going to pop it in the epilogue. */ + pushl %esi + + /* If the return value pointer is NULL, assume no return value. */ + cmpl $0,24(%ebp) + jne 0f + + /* Even if there is no space for the return value, we are + obliged to handle floating-point values. */ + cmpl $FFI_TYPE_FLOAT,%ecx + jne noretval + fstp %st(0) + + jmp epilogue + +0: + call 1f + +.Lstore_table: + .long noretval-.Lstore_table /* FFI_TYPE_VOID */ + .long retint-.Lstore_table /* FFI_TYPE_INT */ + .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ + .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ + .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ + .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ + .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ + .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ + .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ + .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ + .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ + .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ + .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ + .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ + .long retint-.Lstore_table /* FFI_TYPE_POINTER */ + .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */ + .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */ + +1: + pop %esi + add (%esi, %ecx, 4), %esi + jmp *%esi + + /* Sign/zero extend as appropriate. */ +retsint8: + movsbl %al, %eax + jmp retint + +retsint16: + movswl %ax, %eax + jmp retint + +retuint8: + movzbl %al, %eax + jmp retint + +retuint16: + movzwl %ax, %eax + jmp retint + +retfloat: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstps (%ecx) + jmp epilogue + +retdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpl (%ecx) + jmp epilogue + +retlongdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpt (%ecx) + jmp epilogue + +retint64: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + movl %edx,4(%ecx) + jmp epilogue + +retstruct1b: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movb %al,0(%ecx) + jmp epilogue + +retstruct2b: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movw %ax,0(%ecx) + jmp epilogue + +retint: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + +retstruct: + /* Nothing to do! */ + +noretval: +epilogue: + popl %esi + movl %ebp,%esp + popl %ebp + ret +.LFE1: +.ffi_call_SYSV_end: + .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV + + .align 4 +FFI_HIDDEN (ffi_closure_SYSV) +.globl ffi_closure_SYSV + .type ffi_closure_SYSV, @function + +ffi_closure_SYSV: +.LFB2: + pushl %ebp +.LCFI2: + movl %esp, %ebp +.LCFI3: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 8(%ebp), %edx + movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ +#if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ + call ffi_closure_SYSV_inner +#else + movl %ebx, 8(%esp) +.LCFI7: + call 1f +1: popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx + call ffi_closure_SYSV_inner@PLT + movl 8(%esp), %ebx +#endif + movl -12(%ebp), %ecx + cmpl $FFI_TYPE_INT, %eax + je .Lcls_retint + + /* 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 + cmpl $FFI_TYPE_UINT8, %eax + jge .Lcls_retint + +0: cmpl $FFI_TYPE_FLOAT, %eax + je .Lcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lcls_retllong + cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax + je .Lcls_retstruct1b + cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax + je .Lcls_retstruct2b + cmpl $FFI_TYPE_STRUCT, %eax + je .Lcls_retstruct +.Lcls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.Lcls_retint: + movl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retfloat: + flds (%ecx) + jmp .Lcls_epilogue +.Lcls_retdouble: + fldl (%ecx) + jmp .Lcls_epilogue +.Lcls_retldouble: + fldt (%ecx) + jmp .Lcls_epilogue +.Lcls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lcls_epilogue +.Lcls_retstruct1b: + movsbl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retstruct2b: + movswl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retstruct: + movl %ebp, %esp + popl %ebp + ret $4 +.LFE2: + .size ffi_closure_SYSV, .-ffi_closure_SYSV + +#if !FFI_NO_RAW_API + +#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) +#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) +#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#define CIF_FLAGS_OFFSET 20 + + .align 4 +FFI_HIDDEN (ffi_closure_raw_SYSV) +.globl ffi_closure_raw_SYSV + .type ffi_closure_raw_SYSV, @function + +ffi_closure_raw_SYSV: +.LFB3: + pushl %ebp +.LCFI4: + movl %esp, %ebp +.LCFI5: + pushl %esi +.LCFI6: + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ + movl %edx, 8(%esp) /* raw_args */ + leal -24(%ebp), %edx + movl %edx, 4(%esp) /* &res */ + movl %esi, (%esp) /* cif */ + call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ + movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ + cmpl $FFI_TYPE_INT, %eax + je .Lrcls_retint + + /* 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 + cmpl $FFI_TYPE_UINT8, %eax + jge .Lrcls_retint +0: + cmpl $FFI_TYPE_FLOAT, %eax + je .Lrcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lrcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lrcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lrcls_retllong +.Lrcls_epilogue: + addl $36, %esp + popl %esi + popl %ebp + ret +.Lrcls_retint: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue +.Lrcls_retfloat: + flds -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retdouble: + fldl -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retldouble: + fldt -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retllong: + movl -24(%ebp), %eax + movl -20(%ebp), %edx + jmp .Lrcls_epilogue +.LFE3: + .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV +#endif + + .section .eh_frame,EH_FRAME_FLAGS,@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ +.LSCIE1: + .long 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ +#ifdef __PIC__ + .ascii "zR\0" /* CIE Augmentation */ +#else + .ascii "\0" /* CIE Augmentation */ +#endif + .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ + .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ + .byte 0x8 /* CIE RA Column */ +#ifdef __PIC__ + .byte 0x1 /* .uleb128 0x1; Augmentation size */ + .byte 0x1b /* FDE Encoding (pcrel sdata4) */ +#endif + .byte 0xc /* DW_CFA_def_cfa */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .byte 0x1 /* .uleb128 0x1 */ + .align 4 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .long .LASFDE1-.Lframe1 /* FDE CIE offset */ +#ifdef __PIC__ + .long .LFB1-. /* FDE initial location */ +#else + .long .LFB1 /* FDE initial location */ +#endif + .long .LFE1-.LFB1 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI0-.LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI1-.LCFI0 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ + .align 4 +.LEFDE1: +.LSFDE2: + .long .LEFDE2-.LASFDE2 /* FDE Length */ +.LASFDE2: + .long .LASFDE2-.Lframe1 /* FDE CIE offset */ +#ifdef __PIC__ + .long .LFB2-. /* FDE initial location */ +#else + .long .LFB2 +#endif + .long .LFE2-.LFB2 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI2-.LFB2 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI3-.LCFI2 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ +#if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI7-.LCFI3 + .byte 0x83 /* DW_CFA_offset, column 0x3 */ + .byte 0xa /* .uleb128 0xa */ +#endif + .align 4 +.LEFDE2: + +#if !FFI_NO_RAW_API + +.LSFDE3: + .long .LEFDE3-.LASFDE3 /* FDE Length */ +.LASFDE3: + .long .LASFDE3-.Lframe1 /* FDE CIE offset */ +#ifdef __PIC__ + .long .LFB3-. /* FDE initial location */ +#else + .long .LFB3 +#endif + .long .LFE3-.LFB3 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI4-.LFB3 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI5-.LCFI4 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI6-.LCFI5 + .byte 0x86 /* DW_CFA_offset, column 0x6 */ + .byte 0x3 /* .uleb128 0x3 */ + .align 4 +.LEFDE3: + +#endif + +#endif /* ifndef __x86_64__ */ ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-05 12:53 ` Andrew Haley 2009-06-05 13:03 ` Andrew Haley @ 2009-06-05 13:11 ` Dave Korn 1 sibling, 0 replies; 91+ messages in thread From: Dave Korn @ 2009-06-05 13:11 UTC (permalink / raw) To: Andrew Haley Cc: Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > > OK, so the gcc version of win32.s should be copied to libffi, but the > other two files, src/x86/ffi.c and src/x86/ffitarget.h should be copied > from libffi to gcc. Precisely. Sorry for not having been more completely explicit in the first place. cheers, DaveK ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 16:04 ` Andrew Haley 2009-06-04 16:11 ` Dave Korn @ 2009-06-04 16:29 ` Andrew Haley 2009-06-04 17:47 ` Timothy Wall 2 siblings, 0 replies; 91+ messages in thread From: Andrew Haley @ 2009-06-04 16:29 UTC (permalink / raw) To: Dave Korn Cc: Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Correct a misapplied merge from gcc. Andrew. 2009-06-04 Andrew Haley <aph@redhat.com> * src/powerpc/ffitarget.h: Fix misapplied merge from gcc. Index: src/powerpc/ffitarget.h =================================================================== RCS file: /cvs/libffi/libffi/src/powerpc/ffitarget.h,v retrieving revision 1.5 diff -c -r1.5 ffitarget.h *** src/powerpc/ffitarget.h 19 Dec 2008 15:47:44 -0000 1.5 --- src/powerpc/ffitarget.h 4 Jun 2009 16:28:19 -0000 *************** *** 95,106 **** /* For additional types like the below, take care about the order in ppc_closures.S. They must follow after the FFI_TYPE_LAST. */ /* Needed for FFI_SYSV small structure returns. We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are defined in ffi.c, to determine the exact return type and its size. */ - #define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1) - - /* Needed for FFI_SYSV small structure returns. */ #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2) #if defined(POWERPC64) || defined(POWERPC_AIX) --- 95,106 ---- /* For additional types like the below, take care about the order in ppc_closures.S. They must follow after the FFI_TYPE_LAST. */ + /* Needed for soft-float long-double-128 support. */ + #define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1) + /* Needed for FFI_SYSV small structure returns. We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are defined in ffi.c, to determine the exact return type and its size. */ #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2) #if defined(POWERPC64) || defined(POWERPC_AIX) ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 16:04 ` Andrew Haley 2009-06-04 16:11 ` Dave Korn 2009-06-04 16:29 ` Andrew Haley @ 2009-06-04 17:47 ` Timothy Wall 2009-06-04 17:53 ` Andrew Haley 2 siblings, 1 reply; 91+ messages in thread From: Timothy Wall @ 2009-06-04 17:47 UTC (permalink / raw) To: Andrew Haley Cc: Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List On Jun 4, 2009, at 12:04 PM, Andrew Haley wrote: > x86 changes: merge from libffi -> gcc. > > Timothy Wall, please check this one. > > > 2008-02-03 Timothy Wall <twall@users.sf.net> > > * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump > return > offset based on code pointer, not data pointer. > > 2008-01-31 Timothy Wall <twall@users.sf.net> > > * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall > closures. > * src/x86/ffitarget.h: Increase size of trampoline for stdcall > closures. > * src/x86/win32.S: Add assembly for stdcall closure. > * src/x86/ffi.c: Initialize stdcall closure trampoline. > > --- /home/aph/gcc/trunk/libffi/src/x86/ffi.c 2009-06-04 > 16:47:13.000000000 +0100 > +++ ./src/x86/ffi.c 2008-04-03 19:57:34.000000000 +0100 > @@ -1,5 +1,5 @@ > /* > ----------------------------------------------------------------------- > - ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007 Red Hat, Inc. > + ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red > Hat, Inc. > Copyright (c) 2002 Ranjit Mathew > Copyright (c) 2002 Bo Thorsen > Copyright (c) 2002 Roger Sayle > @@ -236,6 +236,10 @@ > __attribute__ ((regparm(1))); > void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) > __attribute__ ((regparm(1))); > +#ifdef X86_WIN32 > +void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) > + __attribute__ ((regparm(1))); > +#endif > > /* This function is jumped to by the trampoline */ > > @@ -245,7 +249,7 @@ > void **respp; > void *args; > { > - // our various things... > + /* our various things... */ > ffi_cif *cif; > void **arg_area; > > @@ -311,13 +315,26 @@ > ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ > unsigned int __fun = (unsigned int)(FUN); \ > unsigned int __ctx = (unsigned int)(CTX); \ > - unsigned int __dis = __fun - (__ctx + FFI_TRAMPOLINE_SIZE); \ > + unsigned int __dis = __fun - (__ctx + 10); \ > *(unsigned char*) &__tramp[0] = 0xb8; \ > *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ > *(unsigned char *) &__tramp[5] = 0xe9; \ > *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ > }) > The above change looks like it was missed in the gcc patch. While FFI_TRAMPOLINE_SIZE is "10", the offset added to __ctx is an instruction displacement, NOT the size of the trampoline. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 17:47 ` Timothy Wall @ 2009-06-04 17:53 ` Andrew Haley 2009-06-05 12:14 ` Dave Korn 0 siblings, 1 reply; 91+ messages in thread From: Andrew Haley @ 2009-06-04 17:53 UTC (permalink / raw) To: Timothy Wall Cc: Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Timothy Wall wrote: > >> @@ -311,13 +315,26 @@ >> ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ >> unsigned int __fun = (unsigned int)(FUN); \ >> unsigned int __ctx = (unsigned int)(CTX); \ >> - unsigned int __dis = __fun - (__ctx + FFI_TRAMPOLINE_SIZE); \ >> + unsigned int __dis = __fun - (__ctx + 10); \ >> *(unsigned char*) &__tramp[0] = 0xb8; \ >> *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ >> *(unsigned char *) &__tramp[5] = 0xe9; \ >> *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ >> }) >> > > The above change looks like it was missed in the gcc patch. While > FFI_TRAMPOLINE_SIZE is "10", the offset added to __ctx is an instruction > displacement, NOT the size of the trampoline. Yes, I understand that the offset should be 10, not FFI_TRAMPOLINE_SIZE. I'm going to make sure that gcc's libffi has that change. But until I can get a reply from Dave that explains what's going on I'm not going to touch anything. Andrew. ^ permalink raw reply [flat|nested] 91+ messages in thread
* Re: libffi merge 2009-06-04 17:53 ` Andrew Haley @ 2009-06-05 12:14 ` Dave Korn 0 siblings, 0 replies; 91+ messages in thread From: Dave Korn @ 2009-06-05 12:14 UTC (permalink / raw) To: Andrew Haley Cc: Timothy Wall, Dave Korn, Anthony Green, Anthony Green, libffi-discuss, gcc-patches, Java Patch List Andrew Haley wrote: > Timothy Wall wrote: >>> @@ -311,13 +315,26 @@ >>> ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ >>> unsigned int __fun = (unsigned int)(FUN); \ >>> unsigned int __ctx = (unsigned int)(CTX); \ >>> - unsigned int __dis = __fun - (__ctx + FFI_TRAMPOLINE_SIZE); \ >>> + unsigned int __dis = __fun - (__ctx + 10); \ >>> *(unsigned char*) &__tramp[0] = 0xb8; \ >>> *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ >>> *(unsigned char *) &__tramp[5] = 0xe9; \ >>> *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ >>> }) >>> >> The above change looks like it was missed in the gcc patch. While >> FFI_TRAMPOLINE_SIZE is "10", the offset added to __ctx is an instruction >> displacement, NOT the size of the trampoline. > > Yes, I understand that the offset should be 10, not FFI_TRAMPOLINE_SIZE. > I'm going to make sure that gcc's libffi has that change. But until I > can get a reply from Dave that explains what's going on I'm not going to > touch anything. All my comments apply only to src/x86/win32.S; this patch (and any others to any files other than win32.S) need merging to gcc. cheers, DaveK ^ permalink raw reply [flat|nested] 91+ messages in thread
end of thread, other threads:[~2009-06-17 17:51 UTC | newest] Thread overview: 91+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-06-02 17:10 libffi merge Andrew Haley 2009-06-03 11:03 ` Andrew Haley 2009-06-03 11:54 ` Anthony Green 2009-06-03 19:53 ` Andrew Haley 2009-06-03 20:26 ` Anthony Green 2009-06-04 10:35 ` Andrew Haley 2009-06-04 10:42 ` Andrew Haley 2009-06-04 10:57 ` Andrew Haley 2009-06-04 12:39 ` Anthony Green 2009-06-04 12:49 ` Andrew Haley 2009-06-04 14:09 ` Dave Korn 2009-06-04 14:43 ` Andrew Haley 2009-06-04 15:07 ` Andrew Haley 2009-06-04 15:41 ` Andrew Haley 2009-06-04 16:04 ` Andrew Haley 2009-06-04 16:11 ` Dave Korn 2009-06-04 16:27 ` Andrew Haley 2009-06-04 16:36 ` Andrew Haley 2009-06-04 17:04 ` Andrew Haley 2009-06-04 17:46 ` Timothy Wall 2009-06-04 17:26 ` Andrew Haley 2009-06-05 12:12 ` Dave Korn 2009-06-05 12:53 ` Andrew Haley 2009-06-05 13:03 ` Andrew Haley 2009-06-05 13:40 ` Andrew Haley 2009-06-05 17:24 ` Andreas Tobler 2009-06-05 17:37 ` Andrew Haley 2009-06-06 2:58 ` NightStrike 2009-06-06 8:22 ` Andrew Haley 2009-06-07 6:44 ` Ralf Wildenhues 2009-06-08 16:22 ` Tom Tromey 2009-06-08 16:35 ` Andrew Haley 2009-06-08 16:54 ` NightStrike 2009-06-08 17:01 ` Andrew Haley 2009-06-08 17:58 ` NightStrike 2009-06-08 18:57 ` Timothy Wall 2009-06-08 22:21 ` Timothy Wall 2009-06-09 15:32 ` Andrew Haley 2009-06-09 16:36 ` Timothy Wall 2009-06-09 16:44 ` Andrew Haley 2009-06-09 18:08 ` PATCH libffi testsuite closure fixes Timothy Wall 2009-06-09 18:08 ` PATCH libffi win64 support Timothy Wall 2009-06-10 9:45 ` Andrew Haley 2009-06-10 10:54 ` Timothy Wall 2009-06-12 14:21 ` Andrew Haley 2009-06-12 15:02 ` Timothy Wall 2009-06-12 15:08 ` Kai Tietz 2009-06-12 15:17 ` Andrew Haley 2009-06-12 15:23 ` Timothy Wall 2009-06-12 15:44 ` Andrew Haley 2009-06-12 15:46 ` NightStrike 2009-06-12 15:53 ` Andrew Haley 2009-06-12 19:17 ` Timothy Wall 2009-06-12 20:03 ` Andrew Haley 2009-06-12 20:31 ` Timothy Wall 2009-06-16 15:57 ` NightStrike 2009-06-16 16:03 ` NightStrike 2009-06-16 16:26 ` Andrew Haley 2009-06-16 17:58 ` Ralf Wildenhues 2009-06-16 18:20 ` Andrew Haley 2009-06-16 19:11 ` Ralf Wildenhues 2009-06-17 12:36 ` Dave Korn 2009-06-17 12:53 ` Andrew Haley 2009-06-17 14:21 ` Dave Korn 2009-06-17 17:51 ` autom4te caching (was: PATCH libffi win64 support) Ralf Wildenhues 2009-06-16 16:31 ` PATCH libffi win64 support Andrew Haley 2009-06-16 17:19 ` NightStrike 2009-06-16 17:37 ` Andrew Haley 2009-06-16 17:38 ` NightStrike 2009-06-16 17:42 ` NightStrike 2009-06-16 17:57 ` Ralf Wildenhues 2009-06-17 2:24 ` NightStrike 2009-06-08 16:48 ` libffi merge NightStrike 2009-06-08 16:50 ` NightStrike 2009-06-08 18:25 ` Ralf Wildenhues 2009-06-08 18:33 ` Andrew Haley 2009-06-08 17:03 ` Andrew Haley 2009-06-09 10:34 ` H.J. Lu 2009-06-09 10:39 ` Andrew Haley 2009-06-08 17:16 ` Andrew Haley 2009-06-09 10:16 ` Andrew Haley 2009-06-09 11:45 ` Joseph S. Myers 2009-06-09 12:14 ` Andrew Haley 2009-06-09 14:58 ` Andrew Haley 2009-06-09 17:41 ` Ralf Wildenhues 2009-06-09 15:24 ` Andrew Haley 2009-06-05 13:11 ` Dave Korn 2009-06-04 16:29 ` Andrew Haley 2009-06-04 17:47 ` Timothy Wall 2009-06-04 17:53 ` Andrew Haley 2009-06-05 12:14 ` Dave Korn
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).