public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH] win64 support for libffi (2/2)
       [not found]   ` <4A109F74.6060108@gmail.com>
@ 2009-05-17 23:49     ` Timothy Wall
  2009-05-17 23:51       ` NightStrike
  2009-05-18  9:36       ` Andrew Haley
  0 siblings, 2 replies; 28+ messages in thread
From: Timothy Wall @ 2009-05-17 23:49 UTC (permalink / raw)
  To: Dave Korn; +Cc: NightStrike, gcc-patches, java-patches, libffi-discuss

Nominally, the libffi list gets the patches (I've cc'd there) and  
Anthony Green promises to migrate stuff back and forth between  
sourceware and gcc, but I've not heard a peep from Mr. Green.

I will remove gcc-patches from future To: lists, and send to java- 
patches instead.

On May 17, 2009, at 7:36 PM, Dave Korn wrote:

> NightStrike wrote:
>> On Sun, May 17, 2009 at 5:53 PM, Timothy Wall  
>> <twalljava@dev.java.net> wrote:
>>> This patch adds support for win64 builds under mingw64 for  
>>> libffi.  Diffs
>>> are against current libffi CVS (5/12/2009).
>
>>
>> Thank you for this!!!
>
>  Bad news guys, there's a problem: GCC's in-tree libffi is way behind
> sourceware CVS HEAD, like at least an entire ABI version IIUC.  The  
> patch
> doesn't come even close to applying cleanly to GCC, I'm afraid.
>
>  It either needs backporting, or a whole new version of libffi needs
> importing and a whole lot of targets tested.  You'd probably better  
> discuss
> this with the java list, I think they're the owners of libffi in GCC.
>
>    cheers,
>      DaveK
>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-17 23:49     ` [PATCH] win64 support for libffi (2/2) Timothy Wall
@ 2009-05-17 23:51       ` NightStrike
  2009-05-18  9:36       ` Andrew Haley
  1 sibling, 0 replies; 28+ messages in thread
From: NightStrike @ 2009-05-17 23:51 UTC (permalink / raw)
  To: Timothy Wall; +Cc: Dave Korn, gcc-patches, java-patches, libffi-discuss

On Sun, May 17, 2009 at 7:49 PM, Timothy Wall <twalljava@dev.java.net> wrote:
> Nominally, the libffi list gets the patches (I've cc'd there) and Anthony
> Green promises to migrate stuff back and forth between sourceware and gcc,
> but I've not heard a peep from Mr. Green.
>
> I will remove gcc-patches from future To: lists, and send to java-patches
> instead.

From http://gcc.gnu.org/lists.html
java-patches is a list for submission and discussion of patches to
libgcj, the Java runtime. Patches to GCJ, the Java language front end,
should go to both this list and gcc-patches.

So I think you should be fine cross posting (or else that web page
should change.)

I just hope that we can easily upgrade libffi.....

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-17 23:49     ` [PATCH] win64 support for libffi (2/2) Timothy Wall
  2009-05-17 23:51       ` NightStrike
@ 2009-05-18  9:36       ` Andrew Haley
  2009-05-18  9:41         ` Richard Guenther
  2009-05-18 14:46         ` Dave Korn
  1 sibling, 2 replies; 28+ messages in thread
From: Andrew Haley @ 2009-05-18  9:36 UTC (permalink / raw)
  To: Timothy Wall
  Cc: Dave Korn, NightStrike, gcc-patches, java-patches, libffi-discuss

Timothy Wall wrote:

> On May 17, 2009, at 7:36 PM, Dave Korn wrote:
> 
>> NightStrike wrote:
>>> On Sun, May 17, 2009 at 5:53 PM, Timothy Wall
>>> <twalljava@dev.java.net> wrote:
>>>> This patch adds support for win64 builds under mingw64 for libffi. 
>>>> Diffs
>>>> are against current libffi CVS (5/12/2009).
>>
>>>
>>> Thank you for this!!!
>>
>>  Bad news guys, there's a problem: GCC's in-tree libffi is way behind
>> sourceware CVS HEAD, like at least an entire ABI version IIUC.

The libffi ABI has changed?  Are you sure?

>> The patch doesn't come even close to applying cleanly to GCC, I'm afraid.
>>
>>  It either needs backporting, or a whole new version of libffi needs
>> importing and a whole lot of targets tested.  You'd probably better
>> discuss
>> this with the java list, I think they're the owners of libffi in GCC.

> Nominally, the libffi list gets the patches (I've cc'd there) and
> Anthony Green promises to migrate stuff back and forth between
> sourceware and gcc, but I've not heard a peep from Mr. Green.
>
> I will remove gcc-patches from future To: lists, and send to
> java-patches instead.

I've been trying to make sure gcc's libffi has stayed in step with
upstream, so there should be no problem with an import.

Andrew.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18  9:36       ` Andrew Haley
@ 2009-05-18  9:41         ` Richard Guenther
  2009-05-18 10:16           ` Andrew Haley
  2009-05-18 14:46         ` Dave Korn
  1 sibling, 1 reply; 28+ messages in thread
From: Richard Guenther @ 2009-05-18  9:41 UTC (permalink / raw)
  To: Andrew Haley
  Cc: Timothy Wall, Dave Korn, NightStrike, gcc-patches, java-patches,
	libffi-discuss

On Mon, May 18, 2009 at 11:36 AM, Andrew Haley <aph@redhat.com> wrote:
> Timothy Wall wrote:
>
>> On May 17, 2009, at 7:36 PM, Dave Korn wrote:
>>
>>> NightStrike wrote:
>>>> On Sun, May 17, 2009 at 5:53 PM, Timothy Wall
>>>> <twalljava@dev.java.net> wrote:
>>>>> This patch adds support for win64 builds under mingw64 for libffi.
>>>>> Diffs
>>>>> are against current libffi CVS (5/12/2009).
>>>
>>>>
>>>> Thank you for this!!!
>>>
>>>  Bad news guys, there's a problem: GCC's in-tree libffi is way behind
>>> sourceware CVS HEAD, like at least an entire ABI version IIUC.
>
> The libffi ABI has changed?  Are you sure?
>
>>> The patch doesn't come even close to applying cleanly to GCC, I'm afraid.
>>>
>>>  It either needs backporting, or a whole new version of libffi needs
>>> importing and a whole lot of targets tested.  You'd probably better
>>> discuss
>>> this with the java list, I think they're the owners of libffi in GCC.
>
>> Nominally, the libffi list gets the patches (I've cc'd there) and
>> Anthony Green promises to migrate stuff back and forth between
>> sourceware and gcc, but I've not heard a peep from Mr. Green.
>>
>> I will remove gcc-patches from future To: lists, and send to
>> java-patches instead.
>
> I've been trying to make sure gcc's libffi has stayed in step with
> upstream, so there should be no problem with an import.

Last time I checked the GCC copy of libffi looked more recent
and upstream missed a lot of patches.

Richard.

> Andrew.
>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
       [not found] <635C3243-B89E-460E-9C0F-209308D89729@dev.java.net>
       [not found] ` <b609cb3b0905171605tc6a10b7u683c43a99f97382f@mail.gmail.com>
@ 2009-05-18 10:12 ` Andrew Haley
  2009-05-18 12:26   ` Timothy Wall
  1 sibling, 1 reply; 28+ messages in thread
From: Andrew Haley @ 2009-05-18 10:12 UTC (permalink / raw)
  To: Timothy Wall; +Cc: Java Patch List, Anthony Green

Timothy Wall wrote:
> This patch adds support for win64 builds under mingw64 for libffi. 
> Diffs are against current libffi CVS (5/12/2009).  The build works with
> mingw or free MSVC cross compiler, although MSVC needs special scripts
> to wrap the compiler, assembler, and linker (available in the JNA
> project's build tree at http://jna.dev.java.net).
> 
> All libffi testsuite tests pass, excluding long double tests, which are
> unsupported at this time.
> 
> Configury changes have been tested on x86-darwin for inadvertent side
> effects.

Richard Guenther is right: libffi upstream and gcc have drifted horribly.
With green's permission I'll merge the changes.

Some of your patch seems odd to me, and perhaps changes are needed.

For example, why this change?

@@ -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*));

Or this?

Index: src/x86/win32.S
===================================================================
RCS file: /cvs/libffi/libffi/src/x86/win32.S,v
retrieving revision 1.5
diff -u -b -w -r1.5 win32.S
--- src/x86/win32.S     15 Feb 2008 01:24:06 -0000      1.5
+++ src/x86/win32.S     12 May 2009 13:51:21 -0000
@@ -20,7 +20,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 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS LIABLE FOR
        ANY CLAIM, DAMAGES OR

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18  9:41         ` Richard Guenther
@ 2009-05-18 10:16           ` Andrew Haley
  0 siblings, 0 replies; 28+ messages in thread
From: Andrew Haley @ 2009-05-18 10:16 UTC (permalink / raw)
  To: Richard Guenther
  Cc: Timothy Wall, Dave Korn, NightStrike, gcc-patches, java-patches,
	libffi-discuss

Richard Guenther wrote:
> On Mon, May 18, 2009 at 11:36 AM, Andrew Haley <aph@redhat.com> wrote:
>> Timothy Wall wrote:
>>
>>> On May 17, 2009, at 7:36 PM, Dave Korn wrote:
>>>
>>>> NightStrike wrote:
>>>>> On Sun, May 17, 2009 at 5:53 PM, Timothy Wall
>>>>> <twalljava@dev.java.net> wrote:
>>>>>> This patch adds support for win64 builds under mingw64 for libffi.
>>>>>> Diffs
>>>>>> are against current libffi CVS (5/12/2009).
>>>>> Thank you for this!!!
>>>>  Bad news guys, there's a problem: GCC's in-tree libffi is way behind
>>>> sourceware CVS HEAD, like at least an entire ABI version IIUC.
>> The libffi ABI has changed?  Are you sure?
>>
>>>> The patch doesn't come even close to applying cleanly to GCC, I'm afraid.
>>>>
>>>>  It either needs backporting, or a whole new version of libffi needs
>>>> importing and a whole lot of targets tested.  You'd probably better
>>>> discuss
>>>> this with the java list, I think they're the owners of libffi in GCC.
>>> Nominally, the libffi list gets the patches (I've cc'd there) and
>>> Anthony Green promises to migrate stuff back and forth between
>>> sourceware and gcc, but I've not heard a peep from Mr. Green.
>>>
>>> I will remove gcc-patches from future To: lists, and send to
>>> java-patches instead.
>> I've been trying to make sure gcc's libffi has stayed in step with
>> upstream, so there should be no problem with an import.
> 
> Last time I checked the GCC copy of libffi looked more recent
> and upstream missed a lot of patches.

You are definitely right.  Here is the diff of patches in gcc but
not in libffi upstream.

Andrew.



*** ChangeLog	2008-12-19 16:13:45.000000000 +0000
--- /home/aph/gcc/trunk/libffi/./ChangeLog	2009-05-18 10:46:33.000000000 +0100
***************
*** 1,26 ****
--- 1,144 ----
+ 2009-04-09  Jakub Jelinek  <jakub@redhat.com>
+
+ 	* testsuite/lib/libffi-dg.exp: Change copyright header to refer to
+ 	version 3 of the GNU General Public License and to point readers
+ 	at the COPYING3 file and the FSF's license web page.
+ 	* testsuite/libffi.call/call.exp: Likewise.
+ 	* testsuite/libffi.special/special.exp: Likewise.
+
+ 2009-03-01  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+ 	* configure: Regenerate.
+
  2008-12-18  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

  	PR libffi/26048
  	* configure.ac (HAVE_AS_X86_PCREL): New test.
  	* configure: Regenerate.
  	* fficonfig.h.in: Regenerate.
  	* src/x86/sysv.S [!FFI_NO_RAW_API]: Precalculate
  	RAW_CLOSURE_CIF_OFFSET, RAW_CLOSURE_FUN_OFFSET,
  	RAW_CLOSURE_USER_DATA_OFFSET for the Solaris 10/x86 assembler.
  	(.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL.
  	* src/x86/unix64.S (.Lstore_table): Move to .text section.
  	(.Lload_table): Likewise.
  	(.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL.

+ 2008-12-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+ 	* configure: Regenerate.
+
+ 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-09-26  Peter O'Gorman  <pogma@thewrittenword.com>
+             Steve Ellcey  <sje@cup.hp.com>
+
+ 	* configure: Regenerate for new libtool.
+ 	* Makefile.in: Ditto.
+ 	* include/Makefile.in: Ditto.
+ 	* aclocal.m4: Ditto.
+
+ 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-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+ 	* configure: Regenerate.
+ 	* include/Makefile.in: Regenerate.
+ 	* testsuite/Makefile.in: Regenerate.
+
+ 2008-06-07  Joseph Myers  <joseph@codesourcery.com>
+
+ 	* configure.ac (parisc*-*-linux*, powerpc-*-sysv*,
+ 	powerpc-*-beos*): Remove.
+ 	* configure: Regenerate.
+
+ 2008-05-09  Julian Brown  <julian@codesourcery.com>
+
+ 	* Makefile.am (LTLDFLAGS): New.
+ 	(libffi_la_LDFLAGS): Use above.
+ 	* Makefile.in: Regenerate.
+
+ 2008-04-18  Paolo Bonzini  <bonzini@gnu.org>
+
+ 	PR bootstrap/35457
+ 	* aclocal.m4: Regenerate.
+ 	* configure: Regenerate.
+
+ 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-03-26  Jakub Jelinek  <jakub@redhat.com>
+
+ 	* src/alpha/osf.S: Add .note.GNU-stack on Linux.
+ 	* src/s390/sysv.S: Likewise.
+ 	* src/powerpc/ppc_closure.S: Likewise.
+ 	* src/powerpc/sysv.S: Likewise.
+ 	* src/x86/unix64.S: Likewise.
+ 	* src/x86/sysv.S: Likewise.
+ 	* src/sparc/v8.S: Likewise.
+ 	* src/sparc/v9.S: Likewise.
+ 	* src/m68k/sysv.S: Likewise.
+ 	* src/arm/sysv.S: Likewise.
+
+ 2008-03-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+ 	* aclocal.m4: Regenerate.
+ 	* configure: Likewise.
+ 	* Makefile.in: Likewise.
+ 	* include/Makefile.in: Likewise.
+ 	* testsuite/Makefile.in: Likewise.
+
+ 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.
+
+ 	* testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer"
+ 	tests.


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 10:12 ` Andrew Haley
@ 2009-05-18 12:26   ` Timothy Wall
  2009-05-18 14:37     ` Andrew Haley
  0 siblings, 1 reply; 28+ messages in thread
From: Timothy Wall @ 2009-05-18 12:26 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Java Patch List, Anthony Green, libffi-discuss


On May 18, 2009, at 6:11 AM, Andrew Haley wrote:

>
> Some of your patch seems odd to me, and perhaps changes are needed.
>
> For example, why this change?
>
> @@ -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*));
>

sizeof(void*) would probably be more accurately represented by  
sizeof(ffi_arg), although the effect is the same.  win64 is looking  
for a 64-bit alignment, versus the original 32-bit alignment.
The (size_t) cast should probably be intptr_t.


> Or this?
>
> Index: src/x86/win32.S
> ===================================================================
> RCS file: /cvs/libffi/libffi/src/x86/win32.S,v
> retrieving revision 1.5
> diff -u -b -w -r1.5 win32.S
> --- src/x86/win32.S     15 Feb 2008 01:24:06 -0000      1.5
> +++ src/x86/win32.S     12 May 2009 13:51:21 -0000
> @@ -20,7 +20,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 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
> +   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS LIABLE FOR
>        ANY CLAIM, DAMAGES OR
>

That one's unintentional and probably missed due to scroll blindness.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 12:26   ` Timothy Wall
@ 2009-05-18 14:37     ` Andrew Haley
  2009-05-18 15:31       ` Timothy Wall
  2009-05-18 18:06       ` Timothy Wall
  0 siblings, 2 replies; 28+ messages in thread
From: Andrew Haley @ 2009-05-18 14:37 UTC (permalink / raw)
  To: Timothy Wall; +Cc: Java Patch List, Anthony Green, libffi-discuss

Timothy Wall wrote:
> 
> On May 18, 2009, at 6:11 AM, Andrew Haley wrote:
> 
>>
>> Some of your patch seems odd to me, and perhaps changes are needed.
>>
>> For example, why this change?
>>
>> @@ -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*));
>>
> 
> sizeof(void*) would probably be more accurately represented by
> sizeof(ffi_arg), although the effect is the same.  win64 is looking for
> a 64-bit alignment, versus the original 32-bit alignment.

But this is in 32-bit generic code.  I take it that the file ffi.c, which
is used for 32-bit code on Linux, is also to be used for 64-bit code on
Windows, which is still using the old calling convention of passing args
via memory rather than registers.

OK, I think I get it now.

A warning to that effect for Linux maintainers might be a good idea.

> The (size_t) cast should probably be intptr_t.

I see.

This looks fine.  Can you prepare a patch for the libffi that's in gcc?
I'll look at doing a merge upstream.

Andrew.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18  9:36       ` Andrew Haley
  2009-05-18  9:41         ` Richard Guenther
@ 2009-05-18 14:46         ` Dave Korn
  2009-05-18 14:59           ` Andrew Haley
  1 sibling, 1 reply; 28+ messages in thread
From: Dave Korn @ 2009-05-18 14:46 UTC (permalink / raw)
  To: Andrew Haley
  Cc: Timothy Wall, Dave Korn, NightStrike, gcc-patches, java-patches,
	libffi-discuss

Andrew Haley wrote:

> 
> The libffi ABI has changed?  Are you sure?

  No, I'm not clear, I'm repeating something I was told second-hand:

http://www.cygwin.com/ml/cygwin-apps/2009-02/msg00051.html

  Maybe I just meant that the API has changed, not the ABI?

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 14:46         ` Dave Korn
@ 2009-05-18 14:59           ` Andrew Haley
  2009-05-18 15:06             ` Dave Korn
  2009-05-18 17:48             ` Dave Korn
  0 siblings, 2 replies; 28+ messages in thread
From: Andrew Haley @ 2009-05-18 14:59 UTC (permalink / raw)
  To: Dave Korn
  Cc: Timothy Wall, NightStrike, gcc-patches, java-patches, libffi-discuss

Dave Korn wrote:
> Andrew Haley wrote:
> 
>> The libffi ABI has changed?  Are you sure?
> 
>   No, I'm not clear, I'm repeating something I was told second-hand:
> 
> http://www.cygwin.com/ml/cygwin-apps/2009-02/msg00051.html
> 
>   Maybe I just meant that the API has changed, not the ABI?

Neither have changed AFAIAA.  There are some updates and fixes in gcc
that are not yet in upstream libffi.

Andrew.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 14:59           ` Andrew Haley
@ 2009-05-18 15:06             ` Dave Korn
  2009-05-18 17:48             ` Dave Korn
  1 sibling, 0 replies; 28+ messages in thread
From: Dave Korn @ 2009-05-18 15:06 UTC (permalink / raw)
  To: Andrew Haley
  Cc: Dave Korn, Timothy Wall, NightStrike, gcc-patches, java-patches,
	libffi-discuss

Andrew Haley wrote:
> Dave Korn wrote:
>> Andrew Haley wrote:
>>
>>> The libffi ABI has changed?  Are you sure?
>>   No, I'm not clear, I'm repeating something I was told second-hand:
>>
>> http://www.cygwin.com/ml/cygwin-apps/2009-02/msg00051.html
>>
>>   Maybe I just meant that the API has changed, not the ABI?
> 
> Neither have changed AFAIAA.  There are some updates and fixes in gcc
> that are not yet in upstream libffi.

  Not even a minor version?  That's odd.  Perhaps something has gone amiss in
the .X.Y.SO -> -X.DLL translation employed by cygwin libtool, I'll have to dig
further.

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 14:37     ` Andrew Haley
@ 2009-05-18 15:31       ` Timothy Wall
  2009-05-18 18:06       ` Timothy Wall
  1 sibling, 0 replies; 28+ messages in thread
From: Timothy Wall @ 2009-05-18 15:31 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Java Patch List, Anthony Green, libffi-discuss


On May 18, 2009, at 10:37 AM, Andrew Haley wrote:

> Timothy Wall wrote:
>>
>> On May 18, 2009, at 6:11 AM, Andrew Haley wrote:
>>
>>>
>>> Some of your patch seems odd to me, and perhaps changes are needed.
>>>
>>> For example, why this change?
>>>
>>> @@ -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*));
>>>
>>
>> sizeof(void*) would probably be more accurately represented by
>> sizeof(ffi_arg), although the effect is the same.  win64 is looking  
>> for
>> a 64-bit alignment, versus the original 32-bit alignment.
>
> But this is in 32-bit generic code.  I take it that the file ffi.c,  
> which
> is used for 32-bit code on Linux, is also to be used for 64-bit code  
> on
> Windows, which is still using the old calling convention of passing  
> args
> via memory rather than registers.
>
> OK, I think I get it now.
>
> A warning to that effect for Linux maintainers might be a good idea.

The implementation isn't terribly optimized; I started from Thomas  
Heller's python ctypes implementation, which re-used the 32-bit ffi.c  
code.  I suppose ideally you'd have a separate source file for the  
win64 stuff (ala darwin64/unix64/etc) but the calling conventions  
originally looked similar enough that splitting it out didn't seem  
like it was worth the effort.

I'll re-do diffs against gcc libffi.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 14:59           ` Andrew Haley
  2009-05-18 15:06             ` Dave Korn
@ 2009-05-18 17:48             ` Dave Korn
  2009-05-18 17:59               ` NightStrike
  1 sibling, 1 reply; 28+ messages in thread
From: Dave Korn @ 2009-05-18 17:48 UTC (permalink / raw)
  To: Andrew Haley
  Cc: Dave Korn, Timothy Wall, NightStrike, gcc-patches, java-patches,
	libffi-discuss

Andrew Haley wrote:
> Dave Korn wrote:
>> Andrew Haley wrote:
>>
>>> The libffi ABI has changed?  Are you sure?
>>   No, I'm not clear, I'm repeating something I was told second-hand:
>>
>> http://www.cygwin.com/ml/cygwin-apps/2009-02/msg00051.html
>>
>>   Maybe I just meant that the API has changed, not the ABI?
> 
> Neither have changed AFAIAA.  There are some updates and fixes in gcc
> that are not yet in upstream libffi.

  Ok, this is what I mean:

admin@ubik /tmp/libffi/upstream
$ tail -2 /tmp/libffi/upstream/libffi-3.0.8/libtool-version
# CURRENT:REVISION:AGE
5:9:0

admin@ubik /tmp/libffi/upstream
$ tail -2 /gnu/gcc/gcc/libffi/libtool-version
# CURRENT:REVISION:AGE
4:1:0

admin@ubik /tmp/libffi/upstream
$


    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 17:48             ` Dave Korn
@ 2009-05-18 17:59               ` NightStrike
  2009-05-18 18:09                 ` Timothy Wall
  0 siblings, 1 reply; 28+ messages in thread
From: NightStrike @ 2009-05-18 17:59 UTC (permalink / raw)
  To: Dave Korn
  Cc: Andrew Haley, Timothy Wall, gcc-patches, java-patches, libffi-discuss

On Mon, May 18, 2009 at 2:00 PM, Dave Korn
<dave.korn.cygwin@googlemail.com> wrote:
> Andrew Haley wrote:
>> Dave Korn wrote:
>>> Andrew Haley wrote:
>>>
>>>> The libffi ABI has changed?  Are you sure?
>>>   No, I'm not clear, I'm repeating something I was told second-hand:
>>>
>>> http://www.cygwin.com/ml/cygwin-apps/2009-02/msg00051.html
>>>
>>>   Maybe I just meant that the API has changed, not the ABI?
>>
>> Neither have changed AFAIAA.  There are some updates and fixes in gcc
>> that are not yet in upstream libffi.
>
>  Ok, this is what I mean:
>
> admin@ubik /tmp/libffi/upstream
> $ tail -2 /tmp/libffi/upstream/libffi-3.0.8/libtool-version
> # CURRENT:REVISION:AGE
> 5:9:0
>
> admin@ubik /tmp/libffi/upstream
> $ tail -2 /gnu/gcc/gcc/libffi/libtool-version
> # CURRENT:REVISION:AGE
> 4:1:0

Maybe it needs to be merged in both directions.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 14:37     ` Andrew Haley
  2009-05-18 15:31       ` Timothy Wall
@ 2009-05-18 18:06       ` Timothy Wall
  1 sibling, 0 replies; 28+ messages in thread
From: Timothy Wall @ 2009-05-18 18:06 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Java Patch List, Anthony Green, libffi-discuss, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

Here's the patch for the libffi testsuite (against gcc/libffi).

This patch uses ffi_closure_alloc instead of inline mmap checking.
It also uses intptr_t in place of long casts.
It marks long double tests as XFAIL for x86_64-*-mingw|cygwin.

This is the 1/2 part of the patch that doesn't seem to be getting to  
gcc-patches.


[-- Attachment #2: testsuite.diff --]
[-- Type: application/octet-stream, Size: 102463 bytes --]

Index: testsuite/libffi.call/cls_multi_ushort.c
===================================================================
--- testsuite/libffi.call/cls_multi_ushort.c	(revision 147665)
+++ testsuite/libffi.call/cls_multi_ushort.c	(working copy)
@@ -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_align_uint16.c
===================================================================
--- testsuite/libffi.call/cls_align_uint16.c	(revision 147665)
+++ testsuite/libffi.call/cls_align_uint16.c	(working copy)
@@ -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/nested_struct1.c
===================================================================
--- testsuite/libffi.call/nested_struct1.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct1.c	(working copy)
@@ -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_struct3.c
===================================================================
--- testsuite/libffi.call/nested_struct3.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct3.c	(working copy)
@@ -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/cls_7_1_byte.c
===================================================================
--- testsuite/libffi.call/cls_7_1_byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_7_1_byte.c	(working copy)
@@ -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/nested_struct5.c
===================================================================
--- testsuite/libffi.call/nested_struct5.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct5.c	(working copy)
@@ -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/cls_double.c
===================================================================
--- testsuite/libffi.call/cls_double.c	(revision 147665)
+++ testsuite/libffi.call/cls_double.c	(working copy)
@@ -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/nested_struct7.c
===================================================================
--- testsuite/libffi.call/nested_struct7.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct7.c	(working copy)
@@ -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/cls_sint.c
===================================================================
--- testsuite/libffi.call/cls_sint.c	(revision 147665)
+++ testsuite/libffi.call/cls_sint.c	(working copy)
@@ -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/nested_struct9.c
===================================================================
--- testsuite/libffi.call/nested_struct9.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct9.c	(working copy)
@@ -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/cls_20byte1.c
===================================================================
--- testsuite/libffi.call/cls_20byte1.c	(revision 147665)
+++ testsuite/libffi.call/cls_20byte1.c	(working copy)
@@ -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_multi_sshortchar.c
===================================================================
--- testsuite/libffi.call/cls_multi_sshortchar.c	(revision 147665)
+++ testsuite/libffi.call/cls_multi_sshortchar.c	(working copy)
@@ -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_align_sint64.c
===================================================================
--- testsuite/libffi.call/cls_align_sint64.c	(revision 147665)
+++ testsuite/libffi.call/cls_align_sint64.c	(working copy)
@@ -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_3byte2.c
===================================================================
--- testsuite/libffi.call/cls_3byte2.c	(revision 147665)
+++ testsuite/libffi.call/cls_3byte2.c	(working copy)
@@ -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/return_ldl.c
===================================================================
--- testsuite/libffi.call/return_ldl.c	(revision 147665)
+++ testsuite/libffi.call/return_ldl.c	(working copy)
@@ -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/cls_multi_schar.c
===================================================================
--- testsuite/libffi.call/cls_multi_schar.c	(revision 147665)
+++ testsuite/libffi.call/cls_multi_schar.c	(working copy)
@@ -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_uchar.c
===================================================================
--- testsuite/libffi.call/cls_multi_uchar.c	(revision 147665)
+++ testsuite/libffi.call/cls_multi_uchar.c	(working copy)
@@ -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_19byte.c
===================================================================
--- testsuite/libffi.call/cls_19byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_19byte.c	(working copy)
@@ -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_9byte1.c
===================================================================
--- testsuite/libffi.call/cls_9byte1.c	(revision 147665)
+++ testsuite/libffi.call/cls_9byte1.c	(working copy)
@@ -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_align_float.c
===================================================================
--- testsuite/libffi.call/cls_align_float.c	(revision 147665)
+++ testsuite/libffi.call/cls_align_float.c	(working copy)
@@ -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/closure_fn1.c
===================================================================
--- testsuite/libffi.call/closure_fn1.c	(revision 147665)
+++ 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,
@@ -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/problem1.c
===================================================================
--- testsuite/libffi.call/problem1.c	(revision 147665)
+++ testsuite/libffi.call/problem1.c	(working copy)
@@ -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/closure_fn3.c
===================================================================
--- testsuite/libffi.call/closure_fn3.c	(revision 147665)
+++ 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);
 
  }
@@ -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/cls_sshort.c
===================================================================
--- testsuite/libffi.call/cls_sshort.c	(revision 147665)
+++ testsuite/libffi.call/cls_sshort.c	(working copy)
@@ -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/closure_fn5.c
===================================================================
--- testsuite/libffi.call/closure_fn5.c	(revision 147665)
+++ 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);
 
 }
 
@@ -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/cls_align_double.c
===================================================================
--- testsuite/libffi.call/cls_align_double.c	(revision 147665)
+++ testsuite/libffi.call/cls_align_double.c	(working copy)
@@ -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/nested_struct.c
===================================================================
--- testsuite/libffi.call/nested_struct.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct.c	(working copy)
@@ -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/cls_2byte.c
===================================================================
--- testsuite/libffi.call/cls_2byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_2byte.c	(working copy)
@@ -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/return_ll1.c
===================================================================
--- testsuite/libffi.call/return_ll1.c	(revision 147665)
+++ testsuite/libffi.call/return_ll1.c	(working copy)
@@ -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/nested_struct10.c
===================================================================
--- testsuite/libffi.call/nested_struct10.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct10.c	(working copy)
@@ -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/float2.c
===================================================================
--- testsuite/libffi.call/float2.c	(revision 147665)
+++ testsuite/libffi.call/float2.c	(working copy)
@@ -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/cls_4byte.c
===================================================================
--- testsuite/libffi.call/cls_4byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_4byte.c	(working copy)
@@ -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_6byte.c
===================================================================
--- testsuite/libffi.call/cls_6byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_6byte.c	(working copy)
@@ -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_8byte.c
===================================================================
--- testsuite/libffi.call/cls_8byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_8byte.c	(working copy)
@@ -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_multi_sshort.c
===================================================================
--- testsuite/libffi.call/cls_multi_sshort.c	(revision 147665)
+++ testsuite/libffi.call/cls_multi_sshort.c	(working copy)
@@ -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_align_sint16.c
===================================================================
--- testsuite/libffi.call/cls_align_sint16.c	(revision 147665)
+++ testsuite/libffi.call/cls_align_sint16.c	(working copy)
@@ -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
===================================================================
--- testsuite/libffi.call/cls_align_uint32.c	(revision 147665)
+++ testsuite/libffi.call/cls_align_uint32.c	(working copy)
@@ -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_20byte.c
===================================================================
--- testsuite/libffi.call/cls_20byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_20byte.c	(working copy)
@@ -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_float.c
===================================================================
--- testsuite/libffi.call/cls_float.c	(revision 147665)
+++ testsuite/libffi.call/cls_float.c	(working copy)
@@ -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/nested_struct2.c
===================================================================
--- testsuite/libffi.call/nested_struct2.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct2.c	(working copy)
@@ -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/cls_5_1_byte.c
===================================================================
--- testsuite/libffi.call/cls_5_1_byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_5_1_byte.c	(working copy)
@@ -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/nested_struct4.c
===================================================================
--- testsuite/libffi.call/nested_struct4.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct4.c	(working copy)
@@ -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/cls_24byte.c
===================================================================
--- testsuite/libffi.call/cls_24byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_24byte.c	(working copy)
@@ -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/nested_struct6.c
===================================================================
--- testsuite/libffi.call/nested_struct6.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct6.c	(working copy)
@@ -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/cls_64byte.c
===================================================================
--- testsuite/libffi.call/cls_64byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_64byte.c	(working copy)
@@ -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/nested_struct8.c
===================================================================
--- testsuite/libffi.call/nested_struct8.c	(revision 147665)
+++ testsuite/libffi.call/nested_struct8.c	(working copy)
@@ -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/cls_uint.c
===================================================================
--- testsuite/libffi.call/cls_uint.c	(revision 147665)
+++ testsuite/libffi.call/cls_uint.c	(working copy)
@@ -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_multi_ushortchar.c
===================================================================
--- testsuite/libffi.call/cls_multi_ushortchar.c	(revision 147665)
+++ testsuite/libffi.call/cls_multi_ushortchar.c	(working copy)
@@ -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_schar.c
===================================================================
--- testsuite/libffi.call/cls_schar.c	(revision 147665)
+++ testsuite/libffi.call/cls_schar.c	(working copy)
@@ -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_uchar.c
===================================================================
--- testsuite/libffi.call/cls_uchar.c	(revision 147665)
+++ testsuite/libffi.call/cls_uchar.c	(working copy)
@@ -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_align_uint64.c
===================================================================
--- testsuite/libffi.call/cls_align_uint64.c	(revision 147665)
+++ testsuite/libffi.call/cls_align_uint64.c	(working copy)
@@ -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_ulonglong.c
===================================================================
--- testsuite/libffi.call/cls_ulonglong.c	(revision 147665)
+++ testsuite/libffi.call/cls_ulonglong.c	(working copy)
@@ -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_align_longdouble.c
===================================================================
--- testsuite/libffi.call/cls_align_longdouble.c	(revision 147665)
+++ testsuite/libffi.call/cls_align_longdouble.c	(working copy)
@@ -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_1_1byte.c
===================================================================
--- testsuite/libffi.call/cls_1_1byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_1_1byte.c	(working copy)
@@ -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_12byte.c
===================================================================
--- testsuite/libffi.call/cls_12byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_12byte.c	(working copy)
@@ -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_3_1byte.c
===================================================================
--- testsuite/libffi.call/cls_3_1byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_3_1byte.c	(working copy)
@@ -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
===================================================================
--- testsuite/libffi.call/cls_3byte1.c	(revision 147665)
+++ testsuite/libffi.call/cls_3byte1.c	(working copy)
@@ -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_4_1byte.c
===================================================================
--- testsuite/libffi.call/cls_4_1byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_4_1byte.c	(working copy)
@@ -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_6_1_byte.c
===================================================================
--- testsuite/libffi.call/cls_6_1_byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_6_1_byte.c	(working copy)
@@ -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_16byte.c
===================================================================
--- testsuite/libffi.call/cls_16byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_16byte.c	(working copy)
@@ -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
===================================================================
--- testsuite/libffi.call/cls_18byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_18byte.c	(working copy)
@@ -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/closure_fn0.c
===================================================================
--- testsuite/libffi.call/closure_fn0.c	(revision 147665)
+++ 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);
 
 }
 
@@ -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/cls_9byte2.c
===================================================================
--- testsuite/libffi.call/cls_9byte2.c	(revision 147665)
+++ testsuite/libffi.call/cls_9byte2.c	(working copy)
@@ -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/closure_fn2.c
===================================================================
--- testsuite/libffi.call/closure_fn2.c	(revision 147665)
+++ 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);
 }
 
@@ -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_fn4.c
===================================================================
--- testsuite/libffi.call/closure_fn4.c	(revision 147665)
+++ 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);
 
 }
 
@@ -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/cls_ushort.c
===================================================================
--- testsuite/libffi.call/cls_ushort.c	(revision 147665)
+++ testsuite/libffi.call/cls_ushort.c	(working copy)
@@ -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/closure_fn6.c
===================================================================
--- testsuite/libffi.call/closure_fn6.c	(revision 147665)
+++ 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);
 
 }
 
@@ -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/cls_5byte.c
===================================================================
--- testsuite/libffi.call/cls_5byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_5byte.c	(working copy)
@@ -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_align_pointer.c
===================================================================
--- testsuite/libffi.call/cls_align_pointer.c	(revision 147665)
+++ 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;
@@ -45,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;
@@ -87,14 +81,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);
+  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 %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: testsuite/libffi.call/cls_7byte.c
===================================================================
--- testsuite/libffi.call/cls_7byte.c	(revision 147665)
+++ testsuite/libffi.call/cls_7byte.c	(working copy)
@@ -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_align_sint32.c
===================================================================
--- testsuite/libffi.call/cls_align_sint32.c	(revision 147665)
+++ testsuite/libffi.call/cls_align_sint32.c	(working copy)
@@ -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.special/unwindtest.cc
===================================================================
--- testsuite/libffi.special/unwindtest.cc	(revision 147665)
+++ testsuite/libffi.special/unwindtest.cc	(working copy)
@@ -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: 3 bytes --]





^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 17:59               ` NightStrike
@ 2009-05-18 18:09                 ` Timothy Wall
  2009-05-18 18:41                   ` Andrew Haley
  0 siblings, 1 reply; 28+ messages in thread
From: Timothy Wall @ 2009-05-18 18:09 UTC (permalink / raw)
  To: NightStrike
  Cc: Dave Korn, Andrew Haley, gcc-patches, java-patches, libffi-discuss

There seem to be some win32 patches in sourceware libffi that aren't  
in gcc/libffi.  Probably some other things as well.

On May 18, 2009, at 1:59 PM, NightStrike wrote:

> On Mon, May 18, 2009 at 2:00 PM, Dave Korn
> <dave.korn.cygwin@googlemail.com> wrote:
>> Andrew Haley wrote:
>>> Dave Korn wrote:
>>>> Andrew Haley wrote:
>>>>
>>>>> The libffi ABI has changed?  Are you sure?
>>>>   No, I'm not clear, I'm repeating something I was told second- 
>>>> hand:
>>>>
>>>> http://www.cygwin.com/ml/cygwin-apps/2009-02/msg00051.html
>>>>
>>>>   Maybe I just meant that the API has changed, not the ABI?
>>>
>>> Neither have changed AFAIAA.  There are some updates and fixes in  
>>> gcc
>>> that are not yet in upstream libffi.
>>
>>  Ok, this is what I mean:
>>
>> admin@ubik /tmp/libffi/upstream
>> $ tail -2 /tmp/libffi/upstream/libffi-3.0.8/libtool-version
>> # CURRENT:REVISION:AGE
>> 5:9:0
>>
>> admin@ubik /tmp/libffi/upstream
>> $ tail -2 /gnu/gcc/gcc/libffi/libtool-version
>> # CURRENT:REVISION:AGE
>> 4:1:0
>
> Maybe it needs to be merged in both directions.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 18:09                 ` Timothy Wall
@ 2009-05-18 18:41                   ` Andrew Haley
  2009-05-18 19:00                     ` Timothy Wall
  0 siblings, 1 reply; 28+ messages in thread
From: Andrew Haley @ 2009-05-18 18:41 UTC (permalink / raw)
  To: Timothy Wall
  Cc: NightStrike, Dave Korn, gcc-patches, java-patches, libffi-discuss

Timothy Wall wrote:
> There seem to be some win32 patches in sourceware libffi that aren't in
> gcc/libffi.  Probably some other things as well.

I don't really see how: you saw the diff of the ChangeLog that I posted and
there were no changes in libffi but not in gcc.

Andrew.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 18:41                   ` Andrew Haley
@ 2009-05-18 19:00                     ` Timothy Wall
  2009-05-19  9:16                       ` Andrew Haley
  0 siblings, 1 reply; 28+ messages in thread
From: Timothy Wall @ 2009-05-18 19:00 UTC (permalink / raw)
  To: Andrew Haley
  Cc: NightStrike, Dave Korn, gcc-patches, java-patches, libffi-discuss

As I was applying the win64 patch to a checkout of gcc/libffi from  
SVN, I noticed some win32 stuff missing (i.e. exists in libffi/CVS but  
not in gcc/libffi).

Note that there's a separate ChangeLog.libffi in the sourceware libffi  
-- I think those are the changes in libffi not yet propagated to gcc  
(just guessing).

On May 18, 2009, at 2:41 PM, Andrew Haley wrote:

> Timothy Wall wrote:
>> There seem to be some win32 patches in sourceware libffi that  
>> aren't in
>> gcc/libffi.  Probably some other things as well.
>
> I don't really see how: you saw the diff of the ChangeLog that I  
> posted and
> there were no changes in libffi but not in gcc.
>
> Andrew.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-18 19:00                     ` Timothy Wall
@ 2009-05-19  9:16                       ` Andrew Haley
  2009-05-19 12:13                         ` Dave Korn
  2009-05-21 21:08                         ` NightStrike
  0 siblings, 2 replies; 28+ messages in thread
From: Andrew Haley @ 2009-05-19  9:16 UTC (permalink / raw)
  To: Timothy Wall
  Cc: NightStrike, Dave Korn, gcc-patches, java-patches, libffi-discuss

Timothy Wall wrote:
> As I was applying the win64 patch to a checkout of gcc/libffi from SVN,
> I noticed some win32 stuff missing (i.e. exists in libffi/CVS but not in
> gcc/libffi).
> 
> Note that there's a separate ChangeLog.libffi in the sourceware libffi
> -- I think those are the changes in libffi not yet propagated to gcc
> (just guessing).

Oh, ouch!  That explains it.  That really is a Bad Idea.

I intend to do the Big Merge, but at the moment Anthony Green doesn't
seem to be around to give the OK.  I'll try to find him.

Andrew.


> On May 18, 2009, at 2:41 PM, Andrew Haley wrote:
> 
>> Timothy Wall wrote:
>>> There seem to be some win32 patches in sourceware libffi that aren't in
>>> gcc/libffi.  Probably some other things as well.
>>
>> I don't really see how: you saw the diff of the ChangeLog that I
>> posted and
>> there were no changes in libffi but not in gcc.
>>
>> Andrew.
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-19  9:16                       ` Andrew Haley
@ 2009-05-19 12:13                         ` Dave Korn
  2009-05-21 21:08                         ` NightStrike
  1 sibling, 0 replies; 28+ messages in thread
From: Dave Korn @ 2009-05-19 12:13 UTC (permalink / raw)
  To: Andrew Haley
  Cc: Timothy Wall, NightStrike, Dave Korn, gcc-patches, java-patches,
	libffi-discuss

Andrew Haley wrote:

> Oh, ouch!  That explains it.  That really is a Bad Idea.
> 
> I intend to do the Big Merge, 

  Thanks very much, getting these two in sync will mean I can get rid of an
ugly bit of hackery in the cygwin distro compiler to support parallel installs
of both versions :)

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-19  9:16                       ` Andrew Haley
  2009-05-19 12:13                         ` Dave Korn
@ 2009-05-21 21:08                         ` NightStrike
  2009-05-22  8:54                           ` Andrew Haley
  1 sibling, 1 reply; 28+ messages in thread
From: NightStrike @ 2009-05-21 21:08 UTC (permalink / raw)
  To: Andrew Haley
  Cc: Timothy Wall, Dave Korn, gcc-patches, java-patches, libffi-discuss

On Tue, May 19, 2009 at 5:16 AM, Andrew Haley <aph@redhat.com> wrote:
> Timothy Wall wrote:
>> As I was applying the win64 patch to a checkout of gcc/libffi from SVN,
>> I noticed some win32 stuff missing (i.e. exists in libffi/CVS but not in
>> gcc/libffi).
>>
>> Note that there's a separate ChangeLog.libffi in the sourceware libffi
>> -- I think those are the changes in libffi not yet propagated to gcc
>> (just guessing).
>
> Oh, ouch!  That explains it.  That really is a Bad Idea.
>
> I intend to do the Big Merge, but at the moment Anthony Green doesn't
> seem to be around to give the OK.  I'll try to find him.

When are you planning to do this?  I want to time some other changes
in my personal repo with this change.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-21 21:08                         ` NightStrike
@ 2009-05-22  8:54                           ` Andrew Haley
  2009-05-22 12:01                             ` Dave Korn
  0 siblings, 1 reply; 28+ messages in thread
From: Andrew Haley @ 2009-05-22  8:54 UTC (permalink / raw)
  To: NightStrike
  Cc: Timothy Wall, Dave Korn, gcc-patches, java-patches, libffi-discuss

NightStrike wrote:
> On Tue, May 19, 2009 at 5:16 AM, Andrew Haley <aph@redhat.com> wrote:
>> Timothy Wall wrote:
>>> As I was applying the win64 patch to a checkout of gcc/libffi from SVN,
>>> I noticed some win32 stuff missing (i.e. exists in libffi/CVS but not in
>>> gcc/libffi).
>>>
>>> Note that there's a separate ChangeLog.libffi in the sourceware libffi
>>> -- I think those are the changes in libffi not yet propagated to gcc
>>> (just guessing).
>> Oh, ouch!  That explains it.  That really is a Bad Idea.
>>
>> I intend to do the Big Merge, but at the moment Anthony Green doesn't
>> seem to be around to give the OK.  I'll try to find him.
> 
> When are you planning to do this?  I want to time some other changes
> in my personal repo with this change.

Today, if I have time, otherwise next week.

Andrew.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-22  8:54                           ` Andrew Haley
@ 2009-05-22 12:01                             ` Dave Korn
  2009-05-22 13:01                               ` Andrew Haley
  0 siblings, 1 reply; 28+ messages in thread
From: Dave Korn @ 2009-05-22 12:01 UTC (permalink / raw)
  To: Andrew Haley
  Cc: NightStrike, Timothy Wall, Dave Korn, gcc-patches, java-patches,
	libffi-discuss

Andrew Haley wrote:
> NightStrike wrote:

>> When are you planning to do this?  I want to time some other changes
>> in my personal repo with this change.
> 
> Today, if I have time, otherwise next week.

  I have an outstanding patch to libffi/src/x86/win32.S

http://gcc.gnu.org/ml/java-patches/2009-q2/msg00084.html

  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?

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-22 12:01                             ` Dave Korn
@ 2009-05-22 13:01                               ` Andrew Haley
  2009-05-22 13:53                                 ` Dave Korn
  0 siblings, 1 reply; 28+ messages in thread
From: Andrew Haley @ 2009-05-22 13:01 UTC (permalink / raw)
  To: Dave Korn
  Cc: NightStrike, Timothy Wall, gcc-patches, java-patches, libffi-discuss

Dave Korn wrote:
> Andrew Haley wrote:
>> NightStrike wrote:
> 
>>> When are you planning to do this?  I want to time some other changes
>>> in my personal repo with this change.
>> Today, if I have time, otherwise next week.
> 
>   I have an outstanding patch to libffi/src/x86/win32.S
> 
> http://gcc.gnu.org/ml/java-patches/2009-q2/msg00084.html

Please commit 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?

Yes.  Consider it pre-approved.

Andrew.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-22 13:01                               ` Andrew Haley
@ 2009-05-22 13:53                                 ` Dave Korn
  2009-05-22 14:02                                   ` Andrew Haley
  2009-05-22 14:42                                   ` Timothy Wall
  0 siblings, 2 replies; 28+ messages in thread
From: Dave Korn @ 2009-05-22 13:53 UTC (permalink / raw)
  To: Andrew Haley
  Cc: Dave Korn, NightStrike, Timothy Wall, gcc-patches, java-patches,
	libffi-discuss

Andrew Haley wrote:
> Dave Korn wrote:
>> Andrew Haley wrote:
>>> NightStrike wrote:
>>>> When are you planning to do this?  I want to time some other changes
>>>> in my personal repo with this change.
>>> Today, if I have time, otherwise next week.
>>   I have an outstanding patch to libffi/src/x86/win32.S
>>
>> http://gcc.gnu.org/ml/java-patches/2009-q2/msg00084.html
> 
> Please commit this.

  Two things:

a)  Tests not quite finished yet, but fixed lots of FAILs.  Only other change:

-FAIL: Thread_Wait_2 -findirect-dispatch output - source compiled test
-FAIL: Thread_Wait_Interrupt output - source compiled test
+FAIL: Thread_Interrupt -findirect-dispatch output - source compiled test
+FAIL: Thread_Wait_2 output - source compiled test
+FAIL: Thread_Wait_Interrupt -O3 -findirect-dispatch output - source compiled test

... which I think is probably noise.  The Process_N tests all hang, I think
there is a bug somewhere in the underlying cygwin pthread support (there is
some ever-present noise in libstdc++ tests relating to mutexes as well, which
supports this theory).

b)  Just the libffi, or both parts?  I haven't tested the libjava
runtimeInitialized change separately.

>>   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?
> 
> Yes.  Consider it pre-approved.

  Thanks, under way.  I think I have to duplicate out the function tail-end
code that the current upstream version shares with _ffi_closure_SYSV (from
.Lcls_return_result on) because as far as I've been able to figure out so far,
we can't represent shared/overlapping ranges like this in FDEs.  It's not a
huge amount of code, but if you do happen to know a way to do it, please send
me a pointer, or confirm that it's still OK with the code duplication.

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-22 13:53                                 ` Dave Korn
@ 2009-05-22 14:02                                   ` Andrew Haley
  2009-05-22 14:16                                     ` Dave Korn
  2009-05-22 14:42                                   ` Timothy Wall
  1 sibling, 1 reply; 28+ messages in thread
From: Andrew Haley @ 2009-05-22 14:02 UTC (permalink / raw)
  To: Dave Korn
  Cc: NightStrike, Timothy Wall, gcc-patches, java-patches, libffi-discuss

Dave Korn wrote:
> Andrew Haley wrote:
>> Dave Korn wrote:
>>> Andrew Haley wrote:
>>>> NightStrike wrote:
>>>>> When are you planning to do this?  I want to time some other changes
>>>>> in my personal repo with this change.
>>>> Today, if I have time, otherwise next week.
>>>   I have an outstanding patch to libffi/src/x86/win32.S
>>>
>>> http://gcc.gnu.org/ml/java-patches/2009-q2/msg00084.html
>> Please commit this.
> 
>   Two things:
> 
> a)  Tests not quite finished yet, but fixed lots of FAILs.  Only other change:
> 
> -FAIL: Thread_Wait_2 -findirect-dispatch output - source compiled test
> -FAIL: Thread_Wait_Interrupt output - source compiled test
> +FAIL: Thread_Interrupt -findirect-dispatch output - source compiled test
> +FAIL: Thread_Wait_2 output - source compiled test
> +FAIL: Thread_Wait_Interrupt -O3 -findirect-dispatch output - source compiled test
> 
> ... which I think is probably noise.  The Process_N tests all hang, I think
> there is a bug somewhere in the underlying cygwin pthread support (there is
> some ever-present noise in libstdc++ tests relating to mutexes as well, which
> supports this theory).

OK.

> b)  Just the libffi, or both parts?  I haven't tested the libjava
> runtimeInitialized change separately.

Doesn't this change fix the early failure in throwing an exception?
If not, please don't check it in.

>>>   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?
>> Yes.  Consider it pre-approved.
> 
>   Thanks, under way.  I think I have to duplicate out the function tail-end
> code that the current upstream version shares with _ffi_closure_SYSV (from
> .Lcls_return_result on) because as far as I've been able to figure out so far,
> we can't represent shared/overlapping ranges like this in FDEs.  It's not a
> huge amount of code, but if you do happen to know a way to do it, please send
> me a pointer, or confirm that it's still OK with the code duplication.

Duplication is fine.

Andrew.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-22 14:02                                   ` Andrew Haley
@ 2009-05-22 14:16                                     ` Dave Korn
  0 siblings, 0 replies; 28+ messages in thread
From: Dave Korn @ 2009-05-22 14:16 UTC (permalink / raw)
  To: Andrew Haley
  Cc: Dave Korn, NightStrike, Timothy Wall, gcc-patches, java-patches,
	libffi-discuss

Andrew Haley wrote:
> Dave Korn wrote:

>> b)  Just the libffi, or both parts?  I haven't tested the libjava
>> runtimeInitialized change separately.
> 
> Doesn't this change fix the early failure in throwing an exception?
> If not, please don't check it in.

  I thought it did, but couldn't then reproduce the crash I had previously had
when I tried manually setting runtimeInitialized at runtime in the debugger,
so it could have been pilot error in the debugger.  I'll leave that bit out
for now and verify it separately.

    cheers,
      DaveK

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH] win64 support for libffi (2/2)
  2009-05-22 13:53                                 ` Dave Korn
  2009-05-22 14:02                                   ` Andrew Haley
@ 2009-05-22 14:42                                   ` Timothy Wall
  1 sibling, 0 replies; 28+ messages in thread
From: Timothy Wall @ 2009-05-22 14:42 UTC (permalink / raw)
  To: Dave Korn
  Cc: Andrew Haley, NightStrike, gcc-patches, java-patches, libffi-discuss


On May 22, 2009, at 10:04 AM, Dave Korn wrote:

>
>  Thanks, under way.  I think I have to duplicate out the function  
> tail-end
> code that the current upstream version shares with _ffi_closure_SYSV  
> (from
> .Lcls_return_result on) because as far as I've been able to figure  
> out so far,
> we can't represent shared/overlapping ranges like this in FDEs.   
> It's not a
> huge amount of code, but if you do happen to know a way to do it,  
> please send
> me a pointer, or confirm that it's still OK with the code duplication.

I notice now that the STDCALL version only differs from the SYSV code  
by a different offset in only one instruction, since the trampoline  
has to do a call instead of a jmp in order to have control over the  
"ret" instruction.

oh well, it's not like that code is likely to change anytime soon.

T.

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2009-05-22 14:42 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <635C3243-B89E-460E-9C0F-209308D89729@dev.java.net>
     [not found] ` <b609cb3b0905171605tc6a10b7u683c43a99f97382f@mail.gmail.com>
     [not found]   ` <4A109F74.6060108@gmail.com>
2009-05-17 23:49     ` [PATCH] win64 support for libffi (2/2) Timothy Wall
2009-05-17 23:51       ` NightStrike
2009-05-18  9:36       ` Andrew Haley
2009-05-18  9:41         ` Richard Guenther
2009-05-18 10:16           ` Andrew Haley
2009-05-18 14:46         ` Dave Korn
2009-05-18 14:59           ` Andrew Haley
2009-05-18 15:06             ` Dave Korn
2009-05-18 17:48             ` Dave Korn
2009-05-18 17:59               ` NightStrike
2009-05-18 18:09                 ` Timothy Wall
2009-05-18 18:41                   ` Andrew Haley
2009-05-18 19:00                     ` Timothy Wall
2009-05-19  9:16                       ` Andrew Haley
2009-05-19 12:13                         ` Dave Korn
2009-05-21 21:08                         ` NightStrike
2009-05-22  8:54                           ` Andrew Haley
2009-05-22 12:01                             ` Dave Korn
2009-05-22 13:01                               ` Andrew Haley
2009-05-22 13:53                                 ` Dave Korn
2009-05-22 14:02                                   ` Andrew Haley
2009-05-22 14:16                                     ` Dave Korn
2009-05-22 14:42                                   ` Timothy Wall
2009-05-18 10:12 ` Andrew Haley
2009-05-18 12:26   ` Timothy Wall
2009-05-18 14:37     ` Andrew Haley
2009-05-18 15:31       ` Timothy Wall
2009-05-18 18:06       ` Timothy Wall

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).