AArch64 port
authorAnthony Green <green@moxielogic.com>
Tue, 30 Oct 2012 11:07:19 +0000 (07:07 -0400)
committerAnthony Green <green@moxielogic.com>
Tue, 30 Oct 2012 11:36:49 +0000 (07:36 -0400)
38 files changed:
.pc/aarch64/.timestamp [new file with mode: 0644]
.pc/aarch64/ChangeLog [new file with mode: 0644]
.pc/aarch64/README [new file with mode: 0644]
.pc/aarch64/src/aarch64/ffi.c [new file with mode: 0644]
.pc/aarch64/src/aarch64/ffitarget.h [new file with mode: 0644]
.pc/aarch64/src/aarch64/sysv.S [new file with mode: 0644]
.pc/aarch64/testsuite/lib/libffi.exp [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/cls_struct_va1.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/cls_uchar_va.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/cls_uint_va.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/cls_ulong_va.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/cls_ushort_va.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/nested_struct11.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/uninitialized.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/va_1.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/va_struct1.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/va_struct2.c [new file with mode: 0644]
.pc/aarch64/testsuite/libffi.call/va_struct3.c [new file with mode: 0644]
.pc/applied-patches
ChangeLog
README
patches/aarch64 [new file with mode: 0644]
patches/series
src/aarch64/ffi.c [new file with mode: 0644]
src/aarch64/ffitarget.h [new file with mode: 0644]
src/aarch64/sysv.S [new file with mode: 0644]
testsuite/lib/libffi.exp
testsuite/libffi.call/cls_struct_va1.c [new file with mode: 0644]
testsuite/libffi.call/cls_uchar_va.c [new file with mode: 0644]
testsuite/libffi.call/cls_uint_va.c [new file with mode: 0644]
testsuite/libffi.call/cls_ulong_va.c [new file with mode: 0644]
testsuite/libffi.call/cls_ushort_va.c [new file with mode: 0644]
testsuite/libffi.call/nested_struct11.c [new file with mode: 0644]
testsuite/libffi.call/uninitialized.c [new file with mode: 0644]
testsuite/libffi.call/va_1.c [new file with mode: 0644]
testsuite/libffi.call/va_struct1.c [new file with mode: 0644]
testsuite/libffi.call/va_struct2.c [new file with mode: 0644]
testsuite/libffi.call/va_struct3.c [new file with mode: 0644]

diff --git a/.pc/aarch64/.timestamp b/.pc/aarch64/.timestamp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/ChangeLog b/.pc/aarch64/ChangeLog
new file mode 100644 (file)
index 0000000..596609c
--- /dev/null
@@ -0,0 +1,5120 @@
+2012-10-12  Walter Lee  <walt@tilera.com>
+
+        * Makefile.am: Add TILE-Gx/TILEPro support.
+        * configure.ac: Likewise.
+        * Makefile.in: Regenerate.
+        * configure: Likewise.
+        * src/prep_cif.c (ffi_prep_cif_core): Handle TILE-Gx/TILEPro.
+        * src/tile: New directory.
+        * src/tile/ffi.c: New file.
+        * src/tile/ffitarget.h: Ditto.
+        * src/tile/tile.S: Ditto.
+
+2012-10-12  Matthias Klose  <doko@ubuntu.com>
+
+       * generate-osx-source-and-headers.py: Normalize whitespace.
+
+2012-09-14  David Edelsohn  <dje.gcc@gmail.com>
+
+       * configure: Regenerated.
+
+2012-08-26  Andrew Pinski  <apinski@cavium.com>
+
+       PR libffi/53014
+       * src/mips/ffi.c (ffi_prep_closure_loc): Allow n32 with soft-float and n64 with
+       soft-float.
+
+2012-08-08  Uros Bizjak  <ubizjak@gmail.com>
+
+       * src/s390/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
+       just return FFI_BAD_ABI when things are wrong.
+
+2012-07-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR libffi/53982
+       PR libffi/53973
+       * src/x86/ffitarget.h: Check __ILP32__ instead of __LP64__ for x32.
+       (FFI_SIZEOF_JAVA_RAW): Defined to 4 for x32.
+
+2012-05-16  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * configure: Regenerated.
+
+2012-05-05  Nicolas Lelong
+
+       * libffi.xcodeproj/project.pbxproj: Fixes.
+       * README: Update for iOS builds.
+
+2012-04-23  Alexandre Keunecke I. de Mendonca <alexandre.keunecke@gmail.com>
+
+       * configure.ac: Add Blackfin/sysv support
+       * Makefile.am: Add Blackfin/sysv support
+       * src/bfin/ffi.c:  Add Blackfin/sysv support
+       * src/bfin/ffitarget.h: Add Blackfin/sysv support
+
+2012-04-11  Anthony Green  <green@moxielogic.com>
+
+       * Makefile.am (EXTRA_DIST): Add new script.
+       * Makefile.in: Rebuilt.
+
+2012-04-11  Zachary Waldowski  <zwaldowski@gmail.com>
+
+       * generate-ios-source-and-headers.py,
+       libffi.xcodeproj/project.pbxproj: Support a Mac static library via
+       Xcode. Set iOS compatibility to 4.0.  Move iOS trampoline
+       generation into an Xcode "run script" phase.  Include both as
+       Xcode build scripts. Don't always regenerate config files.
+
+2012-04-10  Anthony Green  <green@moxielogic.com>
+
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Add missing semicolon.
+
+2012-04-06  Anthony Green  <green@moxielogic.com>
+
+       * Makefile.am (EXTRA_DIST): Add new iOS/xcode files.
+       * Makefile.in: Rebuilt.
+
+2012-04-06  Mike Lewis  <mikelikespie@gmail.com>
+
+       * generate-ios-source-and-headers.py: New file.
+       * libffi.xcodeproj/project.pbxproj: New file.
+       * README: Update instructions on building iOS binary.
+       * build-ios.sh: Delete.
+
+2012-04-06  Anthony Green  <green@moxielogic.com>
+
+       * src/x86/ffi64.c (UINT128): Define differently for Intel and GNU
+       compilers, then use it.
+
+2012-04-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * m4/libtool.m4 (_LT_ENABLE_LOCK): Support x32.
+
+2012-04-06  Anthony Green  <green@moxielogic.com>
+
+       * testsuite/Makefile.am (EXTRA_DIST): Add missing test cases.
+       * testsuite/Makefile.in: Rebuilt.
+
+2012-04-05  Zachary Waldowski  <zwaldowski@gmail.com>
+
+       * include/ffi.h.in: Add missing trampoline table fields.
+       * src/arm/sysv.S: Fix ENTRY definition, and wrap symbol references
+       in CNAME.
+       * src/x86/ffi.c: Wrap Windows specific code in ifdefs.
+
+2012-03-29  Peter Rosin  <peda@lysator.liu.se>
+
+       * src/x86/win32.S (ffi_closure_raw_THISCALL): Unify the frame
+       generation, fix the ENDP label and remove the surplus third arg
+       from the 'lea' insn.
+
+2012-03-29  Peter Rosin  <peda@lysator.liu.se>
+
+       * src/x86/win32.S (ffi_closure_raw_SYSV): Make the 'stubraw' label
+       visible outside the PROC, so that ffi_closure_raw_THISCALL can see
+       it.  Also instruct the assembler to add a frame to the function.
+
+2012-03-23  Peter Rosin  <peda@lysator.liu.se>
+
+       * Makefile.am (AM_CPPFLAGS): Add -DFFI_BUILDING.
+       * Makefile.in: Rebuilt.
+       * include/ffi.h.in [MSVC]: Add __declspec(dllimport) decorations
+       to all data exports, when compiling libffi clients using MSVC.
+
+2012-03-29  Peter Rosin  <peda@lysator.liu.se>
+
+       * src/x86/ffitarget.h (ffi_abi): Add new ABI FFI_MS_CDECL and
+       make it the default for MSVC.
+       (FFI_TYPE_MS_STRUCT): New structure return convention.
+       * src/x86/ffi.c (ffi_prep_cif_machdep): Tweak the structure
+       return convention for FFI_MS_CDECL to be FFI_TYPE_MS_STRUCT
+       instead of an ordinary FFI_TYPE_STRUCT.
+       (ffi_prep_args): Treat FFI_TYPE_MS_STRUCT as FFI_TYPE_STRUCT.
+       (ffi_call): Likewise.
+       (ffi_prep_incoming_args_SYSV): Likewise.
+       (ffi_raw_call): Likewise.
+       (ffi_prep_closure_loc): Treat FFI_MS_CDECL as FFI_SYSV.
+       * src/x86/win32.S (ffi_closure_SYSV): For FFI_TYPE_MS_STRUCT,
+       return a pointer to the result structure in eax and don't pop
+       that pointer from the stack, the caller takes care of it.
+       (ffi_call_win32): Treat FFI_TYPE_MS_STRUCT as FFI_TYPE_STRUCT.
+       (ffi_closure_raw_SYSV): Likewise.
+
+2012-03-22  Peter Rosin  <peda@lysator.liu.se>
+
+       * testsuite/libffi.call/closure_stdcall.c [MSVC]: Add inline
+       assembly version with Intel syntax.
+       * testsuite/libffi.call/closure_thiscall.c [MSVC]: Likewise.
+
+2012-03-23  Peter Rosin  <peda@lysator.liu.se>
+
+       * testsuite/libffi.call/ffitest.h: Provide abstration of
+       __attribute__((fastcall)) in the form of a __FASTCALL__
+       define.  Define it to __fastcall for MSVC.
+       * testsuite/libffi.call/fastthis1_win32.c: Use the above.
+       * testsuite/libffi.call/fastthis2_win32.c: Likewise.
+       * testsuite/libffi.call/fastthis3_win32.c: Likewise.
+       * testsuite/libffi.call/strlen2_win32.c: Likewise.
+       * testsuite/libffi.call/struct1_win32.c: Likewise.
+       * testsuite/libffi.call/struct2_win32.c: Likewise.
+
+2012-03-22  Peter Rosin  <peda@lysator.liu.se>
+
+       * src/x86/win32.S [MSVC] (ffi_closure_THISCALL): Remove the manual
+       frame on function entry, MASM adds one automatically.
+
+2012-03-22  Peter Rosin  <peda@lysator.liu.se>
+
+       * testsuite/libffi.call/ffitest.h [MSVC]: Add kludge for missing
+       bits in the MSVC headers.
+
+2012-03-22  Peter Rosin  <peda@lysator.liu.se>
+
+       * testsuite/libffi.call/cls_12byte.c: Adjust to the C89 style
+       with no declarations after statements.
+       * testsuite/libffi.call/cls_16byte.c: Likewise.
+       * testsuite/libffi.call/cls_18byte.c: Likewise.
+       * testsuite/libffi.call/cls_19byte.c: Likewise.
+       * testsuite/libffi.call/cls_1_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte1.c: Likewise.
+       * testsuite/libffi.call/cls_24byte.c: Likewise.
+       * testsuite/libffi.call/cls_2byte.c: Likewise.
+       * testsuite/libffi.call/cls_3_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_3byte1.c: Likewise.
+       * testsuite/libffi.call/cls_3byte2.c: Likewise.
+       * testsuite/libffi.call/cls_4_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_4byte.c: Likewise.
+       * testsuite/libffi.call/cls_5_1_byte.c: Likewise.
+       * testsuite/libffi.call/cls_5byte.c: Likewise.
+       * testsuite/libffi.call/cls_64byte.c: Likewise.
+       * testsuite/libffi.call/cls_6_1_byte.c: Likewise.
+       * testsuite/libffi.call/cls_6byte.c: Likewise.
+       * testsuite/libffi.call/cls_7_1_byte.c: Likewise.
+       * testsuite/libffi.call/cls_7byte.c: Likewise.
+       * testsuite/libffi.call/cls_8byte.c: Likewise.
+       * testsuite/libffi.call/cls_9byte1.c: Likewise.
+       * testsuite/libffi.call/cls_9byte2.c: Likewise.
+       * testsuite/libffi.call/cls_align_double.c: Likewise.
+       * testsuite/libffi.call/cls_align_float.c: Likewise.
+       * testsuite/libffi.call/cls_align_longdouble.c: Likewise.
+       * testsuite/libffi.call/cls_align_longdouble_split.c: Likewise.
+       * testsuite/libffi.call/cls_align_longdouble_split2.c: Likewise.
+       * testsuite/libffi.call/cls_align_pointer.c: Likewise.
+       * testsuite/libffi.call/cls_align_sint16.c: Likewise.
+       * testsuite/libffi.call/cls_align_sint32.c: Likewise.
+       * testsuite/libffi.call/cls_align_sint64.c: Likewise.
+       * testsuite/libffi.call/cls_align_uint16.c: Likewise.
+       * testsuite/libffi.call/cls_align_uint32.c: Likewise.
+       * testsuite/libffi.call/cls_align_uint64.c: Likewise.
+       * testsuite/libffi.call/cls_dbls_struct.c: Likewise.
+       * testsuite/libffi.call/cls_pointer_stack.c: Likewise.
+       * testsuite/libffi.call/err_bad_typedef.c: Likewise.
+       * testsuite/libffi.call/huge_struct.c: Likewise.
+       * testsuite/libffi.call/nested_struct.c: Likewise.
+       * testsuite/libffi.call/nested_struct1.c: Likewise.
+       * testsuite/libffi.call/nested_struct10.c: Likewise.
+       * testsuite/libffi.call/nested_struct2.c: Likewise.
+       * testsuite/libffi.call/nested_struct3.c: Likewise.
+       * testsuite/libffi.call/nested_struct4.c: Likewise.
+       * testsuite/libffi.call/nested_struct5.c: Likewise.
+       * testsuite/libffi.call/nested_struct6.c: Likewise.
+       * testsuite/libffi.call/nested_struct7.c: Likewise.
+       * testsuite/libffi.call/nested_struct8.c: Likewise.
+       * testsuite/libffi.call/nested_struct9.c: Likewise.
+       * testsuite/libffi.call/stret_large.c: Likewise.
+       * testsuite/libffi.call/stret_large2.c: Likewise.
+       * testsuite/libffi.call/stret_medium.c: Likewise.
+       * testsuite/libffi.call/stret_medium2.c: Likewise.
+       * testsuite/libffi.call/struct1.c: Likewise.
+       * testsuite/libffi.call/struct1_win32.c: Likewise.
+       * testsuite/libffi.call/struct2.c: Likewise.
+       * testsuite/libffi.call/struct2_win32.c: Likewise.
+       * testsuite/libffi.call/struct3.c: Likewise.
+       * testsuite/libffi.call/struct4.c: Likewise.
+       * testsuite/libffi.call/struct5.c: Likewise.
+       * testsuite/libffi.call/struct6.c: Likewise.
+       * testsuite/libffi.call/struct7.c: Likewise.
+       * testsuite/libffi.call/struct8.c: Likewise.
+       * testsuite/libffi.call/struct9.c: Likewise.
+       * testsuite/libffi.call/testclosure.c: Likewise.
+
+2012-03-21  Peter Rosin         <peda@lysator.liu.se>
+
+       * testsuite/libffi.call/float_va.c (float_va_fn): Use %f when
+       printing doubles (%lf is for long doubles).
+       (main): Likewise.
+
+2012-03-21  Peter Rosin  <peda@lysator.liu.se>
+
+       * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*]
+       (set_ld_library_path_env_vars): Add the library search dir to PATH
+       (and save PATH for later).
+       (restore_ld_library_path_env_vars): Restore PATH.
+
+2012-03-20  Peter Rosin  <peda@lysator.liu.se>
+
+       * testsuite/libffi.call/strlen2_win32.c (main): Remove bug.
+       * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label
+       visible outside the PROC, so that ffi_closure_THISCALL can see it.
+
+2012-03-20  Peter Rosin  <peda@lysator.liu.se>
+
+       * testsuite/libffi.call/strlen2_win32.c (main): Remove bug.
+       * src/x86/win32.S [MSVC] (ffi_closure_SYSV): Make the 'stub' label
+       visible outside the PROC, so that ffi_closure_THISCALL can see it.
+
+2012-03-19  Alan Hourihane  <alanh@fairlite.co.uk>
+
+       * src/m68k/ffi.c: Add MINT support.
+       * src/m68k/sysv.S: Ditto.
+
+2012-03-19  chennam  <csit@axway.com>
+
+       * src/powerpc/ffi_darwin.c (ffi_prep_closure_loc): Fix AIX closure
+       support.
+
+2012-03-06  Chung-Lin Tang  <cltang@codesourcery.com>
+
+       * src/arm/ffi.c (ffi_call): Add __ARM_EABI__ guard around call to
+       ffi_call_VFP().
+       (ffi_prep_closure_loc): Add __ARM_EABI__ guard around use of
+       ffi_closure_VFP.
+       * src/arm/sysv.S: Add __ARM_EABI__ guard around VFP code.
+
+2012-04-02  Peter Bergner  <bergner@vnet.ibm.com>
+
+       * src/powerpc/ffi.c (ffi_prep_args_SYSV): Declare double_tmp.
+       Silence casting pointer to integer of different size warning.
+       Delete goto to previously deleted label.
+       (ffi_call): Silence possibly undefined warning.
+       (ffi_closure_helper_SYSV): Declare variable type.
+
+2012-04-02  Peter Rosin  <peda@lysator.liu.se>
+
+       * src/x86/win32.S (ffi_call_win32): Sign/zero extend the return
+       value in the Intel version as is already done for the AT&T version.
+       (ffi_closure_SYSV): Likewise.
+       (ffi_closure_raw_SYSV): Likewise.
+       (ffi_closure_STDCALL): Likewise.
+
+2012-03-13  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
+       just return FFI_BAD_ABI when things are wrong.
+       * src/sh64/ffi.c (ffi_prep_closure_loc): Ditto.
+
+2012-03-09  David Edelsohn  <dje.gcc@gmail.com>
+
+       * src/powerpc/aix_closure.S (ffi_closure_ASM): Adjust for Darwin64
+       change to return value of ffi_closure_helper_DARWIN and load type
+       from return type.
+
+2012-03-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * src/x86/ffi64.c (ffi_call): Cast the return value to unsigned
+       long.
+       (ffi_prep_closure_loc): Cast to 64bit address in trampoline.
+       (ffi_closure_unix64_inner): Cast return pointer to unsigned long
+       first.
+
+       * src/x86/ffitarget.h (FFI_SIZEOF_ARG): Defined to 8 for x32.
+       (ffi_arg): Set to unsigned long long for x32.
+       (ffi_sarg): Set to long long for x32.
+
+2012-03-03  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * src/prep_cif.c (ffi_prep_cif_core): Properly check bad ABI.
+
+2012-03-03  Andoni Morales Alastruey  <ylatuya@gmail.com>
+
+       * configure.ac: Add -no-undefined for both 32- and 64-bit x86
+       windows-like hosts.
+       * configure: Rebuilt.
+
+2012-02-27  Mikael Pettersson  <mikpe@it.uu.se>
+
+       PR libffi/52223
+       * Makefile.am (FLAGS_TO_PASS): Define.
+       * Makefile.in: Regenerate.
+
+2012-02-23  Anthony Green  <green@moxielogic.com>
+
+       * src/*/ffitarget.h: Ensure that users never include ffitarget.h
+       directly.
+
+2012-02-23  Kai Tietz  <ktietz@redhat.com>
+
+       PR libffi/52221
+       * src/x86/ffi.c (ffi_closure_raw_THISCALL): New
+       prototype.
+       (ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
+       thiscall-convention.
+       (ffi_raw_call): Use ffi_prep_args_raw.
+       * src/x86/win32.S (ffi_closure_raw_THISCALL): Add
+       implementation for stub.
+
+2012-02-10  Kai Tietz  <ktietz@redhat.com>
+
+       * configure.ac (AM_LTLDFLAGS): Add -no-undefine for x64
+       windows target.
+       * configure: Regenerated.
+
+2012-02-08  Kai Tietz  <ktietz@redhat.com>
+
+       * src/prep_cif.c (ffi_prep_cif): Allow for X86_WIN32
+       also FFI_THISCALL.
+       * src/x86/ffi.c (ffi_closure_THISCALL): Add prototype.
+       (FFI_INIT_TRAMPOLINE_THISCALL): New trampoline code.
+       (ffi_prep_closure_loc): Add FFI_THISCALL support.
+       * src/x86/ffitarget.h (FFI_TRAMPOLINE_SIZE): Adjust size.
+       * src/x86/win32.S (ffi_closure_THISCALL): New closure code
+       for thiscall-calling convention.
+       * testsuite/libffi.call/closure_thiscall.c: New test.
+
+2012-01-28  Kai Tietz  <ktietz@redhat.com>
+
+       * src/libffi/src/x86/ffi.c (ffi_call_win32): Add new
+       argument to prototype for specify calling-convention.
+       (ffi_call): Add support for stdcall/thiscall convention.
+       (ffi_prep_args): Likewise.
+       (ffi_raw_call): Likewise.
+       * src/x86/ffitarget.h (ffi_abi): Add FFI_THISCALL and
+       FFI_FASTCALL.
+       * src/x86/win32.S (_ffi_call_win32): Add support for
+       fastcall/thiscall calling-convention calls.
+       * testsuite/libffi.call/fastthis1_win32.c: New test.
+       * testsuite/libffi.call/fastthis2_win32.c: New test.
+       * testsuite/libffi.call/fastthis3_win32.c: New test.
+       * testsuite/libffi.call/strlen2_win32.c: New test.
+       * testsuite/libffi.call/many2_win32.c: New test.
+       * testsuite/libffi.call/struct1_win32.c: New test.
+       * testsuite/libffi.call/struct2_win32.c: New test.
+
+2012-01-23  Uros Bizjak  <ubizjak@gmail.com>
+
+       * src/alpha/ffi.c (ffi_prep_closure_loc): Check for bad ABI.
+
+2012-01-23  Anthony Green  <green@moxielogic.com>
+           Chris Young  <cdyoung@ntlworld.com>
+
+       * configure.ac: Add Amiga support.
+       * configure: Rebuilt.
+
+2012-01-23  Dmitry Nadezhin  <dmitry.nadezhin@gmail.com>
+
+       * include/ffi_common.h (LIKELY, UNLIKELY): Fix definitions.
+
+2012-01-23  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * src/m68k/sysv.S (ffi_call_SYSV): Properly test for plain
+       mc68000.  Test for __HAVE_68881__ in addition to __MC68881__.
+
+2012-01-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/48496
+       * src/ia64/ffi.c (ffi_call): Fix up aliasing violations.
+
+2012-01-09  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * configure.ac (i?86-*-*): Set TARGET to X86_64.
+       * configure: Regenerate.
+
+2011-12-07  Andrew Pinski  <apinski@cavium.com>
+
+       PR libffi/50051
+       * src/mips/n32.S: Add ".set mips4".
+
+2011-11-21  Andreas Tobler  <andreast@fgznet.ch>
+
+       * configure: Regenerate.
+
+2011-11-12  David Gilbert <david.gilbert@linaro.org>
+
+       * doc/libffi.texi, include/ffi.h.in, include/ffi_common.h,
+       man/Makefile.am, man/ffi.3, man/ffi_prep_cif.3,
+       man/ffi_prep_cif_var.3, src/arm/ffi.c, src/arm/ffitarget.h,
+       src/cris/ffi.c, src/prep_cif.c,
+       testsuite/libffi.call/cls_double_va.c,
+       testsuite/libffi.call/cls_longdouble_va.c,
+       testsuite/libffi.call/float_va.c: Many changes to support variadic
+       function calls.
+
+2011-11-12  Kyle Moffett <Kyle.D.Moffett@boeing.com>
+
+       * src/powerpc/ffi.c, src/powerpc/ffitarget.h,
+       src/powerpc/ppc_closure.S, src/powerpc/sysv.S: Many changes for
+       softfloat powerpc variants.
+
+2011-11-12  Petr Salinger <Petr.Salinger@seznam.cz>
+
+       * configure.ac (FFI_EXEC_TRAMPOLINE_TABLE): Fix kfreebsd support.
+       * configure: Rebuilt.
+
+2011-11-12  Timothy Wall  <twall@users.sf.net>
+
+       * src/arm/ffi.c (ffi_prep_args, ffi_prep_incoming_args_SYSV): Max
+       alignment of 4 for wince on ARM.
+
+2011-11-12  Kyle Moffett <Kyle.D.Moffett@boeing.com>
+           Anthony Green <green@moxielogic.com>
+
+       * src/ppc/sysv.S, src/ppc/ffi.c: Remove use of ppc string
+       instructions (not available on some cores, like the PPC440).
+
+2011-11-12  Kimura Wataru  <kimuraw@i.nifty.jp>
+
+       * m4/ax_enable_builddir: Change from string comparison to numeric
+       comparison for wc output.
+       * configure.ac: Enable FFI_MMAP_EXEC_WRIT for darwin11 aka Mac OS
+       X 10.7.
+       * configure: Rebuilt.
+
+2011-11-12  Anthony Green  <green@moxielogic.com>
+
+       * Makefile.am (AM_CCASFLAGS): Add -g option to build assembly
+       files with debug info.
+       * Makefile.in: Rebuilt.
+
+2011-11-12  Jasper Lievisse Adriaanse <jasper@openbsd.org>
+
+       * README: Update list of supported OpenBSD systems.
+
+2011-11-12  Anthony Green  <green@moxielogic.com>
+
+       * libtool-version: Update.
+       * Makefile.am (nodist_libffi_la_SOURCES): Add src/debug.c if
+       FFI_DEBUG.
+       (libffi_la_SOURCES): Remove src/debug.c
+       (EXTRA_DIST): Add src/debug.c
+       * Makefile.in: Rebuilt.
+       * README: Update for 3.0.11.
+
+2011-11-10  Richard Henderson  <rth@redhat.com>
+
+       * configure.ac (GCC_AS_CFI_PSEUDO_OP): Use it instead of inline check.
+       * configure, aclocal.m4: Rebuild.
+
+2011-09-04  Iain Sandoe  <iains@gcc.gnu.org>
+
+       PR libffi/49594
+       * src/powerpc/darwin_closure.S (stubs): Make the stub binding
+       helper reference track the architecture pointer size.
+
+2011-08-25  Andrew Haley  <aph@redhat.com>
+
+       * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Remove hard-coded assembly
+       instructions.
+       * src/arm/sysv.S (ffi_arm_trampoline): Put them here instead.
+
+2011-07-11  Andrew Haley  <aph@redhat.com>
+
+        * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Clear icache.
+
+2011-06-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * testsuite/libffi.call/cls_double_va.c: Move PR number to comment.
+       * testsuite/libffi.call/cls_longdouble_va.c: Likewise.
+
+2011-06-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR libffi/46660
+       * testsuite/libffi.call/cls_double_va.c: xfail dg-output on
+       mips-sgi-irix6*.
+       * testsuite/libffi.call/cls_longdouble_va.c: Likewise.
+
+2011-06-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * testsuite/libffi.call/huge_struct.c (test_large_fn): Use PRIu8,
+       PRId8 instead of %hhu, %hhd.
+       * testsuite/libffi.call/ffitest.h [__alpha__ && __osf__] (PRId8,
+       PRIu8): Define.
+       [__sgi__] (PRId8, PRIu8): Define.
+
+2011-04-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * src/alpha/osf.S (UA_SI, FDE_ENCODING, FDE_ENCODE, FDE_ARANGE):
+       Define.
+       Use them to handle ELF vs. ECOFF differences.
+       [__osf__] (_GLOBAL__F_ffi_call_osf): Define.
+
+2011-03-30  Timothy Wall  <twall@users.sf.net>
+
+       * src/powerpc/darwin.S: Fix unknown FDE encoding.
+       * src/powerpc/darwin_closure.S: ditto.
+
+2011-02-25  Anthony Green  <green@moxielogic.com>
+
+       * src/powerpc/ffi.c (ffi_prep_closure_loc): Allow for more
+       32-bit ABIs.
+
+2011-02-15  Anthony Green  <green@moxielogic.com>
+
+       * m4/ax_cc_maxopt.m4: Don't -malign-double or use -ffast-math.
+       * configure: Rebuilt.
+
+2011-02-13  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * configure: Regenerate.
+
+2011-02-13  Anthony Green  <green@moxielogic.com>
+
+       * include/ffi_common.h (UNLIKELY, LIKELY): Define.
+       * src/x86/ffi64.c (UNLIKELY, LIKELY): Remove definition.
+       * src/prep_cif.c (UNLIKELY, LIKELY): Remove definition.
+
+       * src/prep_cif.c (initialize_aggregate): Convert assertion into
+       FFI_BAD_TYPEDEF return.  Initialize arg size and alignment to 0.
+
+       * src/pa/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
+       just return FFI_BAD_ABI when things are wrong.
+       * src/arm/ffi.c (ffi_prep_closure_loc): Ditto.
+       * src/powerpc/ffi.c (ffi_prep_closure_loc): Ditto.
+       * src/mips/ffi.c (ffi_prep_closure_loc): Ditto.
+       * src/ia64/ffi.c (ffi_prep_closure_loc): Ditto.
+       * src/avr32/ffi.c (ffi_prep_closure_loc): Ditto.
+
+2011-02-11  Anthony Green  <green@moxielogic.com>
+
+       * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
+       just return FFI_BAD_ABI when things are wrong.
+
+2012-02-11  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * src/sparc/v9.S (STACKFRAME): Bump to 176.
+
+2011-02-09  Stuart Shelton  <srcshelton@gmail.com>
+
+       http://bugs.gentoo.org/show_bug.cgi?id=286911
+       * src/mips/ffitarget.h: Clean up error messages.
+       * src/java_raw_api.c (ffi_java_translate_args): Cast raw arg to
+       ffi_raw*.
+       * include/ffi.h.in: Add pragma for SGI compiler.
+
+2011-02-09  Anthony Green  <green@moxielogic.com>
+
+       * configure.ac: Add powerpc64-*-darwin* support.
+
+2011-02-09  Anthony Green <green@moxielogic.com>
+
+       * README: Mention Interix.
+
+2011-02-09  Jonathan Callen  <abcd@gentoo.org>
+
+       * configure.ac: Add Interix to win32/cygwin/mingw case.
+       * configure: Ditto.
+       * src/closures.c: Treat Interix like Cygwin, instead of as a
+       generic win32.
+
+2011-02-09  Anthony Green <green@moxielogic.com>
+
+       * testsuite/libffi.call/err_bad_typedef.c: Remove xfail.
+       * testsuite/libffi.call/err_bad_abi.c: Remove xfail.
+       * src/x86/ffi64.c (UNLIKELY, LIKELY): Define.
+       (ffi_prep_closure_loc): Check for bad ABI.
+       * src/prep_cif.c (UNLIKELY, LIKELY): Define.
+       (initialize_aggregate): Check for bad types.
+
+2011-02-09  Landon Fuller <landonf@plausible.coop>
+
+       * Makefile.am (EXTRA_DIST): Add build-ios.sh, src/arm/gentramp.sh,
+       src/arm/trampoline.S.
+       (nodist_libffi_la_SOURCES): Add src/arc/trampoline.S.
+       * configure.ac (FFI_EXEC_TRAMPOLINE_TABLE): Define.
+       * src/arm/ffi.c (ffi_trampoline_table)
+       (ffi_closure_trampoline_table_page, ffi_trampoline_table_entry)
+       (FFI_TRAMPOLINE_CODELOC_CONFIG, FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET)
+       (FFI_TRAMPOLINE_COUNT, ffi_trampoline_lock, ffi_trampoline_tables)
+       (ffi_trampoline_table_alloc, ffi_closure_alloc, ffi_closure_free):
+       Define for FFI_EXEC_TRAMPOLINE_TABLE case (iOS).
+       (ffi_prep_closure_loc): Handl FFI_EXEC_TRAMPOLINE_TABLE case
+       separately.
+       * src/arm/sysv.S: Handle Apple iOS host.
+       * src/closures.c: Handle FFI_EXEC_TRAMPOLINE_TABLE case.
+       * build-ios.sh: New file.
+       * fficonfig.h.in, configure, Makefile.in: Rebuilt.
+       * README: Mention ARM iOS.
+
+2011-02-08  Oren Held  <orenhe@il.ibm.com>
+
+       * src/dlmalloc.c (_STRUCT_MALLINFO): Define in order to avoid
+       redefinition of mallinfo on HP-UX.
+
+2011-02-08  Ginn Chen  <ginn.chen@oracle.com>
+
+       * src/sparc/ffi.c (ffi_call): Make compatible with Solaris Studio
+       aggregate return ABI.  Flush cache.
+       (ffi_prep_closure_loc): Flush cache.
+
+2011-02-11  Anthony Green  <green@moxielogic.com>
+
+       From Tom Honermann <tom.honermann@oracle.com>:
+       * src/powerpc/aix.S (ffi_call_AIX): Support for xlc toolchain on
+       AIX.  Declare .ffi_prep_args.  Insert nops after branch
+       instructions so that the AIX linker can insert TOC reload
+       instructions.
+       * src/powerpc/aix_closure.S: Declare .ffi_closure_helper_DARWIN.
+
+2011-02-08  Ed  <ed@kdtc.net>
+
+       * src/powerpc/asm.h: Fix grammar nit in comment.
+
+2011-02-08  Uli Link  <ul.mcamafia@linkitup.de>
+
+       * include/ffi.h.in (FFI_64_BIT_MAX): Define and use.
+
+2011-02-09  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR libffi/46661
+       * testsuite/libffi.call/cls_pointer.c (main): Cast void * to
+       uintptr_t first.
+       * testsuite/libffi.call/cls_pointer_stack.c (main): Likewise.
+
+2011-02-08  Rafael Avila de Espindola  <respindola@mozilla.com>
+
+       * configure.ac: Fix x86 test for pc related relocs.
+       * configure: Rebuilt.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+       * libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing.
+       Handle case when CPU variant does not have long double support.
+       * libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire,
+       and cores with soft floating point.
+
+2011-02-07  Joel Sherrill <joel.sherrill@oarcorp.com>
+
+       * configure.ac: Add mips*-*-rtems* support.
+       * configure: Regenerate.
+       * src/mips/ffitarget.h: Ensure needed constants are available
+       for targets which do not have sgidefs.h.
+
+2011-01-26  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+       PR target/40125
+       * configure.ac (AM_LTLDFLAGS): Add -bindir option for windows DLLs.
+       * configure: Regenerate.
+
+2010-12-18  Iain Sandoe  <iains@gcc.gnu.org>
+
+       PR libffi/29152
+       PR libffi/42378
+       * src/powerpc/darwin_closure.S: Provide Darwin64 implementation,
+       update comments.
+       * src/powerpc/ffitarget.h (POWERPC_DARWIN64): New,
+       (FFI_TRAMPOLINE_SIZE): Update for Darwin64.
+       * src/powerpc/darwin.S: Provide Darwin64 implementation,
+       update comments.
+       * src/powerpc/ffi_darwin.c: Likewise.
+
+2010-12-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * configure.ac (libffi_cv_as_ascii_pseudo_op): Use double
+       backslashes.
+       (libffi_cv_as_string_pseudo_op): Likewise.
+       * configure: Regenerate.
+
+2010-12-03  Chung-Lin Tang  <cltang@codesourcery.com>
+
+       * src/arm/sysv.S (ffi_closure_SYSV): Add UNWIND to .pad directive.
+       (ffi_closure_VFP): Same.
+       (ffi_call_VFP): Move down to before ffi_closure_VFP. Add '.fpu vfp'
+       directive.
+
+2010-12-01  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * testsuite/libffi.call/ffitest.h [__sgi] (PRId64, PRIu64): Define.
+       (PRIuPTR): Define.
+
+2010-11-29  Richard Henderson  <rth@redhat.com>
+           Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * src/x86/sysv.S (FDE_ENCODING, FDE_ENCODE): Define.
+       (.eh_frame): Use FDE_ENCODING.
+       (.LASFDE1, .LASFDE2, LASFDE3): Simplify with FDE_ENCODE.
+
+2010-11-22  Jacek Caban <jacek@codeweavers.com>
+
+       * configure.ac: Check for symbol underscores on mingw-w64.
+       * configure: Rebuilt.
+       * src/x86/win64.S: Correctly access extern symbols in respect to
+       underscores.
+
+2010-11-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * testsuite/lib/libffi-dg.exp: Rename ...
+       * testsuite/lib/libffi.exp: ... to this.
+       * libffi/testsuite/libffi.call/call.exp: Don't load libffi-dg.exp.
+       * libffi/testsuite/libffi.special/special.exp: Likewise.
+
+2010-10-28  Chung-Lin Tang  <cltang@codesourcery.com>
+
+       * src/arm/ffi.c (ffi_prep_args): Add VFP register argument handling
+       code, new parameter, and return value. Update comments.
+       (ffi_prep_cif_machdep): Add case for VFP struct return values. Add
+       call to layout_vfp_args().
+       (ffi_call_SYSV): Update declaration.
+       (ffi_call_VFP): New declaration.
+       (ffi_call): Add VFP struct return conditions. Call ffi_call_VFP()
+       when ABI is FFI_VFP.
+       (ffi_closure_VFP): New declaration.
+       (ffi_closure_SYSV_inner): Add new vfp_args parameter, update call to
+       ffi_prep_incoming_args_SYSV().
+       (ffi_prep_incoming_args_SYSV): Update parameters. Add VFP argument
+       case handling.
+       (ffi_prep_closure_loc): Pass ffi_closure_VFP to trampoline
+       construction under VFP hard-float.
+       (rec_vfp_type_p): New function.
+       (vfp_type_p): Same.
+       (place_vfp_arg): Same.
+       (layout_vfp_args): Same.
+       * src/arm/ffitarget.h (ffi_abi): Add FFI_VFP. Define FFI_DEFAULT_ABI
+       based on __ARM_PCS_VFP.
+       (FFI_EXTRA_CIF_FIELDS): Define for adding VFP hard-float specific
+       fields.
+       (FFI_TYPE_STRUCT_VFP_FLOAT): Define internally used type code.
+       (FFI_TYPE_STRUCT_VFP_DOUBLE): Same.
+       * src/arm/sysv.S (ffi_call_SYSV): Change call of ffi_prep_args() to
+       direct call. Move function pointer load upwards.
+       (ffi_call_VFP): New function.
+       (ffi_closure_VFP): Same.
+
+       * testsuite/lib/libffi-dg.exp (check-flags): New function.
+       (dg-skip-if): New function.
+       * testsuite/libffi.call/cls_double_va.c: Skip if target is arm*-*-*
+       and compiler options include -mfloat-abi=hard.
+       * testsuite/libffi.call/cls_longdouble_va.c: Same.
+
+2010-10-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR libffi/45677
+       * src/x86/ffi64.c (ffi_prep_cif_machdep): Ensure cif->bytes is
+       a multiple of 8.
+       * testsuite/libffi.call/many2.c: New test.
+
+2010-08-20  Mark Wielaard  <mjw@redhat.com>
+
+       * src/closures.c (open_temp_exec_file_mnt): Check if getmntent_r
+       returns NULL.
+
+2010-08-09  Andreas Tobler  <andreast@fgznet.ch>
+
+       * configure.ac: Add target powerpc64-*-freebsd*.
+       * configure: Regenerate.
+       * testsuite/libffi.call/cls_align_longdouble_split.c: Pass
+       -mlong-double-128 only to linux targets.
+       * testsuite/libffi.call/cls_align_longdouble_split2.c: Likewise.
+       * testsuite/libffi.call/cls_longdouble.c: Likewise.
+       * testsuite/libffi.call/huge_struct.c: Likewise.
+
+2010-08-05  Dan Witte  <dwitte@mozilla.com>
+
+        * Makefile.am: Pass FFI_DEBUG define to msvcc.sh for linking to the
+        debug CRT when --enable-debug is given.
+        * configure.ac: Define it.
+        * msvcc.sh: Translate -g and -DFFI_DEBUG appropriately.
+
+2010-08-04  Dan Witte  <dwitte@mozilla.com>
+
+       * src/x86/ffitarget.h: Add X86_ANY define for all x86/x86_64
+       platforms.
+       * src/x86/ffi.c: Remove redundant ifdef checks.
+       * src/prep_cif.c: Push stack space computation into src/x86/ffi.c
+       for X86_ANY so return value space doesn't get added twice.
+
+2010-08-03  Neil Rashbrooke <neil@parkwaycc.co.uk>
+
+       * msvcc.sh: Don't pass -safeseh to ml64 because behavior is buggy.
+
+2010-07-22  Dan Witte  <dwitte@mozilla.com>
+
+       * src/*/ffitarget.h: Make FFI_LAST_ABI one past the last valid ABI.
+       * src/prep_cif.c: Fix ABI assertion.
+        * src/cris/ffi.c: Ditto.
+
+2010-07-10  Evan Phoenix  <evan@fallingsnow.net>
+
+       * src/closures.c (selinux_enabled_check): Fix strncmp usage bug.
+
+2010-07-07  Dan Horák <dan@danny.cz>
+
+       * include/ffi.h.in: Protect #define with #ifndef.
+       * src/powerpc/ffitarget.h: Ditto.
+       * src/s390/ffitarget.h: Ditto.
+       * src/sparc/ffitarget.h: Ditto.
+
+2010-07-07   Neil Roberts <neil@linux.intel.com>
+
+       * src/x86/sysv.S (ffi_call_SYSV): Align the stack pointer to
+       16-bytes.
+
+2010-07-02  Jakub Jelinek  <jakub@redhat.com>
+
+       * Makefile.am (AM_MAKEFLAGS): Pass also mandir to submakes.
+       * Makefile.in: Regenerated.
+
+2010-05-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * configure.ac (libffi_cv_as_x86_pcrel): Check for illegal in as
+       output, too.
+       (libffi_cv_as_ascii_pseudo_op): Check for .ascii.
+       (libffi_cv_as_string_pseudo_op): Check for .string.
+       * configure: Regenerate.
+       * fficonfig.h.in: Regenerate.
+       * src/x86/sysv.S (.eh_frame): Use .ascii, .string or error.
+
+2010-05-11  Dan Witte  <dwitte@mozilla.com>
+
+       * doc/libffi.tex: Document previous change.
+
+2010-05-11  Makoto Kato <m_kato@ga2.so-net.ne.jp>
+
+       * src/x86/ffi.c (ffi_call): Don't copy structs passed by value.
+
+2010-05-05  Michael Kohler <michaelkohler@live.com>
+
+       * src/dlmalloc.c (dlfree): Fix spelling.
+       * src/ia64/ffi.c (ffi_prep_cif_machdep): Ditto.
+       * configure.ac: Ditto.
+       * configure: Rebuilt.
+
+2010-04-13  Dan Witte  <dwitte@mozilla.com>
+
+       * msvcc.sh: Build with -W3 instead of -Wall.
+       * src/powerpc/ffi_darwin.c: Remove build warnings.
+       * src/x86/ffi.c: Ditto.
+       * src/x86/ffitarget.h: Ditto.
+
+2010-04-12  Dan Witte  <dwitte@mozilla.com>
+           Walter Meinl <wuno@lsvw.de>
+
+       * configure.ac: Add OS/2 support.
+       * configure: Rebuilt.
+       * src/closures.c: Ditto.
+       * src/dlmalloc.c: Ditto.
+       * src/x86/win32.S: Ditto.
+
+2010-04-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * testsuite/libffi.call/err_bad_abi.c: Remove unused args variable.
+
+2010-04-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * Makefile.in: Regenerate.
+       * aclocal.m4: Regenerate.
+       * include/Makefile.in: Regenerate.
+       * man/Makefile.in: Regenerate.
+       * testsuite/Makefile.in: Regenerate.
+
+2010-03-30  Dan Witte  <dwitte@mozilla.com>
+
+       * msvcc.sh: Disable build warnings.
+       * README (tested): Clarify windows build procedure.
+
+2010-03-15  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * configure.ac (libffi_cv_as_x86_64_unwind_section_type): New test.
+       * configure: Regenerate.
+       * fficonfig.h.in: Regenerate.
+       * libffi/src/x86/unix64.S (.eh_frame)
+       [HAVE_AS_X86_64_UNWIND_SECTION_TYPE]: Use @unwind section type.
+
+2010-03-14  Matthias Klose  <doko@ubuntu.com>
+
+       * src/x86/ffi64.c: Fix typo in comment.
+       * src/x86/ffi.c: Use /* ... */ comment style.
+
+2010-02-24  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * doc/libffi.texi (The Closure API): Fix typo.
+       * doc/libffi.info: Remove.
+
+2010-02-15  Matthias Klose  <doko@ubuntu.com>
+
+       * src/arm/sysv.S (__ARM_ARCH__): Define for processor
+       __ARM_ARCH_7EM__.
+
+2010-01-15  Anthony Green  <green@redhat.com>
+
+       * README: Add notes on building with Microsoft Visual C++.
+
+2010-01-15  Daniel Witte  <dwitte@mozilla.com>
+
+       * msvcc.sh: New file.
+
+       * src/x86/win32.S: Port assembly routines to MSVC and #ifdef.
+       * src/x86/ffi.c: Tweak function declaration and remove excess
+       parens.
+       * include/ffi.h.in: Add __declspec(align(8)) to typedef struct
+       ffi_closure.
+
+       * src/x86/ffi.c: Merge ffi_call_SYSV and ffi_call_STDCALL into new
+       function ffi_call_win32 on X86_WIN32.
+       * src/x86/win32.S (ffi_call_SYSV): Rename to ffi_call_win32.
+       (ffi_call_STDCALL): Remove.
+
+       * src/prep_cif.c (ffi_prep_cif): Move stack space allocation code
+       to ffi_prep_cif_machdep for x86.
+       * src/x86/ffi.c (ffi_prep_cif_machdep): To here.
+
+2010-01-15  Oliver Kiddle  <okiddle@yahoo.co.uk>
+
+       * src/x86/ffitarget.h (ffi_abi): Check for __i386 and __amd64 for
+       Sun Studio compiler compatibility.
+
+2010-01-12  Conrad Irwin <conrad.irwin@gmail.com>
+
+       * doc/libffi.texi: Add closure example.
+
+2010-01-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR libffi/40701
+       * testsuite/libffi.call/ffitest.h [__alpha__ && __osf__] (PRIdLL,
+       PRIuLL, PRId64, PRIu64, PRIuPTR): Define.
+       * testsuite/libffi.call/cls_align_sint64.c: Add -Wno-format on
+       alpha*-dec-osf*.
+       * testsuite/libffi.call/cls_align_uint64.c: Likewise.
+       * testsuite/libffi.call/cls_ulonglong.c: Likewise.
+       * testsuite/libffi.call/return_ll1.c: Likewise.
+       * testsuite/libffi.call/stret_medium2.c: Likewise.
+       * testsuite/libffi.special/ffitestcxx.h (allocate_mmap): Cast
+       MAP_FAILED to char *.
+
+2010-01-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * src/mips/n32.S: Use .abicalls and .eh_frame with __GNUC__.
+
+2009-12-31  Anthony Green  <green@redhat.com>
+
+       * README: Update for libffi 3.0.9.
+
+2009-12-27  Matthias Klose  <doko@ubuntu.com>
+
+       * configure.ac (HAVE_LONG_DOUBLE): Define for mips when
+       appropriate.
+       * configure: Rebuilt.
+
+2009-12-26  Anthony Green  <green@redhat.com>
+
+       * testsuite/libffi.call/cls_longdouble_va.c: Mark as xfail for
+       avr32*-*-*.
+       * testsuite/libffi.call/cls_double_va.c: Ditto.
+
+2009-12-26  Andreas Tobler  <a.tobler@schweiz.org>
+
+       * testsuite/libffi.call/ffitest.h: Conditionally include stdint.h
+       and inttypes.h.
+       * testsuite/libffi.special/unwindtest.cc: Ditto.
+
+2009-12-26  Andreas Tobler  <a.tobler@schweiz.org>
+
+       * configure.ac: Add amd64-*-openbsd*.
+       * configure: Rebuilt.
+       * testsuite/lib/libffi-dg.exp (libffi_target_compile): Link
+       openbsd programs with -lpthread.
+
+2009-12-26  Anthony Green  <green@redhat.com>
+
+       * testsuite/libffi.call/cls_double_va.c,
+       testsuite/libffi.call/cls_longdouble.c,
+       testsuite/libffi.call/cls_longdouble_va.c,
+       testsuite/libffi.call/cls_pointer.c,
+       testsuite/libffi.call/cls_pointer_stack.c: Remove xfail for
+       mips*-*-* and arm*-*-*.
+       * testsuite/libffi.call/cls_align_longdouble_split.c,
+       testsuite/libffi.call/cls_align_longdouble_split2.c,
+       testsuite/libffi.call/stret_medium2.c,
+       testsuite/libffi.call/stret_medium.c,
+       testsuite/libffi.call/stret_large.c,
+       testsuite/libffi.call/stret_large2.c: Remove xfail for arm*-*-*.
+
+2009-12-31  Kay Tietz  <ktietz70@googlemail.com>
+
+       * testsuite/libffi.call/ffitest.h,
+       testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRuLL): Fix
+       definitions.
+
+2009-12-31  Carlo Bramini  <carlo.bramix@libero.it>
+
+       * configure.ac (AM_LTLDFLAGS): Define for windows hosts.
+       * Makefile.am (libffi_la_LDFLAGS): Add AM_LTLDFLAGS.
+       * configure: Rebuilt.
+       * Makefile.in: Rebuilt.
+
+2009-12-31  Anthony Green  <green@redhat.com>
+           Blake Chaffin.
+
+       * testsuite/libffi.call/huge_struct.c: New test case from Blake
+       Chaffin @ Apple.
+
+2009-12-28  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Copy abi and nargs to
+       local variables.
+       (aix_adjust_aggregate_sizes): New function.
+       (ffi_prep_cif_machdep): Call it.
+
+2009-12-26  Andreas Tobler  <a.tobler@schweiz.org>
+
+       * configure.ac: Define FFI_MMAP_EXEC_WRIT for the given targets.
+       * configure: Regenerate.
+       * fficonfig.h.in: Likewise.
+       * src/closures.c: Remove the FFI_MMAP_EXEC_WRIT definition for
+       Solaris/x86.
+
+2009-12-26  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * src/powerpc/ffi.c (ffi_prep_args_SYSV): Advance intarg_count
+       when a float arguments is passed in memory.
+       (ffi_closure_helper_SYSV): Mark general registers as used up when
+       a 64bit or soft-float long double argument is passed in memory.
+
+2009-12-25  Matthias Klose  <doko@ubuntu.com>
+
+       * man/ffi_call.3: Fix #include in examples.
+       * doc/libffi.texi: Add dircategory.
+
+2009-12-25  Frank Everdij <f.p.x.everdij@tudelft.nl>
+
+       * include/ffi.h.in: Placed '__GNUC__' ifdef around
+       '__attribute__((aligned(8)))' in ffi_closure, fixes compile for
+       IRIX MIPSPro c99.
+       * include/ffi_common.h: Added '__sgi' define to non
+       '__attribute__((__mode__()))' integer typedefs.
+       * src/mips/ffi.c (ffi_call, ffi_closure_mips_inner_O32,
+       ffi_closure_mips_inner_N32): Added 'defined(_MIPSEB)' to BE check.
+       (ffi_closure_mips_inner_O32, ffi_closure_mips_inner_N32): Added
+       FFI_LONGDOUBLE support and alignment(N32 only).
+       * src/mips/ffitarget.h: Corrected '#include <sgidefs.h>' for IRIX and
+       fixed non '__attribute__((__mode__()))' integer typedefs.
+       * src/mips/n32.S: Put '#ifdef linux' around '.abicalls' and '.eh_frame'
+       since they are Linux/GNU Assembler specific.
+
+2009-12-25  Bradley Smith  <brad@brad-smith.co.uk>
+
+       * configure.ac, Makefile.am, src/avr32/ffi.c,
+       src/avr32/ffitarget.h,
+       src/avr32/sysv.S: Add AVR32 port.
+       * configure, Makefile.in: Rebuilt.
+
+2009-12-21  Andreas Tobler  <a.tobler@schweiz.org>
+
+       * configure.ac: Make i?86 build on FreeBSD and OpenBSD.
+       * configure: Regenerate.
+
+2009-12-15  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       * testsuite/libffi.call/ffitest.h: Define PRIuPTR on PA HP-UX.
+
+2009-12-13  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE
+       type on HP-UX.
+
+2012-02-13  Kai Tietz  <ktietz@redhat.com>
+
+       PR libffi/52221
+       * src/x86/ffi.c (ffi_prep_raw_closure_loc): Add thiscall
+       support for X86_WIN32.
+       (FFI_INIT_TRAMPOLINE_THISCALL): Fix displacement.
+
+2009-12-11  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long
+       double' arguments.
+
+2009-12-11  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * testsuite/libffi.call/ffitest.h: Define PRIuPTR on Solaris < 10.
+
+2009-12-10  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR libffi/40700
+       * src/closures.c [X86_64 && __sun__ && __svr4__]
+       (FFI_MMAP_EXEC_WRIT): Define.
+
+2009-12-08  David Daney  <ddaney@caviumnetworks.com>
+
+       * testsuite/libffi.call/stret_medium.c: Remove xfail for mips*-*-*
+       * testsuite/libffi.call/cls_align_longdouble_split2.c: Same.
+       * testsuite/libffi.call/stret_large.c: Same.
+       * testsuite/libffi.call/cls_align_longdouble_split.c: Same.
+       * testsuite/libffi.call/stret_large2.c: Same.
+       * testsuite/libffi.call/stret_medium2.c: Same.
+
+2009-12-07  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/aix_closure.S (libffi_closure_ASM): Fix tablejump
+       typo.
+
+2009-12-05  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/aix.S: Update AIX32 code to be consistent with AIX64
+       code.
+       * src/powerpc/aix_closure.S: Same.
+
+2009-12-05  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * Makefile.in: Regenerate.
+       * configure: Regenerate.
+       * include/Makefile.in: Regenerate.
+       * man/Makefile.in: Regenerate.
+       * testsuite/Makefile.in: Regenerate.
+
+2009-12-04  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/aix_closure.S: Reorganize 64-bit code to match
+       linux64_closure.S.
+
+2009-12-04  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR libffi/41908
+       * src/x86/ffi64.c (classify_argument): Update from
+       gcc/config/i386/i386.c.
+       (ffi_closure_unix64_inner): Do not use the address of two consecutive
+       SSE registers directly.
+       * testsuite/libffi.call/cls_dbls_struct.c (main): Remove xfail
+       for x86_64 linux targets.
+
+2009-12-04  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/ffi_darwin.c (ffi_closure_helper_DARWIN): Increment
+       pfr for long double split between fpr13 and stack.
+
+2009-12-03  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Increment next_arg and
+       fparg_count twice for long double.
+
+2009-12-03  David Edelsohn  <edelsohn@gnu.org>
+
+       PR libffi/42243
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Remove extra parentheses.
+
+2009-12-03  Uros Bizjak  <ubizjak@gmail.com>
+
+       * testsuite/libffi.call/cls_longdouble_va.c (main): Fix format string.
+       Remove xfails for x86 linux targets.
+
+2009-12-02  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Fix typo in INT64
+       case.
+
+2009-12-01  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/aix.S (ffi_call_AIX): Convert to more standard
+       register usage.  Call ffi_prep_args directly.  Add long double
+       return value support.
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Double arg increment
+       applies to FFI_TYPE_DOUBLE.  Correct fpr_base increment typo.
+       Separate FFI_TYPE_SINT32 and FFI_TYPE_UINT32 cases.
+       (ffi_prep_cif_machdep): Only 16 byte stack alignment in 64 bit
+       mode.
+       (ffi_closure_helper_DARWIN): Remove nf and ng counters.  Move temp
+       into case.
+       * src/powerpc/aix_closure.S: Maintain 16 byte stack alignment.
+       Allocate result area between params and FPRs.
+
+2009-11-30  David Edelsohn  <edelsohn@gnu.org>
+
+       PR target/35484
+       * src/powerpc/ffitarget.h (POWERPC64): Define for PPC64 Linux and
+       AIX64.
+       * src/powerpc/aix.S: Implement AIX64 version.
+       * src/powerpc/aix_closure.S: Implement AIX64 version.
+       (ffi_closure_ASM): Use extsb, lha and displament addresses.
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Implement AIX64
+       support.
+       (ffi_prep_cif_machdep): Same.
+       (ffi_call): Same.
+       (ffi_closure_helper_DARWIN): Same.
+
+2009-11-02  Andreas Tobler  <a.tobler@schweiz.org>
+
+       PR libffi/41908
+       * testsuite/libffi.call/testclosure.c: New test.
+
+2009-09-28  Kai Tietz  <kai.tietz@onevision.com>
+
+       * src/x86/win64.S (_ffi_call_win64 stack): Remove for gnu
+       assembly version use of ___chkstk.
+
+2009-09-23  Matthias Klose  <doko@ubuntu.com>
+
+       PR libffi/40242, PR libffi/41443
+       * src/arm/sysv.S (__ARM_ARCH__): Define for processors
+       __ARM_ARCH_6T2__, __ARM_ARCH_6M__, __ARM_ARCH_7__,
+       __ARM_ARCH_7A__, __ARM_ARCH_7R__, __ARM_ARCH_7M__.
+       Change the conditionals to __SOFTFP__ || __ARM_EABI__
+       for -mfloat-abi=softfp to work.
+
+2009-09-17  Loren J. Rittle  <ljrittle@acm.org>
+
+       PR testsuite/32843 (strikes again)
+       * src/x86/ffi.c (ffi_prep_cif_machdep): Add X86_FREEBSD to
+       enable proper extension on char and short.
+
+2009-09-15  David Daney  <ddaney@caviumnetworks.com>
+
+       * src/java_raw_api.c (ffi_java_raw_to_rvalue): Remove special
+       handling for FFI_TYPE_POINTER.
+       * src/mips/ffitarget.h (FFI_TYPE_STRUCT_D_SOFT,
+       FFI_TYPE_STRUCT_F_SOFT, FFI_TYPE_STRUCT_DD_SOFT,
+       FFI_TYPE_STRUCT_FF_SOFT, FFI_TYPE_STRUCT_FD_SOFT,
+       FFI_TYPE_STRUCT_DF_SOFT, FFI_TYPE_STRUCT_SOFT): New defines.
+       (FFI_N32_SOFT_FLOAT, FFI_N64_SOFT_FLOAT): New ffi_abi enumerations.
+       (enum ffi_abi): Set FFI_DEFAULT_ABI for soft-float.
+       * src/mips/n32.S (ffi_call_N32): Add handling for soft-float
+       structure and pointer returns.
+       (ffi_closure_N32): Add handling for pointer returns.
+       * src/mips/ffi.c (ffi_prep_args, calc_n32_struct_flags,
+       calc_n32_return_struct_flags): Handle soft-float.
+       (ffi_prep_cif_machdep):  Handle soft-float, fix pointer handling.
+       (ffi_call_N32): Declare proper argument types.
+       (ffi_call, copy_struct_N32, ffi_closure_mips_inner_N32): Handle
+       soft-float.
+
+2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * configure.ac (AC_PREREQ): Bump to 2.64.
+
+2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * Makefile.am (install-html, install-pdf): Remove.
+       * Makefile.in: Regenerate.
+
+       * Makefile.in: Regenerate.
+       * aclocal.m4: Regenerate.
+       * configure: Regenerate.
+       * fficonfig.h.in: Regenerate.
+       * include/Makefile.in: Regenerate.
+       * man/Makefile.in: Regenerate.
+       * testsuite/Makefile.in: Regenerate.
+
+2011-08-22  Jasper Lievisse Adriaanse <jasper@openbsd.org>
+
+       * configure.ac: Add OpenBSD/hppa and OpenBSD/powerpc support.
+       * configure: Rebuilt.
+
+2009-07-30  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
+2009-07-24  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+       PR libffi/40807
+       * src/x86/ffi.c (ffi_prep_cif_machdep): Also use sign/zero-extending
+       return types for X86_WIN32.
+       * src/x86/win32.S (_ffi_call_SYSV): Handle omitted return types.
+       (_ffi_call_STDCALL, _ffi_closure_SYSV, _ffi_closure_raw_SYSV,
+       _ffi_closure_STDCALL): Likewise.
+
+       * src/closures.c (is_selinux_enabled): Define to const 0 for Cygwin.
+       (dlmmap, dlmunmap): Also use these functions on Cygwin.
+
+2009-07-11  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       PR testsuite/40699
+       PR testsuite/40707
+       PR testsuite/40709
+       * testsuite/lib/libffi-dg.exp: Revert 2009-07-02, 2009-07-01 and
+       2009-06-30 commits.
+
+2009-07-01  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * testsuite/lib/libffi-dg.exp (libffi-init): Set ld_library_path
+       to "" before adding paths.  (This reinstates an assignment that
+       was removed by my 2009-06-30 commit, but changes the initial
+       value from "." to "".)
+
+2009-07-01  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR testsuite/40601
+       * testsuite/lib/libffi-dg.exp (libffi-init): Properly set
+       gccdir.  Adjust ld_library_path for gcc only if gccdir isn't
+       empty.
+
+2009-06-30  Richard Sandiford  <r.sandiford@uk.ibm.com>
+
+       * testsuite/lib/libffi-dg.exp (libffi-init): Don't add "."
+       to ld_library_path.  Use add_path.  Add just find_libgcc_s
+       to ld_library_path, not every libgcc multilib directory.
+
+2009-06-16  Wim Lewis  <wiml@hhhh.org>
+
+       * src/powerpc/ffi.c: Avoid clobbering cr3 and cr4, which are
+       supposed to be callee-saved.
+       * src/powerpc/sysv.S (small_struct_return_value): Fix overrun of
+       return buffer for odd-size structs.
+
+2009-06-16  Andreas Tobler  <a.tobler@schweiz.org>
+
+       PR libffi/40444
+       * testsuite/lib/libffi-dg.exp (libffi_target_compile): Add
+       allow_stack_execute for Darwin.
+
+2009-06-16  Andrew Haley  <aph@redhat.com>
+
+       * configure.ac (TARGETDIR): Add missing blank lines.
+       * configure: Regenerate.
+
+2009-06-16  Andrew Haley  <aph@redhat.com>
+
+       * testsuite/libffi.call/cls_align_sint64.c,
+       testsuite/libffi.call/cls_align_uint64.c,
+       testsuite/libffi.call/cls_longdouble_va.c,
+       testsuite/libffi.call/cls_ulonglong.c,
+       testsuite/libffi.call/return_ll1.c,
+       testsuite/libffi.call/stret_medium2.c: Fix printf format
+       specifiers.
+       * testsuite/libffi.call/ffitest.h,
+       testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define.
+
+2009-06-15  Andrew Haley  <aph@redhat.com>
+
+       * testsuite/libffi.call/err_bad_typedef.c: xfail everywhere.
+       * testsuite/libffi.call/err_bad_abi.c: Likewise.
+
+2009-06-12  Andrew Haley  <aph@redhat.com>
+
+       * Makefile.am: Remove info_TEXINFOS.
+
+2009-06-12  Andrew Haley  <aph@redhat.com>
+
+       * ChangeLog.libffi: testsuite/libffi.call/cls_align_sint64.c,
+       testsuite/libffi.call/cls_align_uint64.c,
+       testsuite/libffi.call/cls_ulonglong.c,
+       testsuite/libffi.call/return_ll1.c,
+       testsuite/libffi.call/stret_medium2.c: Fix printf format
+       specifiers.
+       testsuite/libffi.special/unwindtest.cc: include stdint.h.
+
+2009-06-11  Timothy Wall  <twall@users.sf.net>
+
+       * Makefile.am,
+       configure.ac,
+       include/ffi.h.in,
+       include/ffi_common.h,
+       src/closures.c,
+       src/dlmalloc.c,
+       src/x86/ffi.c,
+       src/x86/ffitarget.h,
+       src/x86/win64.S (new),
+       README: Added win64 support (mingw or MSVC)
+       * Makefile.in,
+       include/Makefile.in,
+       man/Makefile.in,
+       testsuite/Makefile.in,
+       configure,
+       aclocal.m4: Regenerated
+       * ltcf-c.sh: properly escape cygwin/w32 path
+       * man/ffi_call.3: Clarify size requirements for return value.
+       * src/x86/ffi64.c: Fix filename in comment.
+       * src/x86/win32.S: Remove unused extern.
+
+       * testsuite/libffi.call/closure_fn0.c,
+       testsuite/libffi.call/closure_fn1.c,
+       testsuite/libffi.call/closure_fn2.c,
+       testsuite/libffi.call/closure_fn3.c,
+       testsuite/libffi.call/closure_fn4.c,
+       testsuite/libffi.call/closure_fn5.c,
+       testsuite/libffi.call/closure_fn6.c,
+       testsuite/libffi.call/closure_stdcall.c,
+       testsuite/libffi.call/cls_12byte.c,
+       testsuite/libffi.call/cls_16byte.c,
+       testsuite/libffi.call/cls_18byte.c,
+       testsuite/libffi.call/cls_19byte.c,
+       testsuite/libffi.call/cls_1_1byte.c,
+       testsuite/libffi.call/cls_20byte.c,
+       testsuite/libffi.call/cls_20byte1.c,
+       testsuite/libffi.call/cls_24byte.c,
+       testsuite/libffi.call/cls_2byte.c,
+       testsuite/libffi.call/cls_3_1byte.c,
+       testsuite/libffi.call/cls_3byte1.c,
+       testsuite/libffi.call/cls_3byte2.c,
+       testsuite/libffi.call/cls_4_1byte.c,
+       testsuite/libffi.call/cls_4byte.c,
+       testsuite/libffi.call/cls_5_1_byte.c,
+       testsuite/libffi.call/cls_5byte.c,
+       testsuite/libffi.call/cls_64byte.c,
+       testsuite/libffi.call/cls_6_1_byte.c,
+       testsuite/libffi.call/cls_6byte.c,
+       testsuite/libffi.call/cls_7_1_byte.c,
+       testsuite/libffi.call/cls_7byte.c,
+       testsuite/libffi.call/cls_8byte.c,
+       testsuite/libffi.call/cls_9byte1.c,
+       testsuite/libffi.call/cls_9byte2.c,
+       testsuite/libffi.call/cls_align_double.c,
+       testsuite/libffi.call/cls_align_float.c,
+       testsuite/libffi.call/cls_align_longdouble.c,
+       testsuite/libffi.call/cls_align_longdouble_split.c,
+       testsuite/libffi.call/cls_align_longdouble_split2.c,
+       testsuite/libffi.call/cls_align_pointer.c,
+       testsuite/libffi.call/cls_align_sint16.c,
+       testsuite/libffi.call/cls_align_sint32.c,
+       testsuite/libffi.call/cls_align_sint64.c,
+       testsuite/libffi.call/cls_align_uint16.c,
+       testsuite/libffi.call/cls_align_uint32.c,
+       testsuite/libffi.call/cls_align_uint64.c,
+       testsuite/libffi.call/cls_dbls_struct.c,
+       testsuite/libffi.call/cls_double.c,
+       testsuite/libffi.call/cls_double_va.c,
+       testsuite/libffi.call/cls_float.c,
+       testsuite/libffi.call/cls_longdouble.c,
+       testsuite/libffi.call/cls_longdouble_va.c,
+       testsuite/libffi.call/cls_multi_schar.c,
+       testsuite/libffi.call/cls_multi_sshort.c,
+       testsuite/libffi.call/cls_multi_sshortchar.c,
+       testsuite/libffi.call/cls_multi_uchar.c,
+       testsuite/libffi.call/cls_multi_ushort.c,
+       testsuite/libffi.call/cls_multi_ushortchar.c,
+       testsuite/libffi.call/cls_pointer.c,
+       testsuite/libffi.call/cls_pointer_stack.c,
+       testsuite/libffi.call/cls_schar.c,
+       testsuite/libffi.call/cls_sint.c,
+       testsuite/libffi.call/cls_sshort.c,
+       testsuite/libffi.call/cls_uchar.c,
+       testsuite/libffi.call/cls_uint.c,
+       testsuite/libffi.call/cls_ulonglong.c,
+       testsuite/libffi.call/cls_ushort.c,
+       testsuite/libffi.call/err_bad_abi.c,
+       testsuite/libffi.call/err_bad_typedef.c,
+       testsuite/libffi.call/float2.c,
+       testsuite/libffi.call/huge_struct.c,
+       testsuite/libffi.call/nested_struct.c,
+       testsuite/libffi.call/nested_struct1.c,
+       testsuite/libffi.call/nested_struct10.c,
+       testsuite/libffi.call/nested_struct2.c,
+       testsuite/libffi.call/nested_struct3.c,
+       testsuite/libffi.call/nested_struct4.c,
+       testsuite/libffi.call/nested_struct5.c,
+       testsuite/libffi.call/nested_struct6.c,
+       testsuite/libffi.call/nested_struct7.c,
+       testsuite/libffi.call/nested_struct8.c,
+       testsuite/libffi.call/nested_struct9.c,
+       testsuite/libffi.call/problem1.c,
+       testsuite/libffi.call/return_ldl.c,
+       testsuite/libffi.call/return_ll1.c,
+       testsuite/libffi.call/stret_large.c,
+       testsuite/libffi.call/stret_large2.c,
+       testsuite/libffi.call/stret_medium.c,
+       testsuite/libffi.call/stret_medium2.c,
+       testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead
+       of checking for MMAP.  Use intptr_t instead of long casts.
+
+2009-06-11  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * testsuite/libffi.call/cls_longdouble_va.c: Add xfail sh*-*-linux-*.
+       * testsuite/libffi.call/err_bad_abi.c: Add xfail sh*-*-*.
+       * testsuite/libffi.call/err_bad_typedef.c: Likewise.
+
+2009-06-09  Andrew Haley  <aph@redhat.com>
+
+       * src/x86/freebsd.S: Add missing file.
+
+2009-06-08  Andrew Haley  <aph@redhat.com>
+
+       Import from libffi 3.0.8:
+
+       * doc/libffi.texi: New file.
+       * doc/libffi.info: Likewise.
+       * doc/stamp-vti: Likewise.
+       * man/Makefile.am: New file.
+       * man/ffi_call.3: New file.
+
+       * Makefile.am (EXTRA_DIST): Add src/x86/darwin64.S,
+       src/dlmalloc.c.
+       (nodist_libffi_la_SOURCES): Add X86_FREEBSD.
+
+       * configure.ac: Bump version to 3.0.8.
+       parisc*-*-linux*: Add.
+       i386-*-freebsd* | i386-*-openbsd*: Add.
+       powerpc-*-beos*: Add.
+       AM_CONDITIONAL X86_FREEBSD: Add.
+       AC_CONFIG_FILES: Add man/Makefile.
+
+       * include/ffi.h.in (FFI_FN): Change void (*)() to void (*)(void).
+
+2009-06-08  Andrew Haley  <aph@redhat.com>
+
+       * README: Import from libffi 3.0.8.
+
+2009-06-08  Andrew Haley  <aph@redhat.com>
+
+       * testsuite/libffi.call/err_bad_abi.c: Add xfails.
+       * testsuite/libffi.call/cls_longdouble_va.c: Add xfails.
+       * testsuite/libffi.call/cls_dbls_struct.c: Add xfail x86_64-*-linux-*.
+       * testsuite/libffi.call/err_bad_typedef.c: Add xfails.
+
+       * testsuite/libffi.call/stret_medium2.c: Add __UNUSED__ to args.
+       * testsuite/libffi.call/stret_medium.c: Likewise.
+       * testsuite/libffi.call/stret_large2.c: Likewise.
+       * testsuite/libffi.call/stret_large.c:  Likewise.
+
+2008-12-26  Timothy Wall  <twall@users.sf.net>
+
+       * testsuite/libffi.call/cls_longdouble.c,
+       testsuite/libffi.call/cls_longdouble_va.c,
+       testsuite/libffi.call/cls_align_longdouble.c,
+       testsuite/libffi.call/cls_align_longdouble_split.c,
+       testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected
+       failures on x86_64 cygwin/mingw.
+
+2008-12-22  Timothy Wall  <twall@users.sf.net>
+
+       * testsuite/libffi.call/closure_fn0.c,
+       testsuite/libffi.call/closure_fn1.c,
+       testsuite/libffi.call/closure_fn2.c,
+       testsuite/libffi.call/closure_fn3.c,
+       testsuite/libffi.call/closure_fn4.c,
+       testsuite/libffi.call/closure_fn5.c,
+       testsuite/libffi.call/closure_fn6.c,
+       testsuite/libffi.call/closure_loc_fn0.c,
+       testsuite/libffi.call/closure_stdcall.c,
+       testsuite/libffi.call/cls_align_pointer.c,
+       testsuite/libffi.call/cls_pointer.c,
+       testsuite/libffi.call/cls_pointer_stack.c: use portable cast from
+       pointer to integer (intptr_t).
+       * testsuite/libffi.call/cls_longdouble.c: disable for win64.
+
+2008-07-24  Anthony Green  <green@redhat.com>
+
+       * testsuite/libffi.call/cls_dbls_struct.c,
+       testsuite/libffi.call/cls_double_va.c,
+       testsuite/libffi.call/cls_longdouble.c,
+       testsuite/libffi.call/cls_longdouble_va.c,
+       testsuite/libffi.call/cls_pointer.c,
+       testsuite/libffi.call/cls_pointer_stack.c,
+       testsuite/libffi.call/err_bad_abi.c: Clean up failures from
+       compiler warnings.
+
+2008-03-04  Anthony Green  <green@redhat.com>
+           Blake Chaffin
+           hos@tamanegi.org
+
+       * testsuite/libffi.call/cls_align_longdouble_split2.c
+         testsuite/libffi.call/cls_align_longdouble_split.c
+         testsuite/libffi.call/cls_dbls_struct.c
+         testsuite/libffi.call/cls_double_va.c
+         testsuite/libffi.call/cls_longdouble.c
+         testsuite/libffi.call/cls_longdouble_va.c
+         testsuite/libffi.call/cls_pointer.c
+         testsuite/libffi.call/cls_pointer_stack.c
+         testsuite/libffi.call/err_bad_abi.c
+         testsuite/libffi.call/err_bad_typedef.c
+         testsuite/libffi.call/stret_large2.c
+         testsuite/libffi.call/stret_large.c
+         testsuite/libffi.call/stret_medium2.c
+         testsuite/libffi.call/stret_medium.c: New tests from Apple.
+
+2009-06-05  Andrew Haley  <aph@redhat.com>
+
+       * src/x86/ffitarget.h, src/x86/ffi.c: Merge stdcall changes from
+       libffi.
+
+2009-06-04  Andrew Haley  <aph@redhat.com>
+
+       * src/x86/ffitarget.h, src/x86/win32.S, src/x86/ffi.c: Back out
+       stdcall changes.
+
+2008-02-26  Anthony Green  <green@redhat.com>
+           Thomas Heller  <theller@ctypes.org>
+
+       * src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C
+       comment.
+
+2008-02-03  Timothy Wall  <twall@users.sf.net>
+
+       * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return
+         offset based on code pointer, not data pointer.
+
+2008-01-31  Timothy Wall <twall@users.sf.net>
+
+       * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall
+       closures.
+       * src/x86/ffitarget.h: Increase size of trampoline for stdcall
+       closures.
+       * src/x86/win32.S: Add assembly for stdcall closure.
+       * src/x86/ffi.c: Initialize stdcall closure trampoline.
+
+2009-06-04  Andrew Haley  <aph@redhat.com>
+
+       * include/ffi.h.in: Change void (*)() to void (*)(void).
+       * src/x86/ffi.c: Likewise.
+
+2009-06-04  Andrew Haley  <aph@redhat.com>
+
+       * src/powerpc/ppc_closure.S: Insert licence header.
+       * src/powerpc/linux64_closure.S: Likewise.
+       * src/m68k/sysv.S: Likewise.
+
+       * src/sh64/ffi.c: Change void (*)() to void (*)(void).
+       * src/powerpc/ffi.c: Likewise.
+       * src/powerpc/ffi_darwin.c: Likewise.
+       * src/m32r/ffi.c: Likewise.
+       * src/sh64/ffi.c: Likewise.
+       * src/x86/ffi64.c: Likewise.
+       * src/alpha/ffi.c: Likewise.
+       * src/alpha/osf.S: Likewise.
+       * src/frv/ffi.c: Likewise.
+       * src/s390/ffi.c: Likewise.
+       * src/pa/ffi.c: Likewise.
+       * src/pa/hpux32.S: Likewise.
+       * src/ia64/unix.S: Likewise.
+       * src/ia64/ffi.c: Likewise.
+       * src/sparc/ffi.c: Likewise.
+       * src/mips/ffi.c: Likewise.
+       * src/sh/ffi.c: Likewise.
+
+2008-02-15  David Daney  <ddaney@avtrex.com>
+
+       * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE):
+       Define (conditionally), and use it to include cachectl.h.
+       (ffi_prep_closure_loc): Fix cache flushing.
+       * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define.
+
+2009-06-04  Andrew Haley  <aph@redhat.com>
+
+       include/ffi.h.in,
+       src/arm/ffitarget.h,
+       src/arm/ffi.c,
+       src/arm/sysv.S,
+       src/powerpc/ffitarget.h,
+       src/closures.c,
+       src/sh64/ffitarget.h,
+       src/sh64/ffi.c,
+       src/sh64/sysv.S,
+       src/types.c,
+       src/x86/ffi64.c,
+       src/x86/ffitarget.h,
+       src/x86/win32.S,
+       src/x86/darwin.S,
+       src/x86/ffi.c,
+       src/x86/sysv.S,
+       src/x86/unix64.S,
+       src/alpha/ffitarget.h,
+       src/alpha/ffi.c,
+       src/alpha/osf.S,
+       src/m68k/ffitarget.h,
+       src/frv/ffitarget.h,
+       src/frv/ffi.c,
+       src/s390/ffitarget.h,
+       src/s390/sysv.S,
+       src/cris/ffitarget.h,
+       src/pa/linux.S,
+       src/pa/ffitarget.h,
+       src/pa/ffi.c,
+       src/raw_api.c,
+       src/ia64/ffitarget.h,
+       src/ia64/unix.S,
+       src/ia64/ffi.c,
+       src/ia64/ia64_flags.h,
+       src/java_raw_api.c,
+       src/debug.c,
+       src/sparc/v9.S,
+       src/sparc/ffitarget.h,
+       src/sparc/ffi.c,
+       src/sparc/v8.S,
+       src/mips/ffitarget.h,
+       src/mips/n32.S,
+       src/mips/o32.S,
+       src/mips/ffi.c,
+       src/prep_cif.c,
+       src/sh/ffitarget.h,
+       src/sh/ffi.c,
+       src/sh/sysv.S: Update license text.
+
+2009-05-22  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+       * src/x86/win32.S (_ffi_closure_STDCALL):  New function.
+       (.eh_frame):  Add FDE for it.
+
+2009-05-22  Dave Korn  <dave.korn.cygwin@gmail.com>
+
+       * configure.ac:  Also check if assembler supports pc-relative
+       relocs on X86_WIN32 targets.
+       * configure:  Regenerate.
+       * src/x86/win32.S (ffi_prep_args):  Declare extern, not global.
+       (_ffi_call_SYSV):  Add missing function type symbol .def and
+       add EH markup labels.
+       (_ffi_call_STDCALL):  Likewise.
+       (_ffi_closure_SYSV):  Likewise.
+       (_ffi_closure_raw_SYSV):  Likewise.
+       (.eh_frame):  Add hand-crafted EH data.
+
+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.
+
+2008-01-24  David Edelsohn  <edelsohn@gnu.org>
+
+       * configure: Regenerate.
+
+2008-01-06  Andreas Tobler  <a.tobler@schweiz.org>
+
+       * src/x86/ffi.c (ffi_prep_cif_machdep): Fix thinko.
+
+2008-01-05  Andreas Tobler  <a.tobler@schweiz.org>
+
+       PR testsuite/32843
+       * src/x86/ffi.c (ffi_prep_cif_machdep): Add code for
+       signed/unsigned int8/16 for X86_DARWIN.
+       Updated copyright info.
+       Handle one and two byte structs with special cif->flags.
+       * src/x86/ffitarget.h: Add special types for one and two byte structs.
+       Updated copyright info.
+       * src/x86/darwin.S (ffi_call_SYSV): Rewrite to use a jump table like
+       sysv.S
+       Remove code to pop args from the stack after call.
+       Special-case signed/unsigned for int8/16, one and two byte structs.
+       (ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8,
+       FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32,
+       FFI_TYPE_SINT32.
+       Updated copyright info.
+
+2007-12-08  David Daney  <ddaney@avtrex.com>
+
+       * src/mips/n32.S (ffi_call_N32):  Replace dadd with ADDU, dsub with
+       SUBU, add with ADDU and use smaller code sequences.
+
+2007-12-07  David Daney  <ddaney@avtrex.com>
+
+       * src/mips/ffi.c (ffi_prep_cif_machdep): Handle long double return
+       type.
+
+2007-12-06  David Daney  <ddaney@avtrex.com>
+
+       * include/ffi.h.in (FFI_SIZEOF_JAVA_RAW): Define if not already
+       defined.
+       (ffi_java_raw): New typedef.
+       (ffi_java_raw_call, ffi_java_ptrarray_to_raw,
+       ffi_java_raw_to_ptrarray): Change parameter types from ffi_raw to
+       ffi_java_raw.
+       (ffi_java_raw_closure) : Same.
+       (ffi_prep_java_raw_closure, ffi_prep_java_raw_closure_loc): Change
+       parameter types.
+       * src/java_raw_api.c (ffi_java_raw_size):  Replace FFI_SIZEOF_ARG with
+       FFI_SIZEOF_JAVA_RAW.
+       (ffi_java_raw_to_ptrarray): Change type of raw to ffi_java_raw.
+       Replace FFI_SIZEOF_ARG with FFI_SIZEOF_JAVA_RAW. Use
+       sizeof(ffi_java_raw) for alignment calculations.
+       (ffi_java_ptrarray_to_raw): Same.
+       (ffi_java_rvalue_to_raw): Add special handling for FFI_TYPE_POINTER
+       if FFI_SIZEOF_JAVA_RAW == 4.
+       (ffi_java_raw_to_rvalue): Same.
+       (ffi_java_raw_call): Change type of raw to ffi_java_raw.
+       (ffi_java_translate_args): Same.
+       (ffi_prep_java_raw_closure_loc, ffi_prep_java_raw_closure): Change
+       parameter types.
+       * src/mips/ffitarget.h (FFI_SIZEOF_JAVA_RAW): Define for N32 ABI.
+
+2007-12-06  David Daney  <ddaney@avtrex.com>
+
+       * src/mips/n32.S (ffi_closure_N32): Use 64-bit add instruction on
+       pointer values.
+
+2007-12-01  Andreas Tobler  <a.tobler@schweiz.org>
+
+       PR libffi/31937
+       * src/powerpc/ffitarget.h: Introduce new ABI FFI_LINUX_SOFT_FLOAT.
+       Add local FFI_TYPE_UINT128 to handle soft-float long-double-128.
+       * src/powerpc/ffi.c: Distinguish between __NO_FPRS__ and not and
+       set the NUM_FPR_ARG_REGISTERS according to.
+       Add support for potential soft-float support under hard-float
+       architecture.
+       (ffi_prep_args_SYSV): Set NUM_FPR_ARG_REGISTERS to 0 in case of
+       FFI_LINUX_SOFT_FLOAT, handle float, doubles and long-doubles according
+       to the FFI_LINUX_SOFT_FLOAT ABI.
+       (ffi_prep_cif_machdep): Likewise.
+       (ffi_closure_helper_SYSV): Likewise.
+       * src/powerpc/ppc_closure.S: Make sure not to store float/double
+       on archs where __NO_FPRS__ is true.
+       Add FFI_TYPE_UINT128 support.
+       * src/powerpc/sysv.S: Add support for soft-float long-double-128.
+       Adjust copyright notice.
+
+2007-11-25  Andreas Tobler  <a.tobler@schweiz.org>
+
+       * src/closures.c: Move defintion of MAYBE_UNUSED from here to ...
+       * include/ffi_common.h: ... here.
+       Update copyright.
+
+2007-11-17  Andreas Tobler  <a.tobler@schweiz.org>
+
+       * src/powerpc/sysv.S: Load correct cr to compare if we have long double.
+       * src/powerpc/linux64.S: Likewise.
+       * src/powerpc/ffi.c: Add a comment to show which part goes into cr6.
+       * testsuite/libffi.call/return_ldl.c: New test.
+
+2007-09-04    <aph@redhat.com>
+
+       * src/arm/sysv.S (UNWIND): New.
+       (Whole file): Conditionally compile unwinder directives.
+       * src/arm/sysv.S: Add unwinder directives.
+
+       * src/arm/ffi.c (ffi_prep_args): Align structs by at least 4 bytes.
+       Only treat r0 as a struct address if we're actually returning a
+       struct by address.
+       Only copy the bytes that are actually within a struct.
+       (ffi_prep_cif_machdep): A Composite Type not larger than 4 bytes
+       is returned in r0, not passed by address.
+       (ffi_call): Allocate a word-sized temporary for the case where
+       a composite is returned in r0.
+       (ffi_prep_incoming_args_SYSV): Align as necessary.
+
+2007-08-05  Steven Newbury  <s_j_newbury@yahoo.co.uk>
+
+       * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Use __clear_cache instead of
+       directly using the sys_cacheflush syscall.
+
+2007-07-27  Andrew Haley  <aph@redhat.com>
+
+       * src/arm/sysv.S (ffi_closure_SYSV): Add soft-float.
+
+2007-09-03  Maciej W. Rozycki  <macro@linux-mips.org>
+
+       * Makefile.am: Unify MIPS_IRIX and MIPS_LINUX into MIPS.
+       * configure.ac: Likewise.
+       * Makefile.in: Regenerate.
+       * include/Makefile.in: Likewise.
+       * testsuite/Makefile.in: Likewise.
+       * configure: Likewise.
+
+2007-08-24  David Daney  <ddaney@avtrex.com>
+
+       * testsuite/libffi.call/return_sl.c: New test.
+
+2007-08-10  David Daney  <ddaney@avtrex.com>
+
+       * testsuite/libffi.call/cls_multi_ushort.c,
+       testsuite/libffi.call/cls_align_uint16.c,
+       testsuite/libffi.call/nested_struct1.c,
+       testsuite/libffi.call/nested_struct3.c,
+       testsuite/libffi.call/cls_7_1_byte.c,
+       testsuite/libffi.call/nested_struct5.c,
+       testsuite/libffi.call/cls_double.c,
+       testsuite/libffi.call/nested_struct7.c,
+       testsuite/libffi.call/cls_sint.c,
+       testsuite/libffi.call/nested_struct9.c,
+       testsuite/libffi.call/cls_20byte1.c,
+       testsuite/libffi.call/cls_multi_sshortchar.c,
+       testsuite/libffi.call/cls_align_sint64.c,
+       testsuite/libffi.call/cls_3byte2.c,
+       testsuite/libffi.call/cls_multi_schar.c,
+       testsuite/libffi.call/cls_multi_uchar.c,
+       testsuite/libffi.call/cls_19byte.c,
+       testsuite/libffi.call/cls_9byte1.c,
+       testsuite/libffi.call/cls_align_float.c,
+       testsuite/libffi.call/closure_fn1.c,
+       testsuite/libffi.call/problem1.c,
+       testsuite/libffi.call/closure_fn3.c,
+       testsuite/libffi.call/cls_sshort.c,
+       testsuite/libffi.call/closure_fn5.c,
+       testsuite/libffi.call/cls_align_double.c,
+       testsuite/libffi.call/nested_struct.c,
+       testsuite/libffi.call/cls_2byte.c,
+       testsuite/libffi.call/nested_struct10.c,
+       testsuite/libffi.call/cls_4byte.c,
+       testsuite/libffi.call/cls_6byte.c,
+       testsuite/libffi.call/cls_8byte.c,
+       testsuite/libffi.call/cls_multi_sshort.c,
+       testsuite/libffi.call/cls_align_sint16.c,
+       testsuite/libffi.call/cls_align_uint32.c,
+       testsuite/libffi.call/cls_20byte.c,
+       testsuite/libffi.call/cls_float.c,
+       testsuite/libffi.call/nested_struct2.c,
+       testsuite/libffi.call/cls_5_1_byte.c,
+       testsuite/libffi.call/nested_struct4.c,
+       testsuite/libffi.call/cls_24byte.c,
+       testsuite/libffi.call/nested_struct6.c,
+       testsuite/libffi.call/cls_64byte.c,
+       testsuite/libffi.call/nested_struct8.c,
+       testsuite/libffi.call/cls_uint.c,
+       testsuite/libffi.call/cls_multi_ushortchar.c,
+       testsuite/libffi.call/cls_schar.c,
+       testsuite/libffi.call/cls_uchar.c,
+       testsuite/libffi.call/cls_align_uint64.c,
+       testsuite/libffi.call/cls_ulonglong.c,
+       testsuite/libffi.call/cls_align_longdouble.c,
+       testsuite/libffi.call/cls_1_1byte.c,
+       testsuite/libffi.call/cls_12byte.c,
+       testsuite/libffi.call/cls_3_1byte.c,
+       testsuite/libffi.call/cls_3byte1.c,
+       testsuite/libffi.call/cls_4_1byte.c,
+       testsuite/libffi.call/cls_6_1_byte.c,
+       testsuite/libffi.call/cls_16byte.c,
+       testsuite/libffi.call/cls_18byte.c,
+       testsuite/libffi.call/closure_fn0.c,
+       testsuite/libffi.call/cls_9byte2.c,
+       testsuite/libffi.call/closure_fn2.c,
+       testsuite/libffi.call/closure_fn4.c,
+       testsuite/libffi.call/cls_ushort.c,
+       testsuite/libffi.call/closure_fn6.c,
+       testsuite/libffi.call/cls_5byte.c,
+       testsuite/libffi.call/cls_align_pointer.c,
+       testsuite/libffi.call/cls_7byte.c,
+       testsuite/libffi.call/cls_align_sint32.c,
+       testsuite/libffi.special/unwindtest_ffi_call.cc,
+       testsuite/libffi.special/unwindtest.cc: Remove xfail for mips64*-*-*.
+
+2007-08-10  David Daney  <ddaney@avtrex.com>
+
+       PR libffi/28313
+       * configure.ac: Don't treat mips64 as a special case.
+       * Makefile.am (nodist_libffi_la_SOURCES): Add n32.S.
+       * configure: Regenerate
+       * Makefile.in: Ditto.
+       * fficonfig.h.in: Ditto.
+       * src/mips/ffitarget.h (REG_L, REG_S, SUBU, ADDU, SRL, LI): Indent.
+       (LA, EH_FRAME_ALIGN, FDE_ADDR_BYTES): New preprocessor macros.
+       (FFI_DEFAULT_ABI): Set for n64 case.
+       (FFI_CLOSURES, FFI_TRAMPOLINE_SIZE): Define for n32 and n64 cases.
+       * src/mips/n32.S (ffi_call_N32): Add debug macros and labels for FDE.
+       (ffi_closure_N32): New function.
+       (.eh_frame): New section
+       * src/mips/o32.S: Clean up comments.
+       (ffi_closure_O32): Pass ffi_closure parameter in $12.
+       * src/mips/ffi.c: Use FFI_MIPS_N32 instead of
+       _MIPS_SIM == _ABIN32 throughout.
+       (FFI_MIPS_STOP_HERE): New, use in place of
+       ffi_stop_here.
+       (ffi_prep_args): Use unsigned long to hold pointer values.  Rewrite
+       to support n32/n64 ABIs.
+       (calc_n32_struct_flags): Rewrite.
+       (calc_n32_return_struct_flags): Remove unused variable.  Reverse
+       position of flag bits.
+       (ffi_prep_cif_machdep): Rewrite n32 portion.
+       (ffi_call): Enable for n64.  Add special handling for small structure
+       return values.
+       (ffi_prep_closure_loc): Add n32 and n64 support.
+       (ffi_closure_mips_inner_O32): Add cast to silence warning.
+       (copy_struct_N32, ffi_closure_mips_inner_N32): New functions.
+
+2007-08-08  David Daney  <ddaney@avtrex.com>
+
+       * testsuite/libffi.call/ffitest.h (ffi_type_mylong): Remove definition.
+       * testsuite/libffi.call/cls_align_uint16.c (main): Use correct type
+       specifiers.
+       * testsuite/libffi.call/nested_struct1.c (main): Ditto.
+       * testsuite/libffi.call/cls_sint.c (main): Ditto.
+       * testsuite/libffi.call/nested_struct9.c (main): Ditto.
+       * testsuite/libffi.call/cls_20byte1.c (main): Ditto.
+       * testsuite/libffi.call/cls_9byte1.c (main): Ditto.
+       * testsuite/libffi.call/closure_fn1.c (main): Ditto.
+       * testsuite/libffi.call/closure_fn3.c (main): Ditto.
+       * testsuite/libffi.call/return_dbl2.c (main): Ditto.
+       * testsuite/libffi.call/cls_sshort.c (main): Ditto.
+       * testsuite/libffi.call/return_fl3.c (main): Ditto.
+       * testsuite/libffi.call/closure_fn5.c (main): Ditto.
+       * testsuite/libffi.call/nested_struct.c (main): Ditto.
+       * testsuite/libffi.call/nested_struct10.c (main): Ditto.
+       * testsuite/libffi.call/return_ll1.c (main): Ditto.
+       * testsuite/libffi.call/cls_8byte.c (main): Ditto.
+       * testsuite/libffi.call/cls_align_uint32.c (main): Ditto.
+       * testsuite/libffi.call/cls_align_sint16.c (main): Ditto.
+       * testsuite/libffi.call/cls_20byte.c (main): Ditto.
+       * testsuite/libffi.call/nested_struct2.c (main): Ditto.
+       * testsuite/libffi.call/cls_24byte.c (main): Ditto.
+       * testsuite/libffi.call/nested_struct6.c (main): Ditto.
+       * testsuite/libffi.call/cls_uint.c (main): Ditto.
+       * testsuite/libffi.call/cls_12byte.c (main): Ditto.
+       * testsuite/libffi.call/cls_16byte.c (main): Ditto.
+       * testsuite/libffi.call/closure_fn0.c (main): Ditto.
+       * testsuite/libffi.call/cls_9byte2.c (main): Ditto.
+       * testsuite/libffi.call/closure_fn2.c (main): Ditto.
+       * testsuite/libffi.call/return_dbl1.c (main): Ditto.
+       * testsuite/libffi.call/closure_fn4.c (main): Ditto.
+       * testsuite/libffi.call/closure_fn6.c (main): Ditto.
+       * testsuite/libffi.call/cls_align_sint32.c (main): Ditto.
+
+2007-08-07  Andrew Haley  <aph@redhat.com>
+
+       * src/x86/sysv.S (ffi_closure_raw_SYSV): Fix typo in previous
+       checkin.
+
+2007-08-06  Andrew Haley  <aph@redhat.com>
+
+       PR testsuite/32843
+       * src/x86/sysv.S (ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8,
+       FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32,
+       FFI_TYPE_SINT32.
+
+2007-08-02  David Daney  <ddaney@avtrex.com>
+
+       * testsuite/libffi.call/return_ul.c (main): Define return type as
+       ffi_arg.  Use proper printf conversion specifier.
+
+2007-07-30  Andrew Haley  <aph@redhat.com>
+
+       PR testsuite/32843
+       * src/x86/ffi.c (ffi_prep_cif_machdep): in x86 case, add code for
+       signed/unsigned int8/16.
+       * src/x86/sysv.S (ffi_call_SYSV): Rewrite to:
+       Use a jump table.
+       Remove code to pop args from the stack after call.
+       Special-case signed/unsigned int8/16.
+       * testsuite/libffi.call/return_sc.c (main): Revert.
+
+2007-07-26  Richard Guenther  <rguenther@suse.de>
+
+       PR testsuite/32843
+       * testsuite/libffi.call/return_sc.c (main): Verify call
+       result as signed char, not ffi_arg.
+
+2007-07-16  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * configure.ac (i?86-*-solaris2.1[0-9]): Set TARGET to X86_64.
+       * configure: Regenerate.
+
+2007-07-11  David Daney  <ddaney@avtrex.com>
+
+       * src/mips/ffi.c: Don't include sys/cachectl.h.
+       (ffi_prep_closure_loc): Use __builtin___clear_cache() instead of
+       cacheflush().
+
+2007-05-18  Aurelien Jarno  <aurelien@aurel32.net>
+
+       * src/arm/ffi.c (ffi_prep_closure_loc): Renamed and ajusted
+       from (ffi_prep_closure): ... this.
+       (FFI_INIT_TRAMPOLINE): Adjust.
+
+2005-12-31  Phil Blundell  <pb@reciva.com>
+
+       * src/arm/ffi.c (ffi_prep_incoming_args_SYSV,
+       ffi_closure_SYSV_inner, ffi_prep_closure): New, add closure support.
+       * src/arm/sysv.S(ffi_closure_SYSV): Likewise.
+       * src/arm/ffitarget.h (FFI_TRAMPOLINE_SIZE): Likewise.
+       (FFI_CLOSURES): Enable closure support.
+
+2007-07-03  Andrew Haley  <aph@hedges.billgatliff.com>
+
+       * testsuite/libffi.call/cls_multi_ushort.c,
+       testsuite/libffi.call/cls_align_uint16.c,
+       testsuite/libffi.call/nested_struct1.c,
+       testsuite/libffi.call/nested_struct3.c,
+       testsuite/libffi.call/cls_7_1_byte.c,
+       testsuite/libffi.call/cls_double.c,
+       testsuite/libffi.call/nested_struct5.c,
+       testsuite/libffi.call/nested_struct7.c,
+       testsuite/libffi.call/cls_sint.c,
+       testsuite/libffi.call/nested_struct9.c,
+       testsuite/libffi.call/cls_20byte1.c,
+       testsuite/libffi.call/cls_multi_sshortchar.c,
+       testsuite/libffi.call/cls_align_sint64.c,
+       testsuite/libffi.call/cls_3byte2.c,
+       testsuite/libffi.call/cls_multi_schar.c,
+       testsuite/libffi.call/cls_multi_uchar.c,
+       testsuite/libffi.call/cls_19byte.c,
+       testsuite/libffi.call/cls_9byte1.c,
+       testsuite/libffi.call/cls_align_float.c,
+       testsuite/libffi.call/closure_fn1.c,
+       testsuite/libffi.call/problem1.c,
+       testsuite/libffi.call/closure_fn3.c,
+       testsuite/libffi.call/cls_sshort.c,
+       testsuite/libffi.call/closure_fn5.c,
+       testsuite/libffi.call/cls_align_double.c,
+       testsuite/libffi.call/cls_2byte.c,
+       testsuite/libffi.call/nested_struct.c,
+       testsuite/libffi.call/nested_struct10.c,
+       testsuite/libffi.call/cls_4byte.c,
+       testsuite/libffi.call/cls_6byte.c,
+       testsuite/libffi.call/cls_8byte.c,
+       testsuite/libffi.call/cls_multi_sshort.c,
+       testsuite/libffi.call/cls_align_uint32.c,
+       testsuite/libffi.call/cls_align_sint16.c,
+       testsuite/libffi.call/cls_float.c,
+       testsuite/libffi.call/cls_20byte.c,
+       testsuite/libffi.call/cls_5_1_byte.c,
+       testsuite/libffi.call/nested_struct2.c,
+       testsuite/libffi.call/cls_24byte.c,
+       testsuite/libffi.call/nested_struct4.c,
+       testsuite/libffi.call/nested_struct6.c,
+       testsuite/libffi.call/cls_64byte.c,
+       testsuite/libffi.call/nested_struct8.c,
+       testsuite/libffi.call/cls_uint.c,
+       testsuite/libffi.call/cls_multi_ushortchar.c,
+       testsuite/libffi.call/cls_schar.c,
+       testsuite/libffi.call/cls_uchar.c,
+       testsuite/libffi.call/cls_align_uint64.c,
+       testsuite/libffi.call/cls_ulonglong.c,
+       testsuite/libffi.call/cls_align_longdouble.c,
+       testsuite/libffi.call/cls_1_1byte.c,
+       testsuite/libffi.call/cls_12byte.c,
+       testsuite/libffi.call/cls_3_1byte.c,
+       testsuite/libffi.call/cls_3byte1.c,
+       testsuite/libffi.call/cls_4_1byte.c,
+       testsuite/libffi.call/cls_6_1_byte.c,
+       testsuite/libffi.call/cls_16byte.c,
+       testsuite/libffi.call/cls_18byte.c,
+       testsuite/libffi.call/closure_fn0.c,
+       testsuite/libffi.call/cls_9byte2.c,
+       testsuite/libffi.call/closure_fn2.c,
+       testsuite/libffi.call/closure_fn4.c,
+       testsuite/libffi.call/cls_ushort.c,
+       testsuite/libffi.call/closure_fn6.c,
+       testsuite/libffi.call/cls_5byte.c,
+       testsuite/libffi.call/cls_align_pointer.c,
+       testsuite/libffi.call/cls_7byte.c,
+       testsuite/libffi.call/cls_align_sint32.c,
+       testsuite/libffi.special/unwindtest_ffi_call.cc,
+       testsuite/libffi.special/unwindtest.cc: Enable for ARM.
+
+2007-07-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * aclocal.m4: Regenerated.
+
+2007-06-02  Paolo Bonzini  <bonzini@gnu.org>
+
+       * configure: Regenerate.
+
+2007-05-23  Steve Ellcey  <sje@cup.hp.com>
+
+       * Makefile.in: Regenerate.
+       * configure: Regenerate.
+       * aclocal.m4: Regenerate.
+       * include/Makefile.in: Regenerate.
+       * testsuite/Makefile.in: Regenerate.
+
+2007-05-10  Roman Zippel <zippel@linux-m68k.org>
+
+       * src/m68k/ffi.c (ffi_prep_incoming_args_SYSV,
+       ffi_closure_SYSV_inner,ffi_prep_closure): New, add closure support.
+       * src/m68k/sysv.S(ffi_closure_SYSV,ffi_closure_struct_SYSV): Likewise.
+       * src/m68k/ffitarget.h (FFI_TRAMPOLINE_SIZE): Likewise.
+       (FFI_CLOSURES): Enable closure support.
+
+2007-05-10  Roman Zippel <zippel@linux-m68k.org>
+
+       * configure.ac (HAVE_AS_CFI_PSEUDO_OP): New test.
+       * configure: Regenerate.
+       * fficonfig.h.in: Regenerate.
+       * src/m68k/sysv.S (CFI_STARTPROC,CFI_ENDPROC,
+       CFI_OFFSET,CFI_DEF_CFA): New macros.
+       (ffi_call_SYSV): Add callframe annotation.
+
+2007-05-10  Roman Zippel <zippel@linux-m68k.org>
+
+       * src/m68k/ffi.c (ffi_prep_args,ffi_prep_cif_machdep): Fix
+       numerous test suite failures.
+       * src/m68k/sysv.S (ffi_call_SYSV): Likewise.
+
+2007-04-11  Paolo Bonzini  <bonzini@gnu.org>
+
+       * Makefile.am (EXTRA_DIST): Bring up to date.
+       * Makefile.in: Regenerate.
+       * src/frv/eabi.S: Remove RCS keyword.
+
+2007-04-06  Richard Henderson  <rth@redhat.com>
+
+       * configure.ac: Tidy target case.
+       (HAVE_LONG_DOUBLE): Allow the target to override.
+       * configure: Regenerate.
+       * include/ffi.h.in: Don't define ffi_type_foo if
+       LIBFFI_HIDE_BASIC_TYPES is defined.
+       (ffi_type_longdouble): If not HAVE_LONG_DOUBLE, define
+       to ffi_type_double.
+       * types.c (LIBFFI_HIDE_BASIC_TYPES): Define.
+       (FFI_TYPEDEF, ffi_type_void): Mark the data const.
+       (ffi_type_longdouble): Special case for Alpha.  Don't define
+       if long double == double.
+
+       * src/alpha/ffi.c (FFI_TYPE_LONGDOUBLE): Assert unique value.
+       (ffi_prep_cif_machdep): Handle it as the 128-bit type.
+       (ffi_call, ffi_closure_osf_inner): Likewise.
+       (ffi_closure_osf_inner): Likewise.  Mark hidden.
+       (ffi_call_osf, ffi_closure_osf): Mark hidden.
+       * src/alpha/ffitarget.h (FFI_LAST_ABI): Tidy definition.
+       * src/alpha/osf.S (ffi_call_osf, ffi_closure_osf): Mark hidden.
+       (load_table): Handle 128-bit long double.
+
+       * testsuite/libffi.call/float4.c: Add -mieee for alpha.
+
+2007-04-06  Tom Tromey  <tromey@redhat.com>
+
+       PR libffi/31491:
+       * README: Fixed bug in example.
+
+2007-04-03  Jakub Jelinek  <jakub@redhat.com>
+
+       * src/closures.c: Include sys/statfs.h.
+       (_GNU_SOURCE): Define on Linux.
+       (FFI_MMAP_EXEC_SELINUX): Define.
+       (selinux_enabled): New variable.
+       (selinux_enabled_check): New function.
+       (is_selinux_enabled): Define.
+       (dlmmap): Use it.
+
+2007-03-24  Uros Bizjak  <ubizjak@gmail.com>
+
+       * testsuite/libffi.call/return_fl2.c (return_fl): Mark as static.
+       Use 'volatile float sum' to create sum of floats to avoid false
+       negative due to excess precision on ix86 targets.
+       (main): Ditto.
+
+2007-03-08  Alexandre Oliva  <aoliva@redhat.com>
+
+       * src/powerpc/ffi.c (flush_icache): Fix left-over from previous
+       patch.
+       (ffi_prep_closure_loc): Remove unneeded casts.  Add needed ones.
+
+2007-03-07  Alexandre Oliva  <aoliva@redhat.com>
+
+       * include/ffi.h.in (ffi_closure_alloc, ffi_closure_free): New.
+       (ffi_prep_closure_loc): New.
+       (ffi_prep_raw_closure_loc): New.
+       (ffi_prep_java_raw_closure_loc): New.
+       * src/closures.c: New file.
+       * src/dlmalloc.c [FFI_MMAP_EXEC_WRIT] (struct malloc_segment):
+       Replace sflags with exec_offset.
+       [FFI_MMAP_EXEC_WRIT] (mmap_exec_offset, add_segment_exec_offset,
+       sub_segment_exec_offset): New macros.
+       (get_segment_flags, set_segment_flags, check_segment_merge): New
+       macros.
+       (is_mmapped_segment, is_extern_segment): Use get_segment_flags.
+       (add_segment, sys_alloc, create_mspace, create_mspace_with_base,
+       destroy_mspace): Use new macros.
+       (sys_alloc): Silence warning.
+       * Makefile.am (libffi_la_SOURCES): Add src/closures.c.
+       * Makefile.in: Rebuilt.
+       * src/prep_cif [FFI_CLOSURES] (ffi_prep_closure): Implement in
+       terms of ffi_prep_closure_loc.
+       * src/raw_api.c (ffi_prep_raw_closure_loc): Renamed and adjusted
+       from...
+       (ffi_prep_raw_closure): ... this.  Re-implement in terms of the
+       renamed version.
+       * src/java_raw_api (ffi_prep_java_raw_closure_loc): Renamed and
+       adjusted from...
+       (ffi_prep_java_raw_closure): ... this.  Re-implement in terms of
+       the renamed version.
+       * src/alpha/ffi.c (ffi_prep_closure_loc): Renamed from
+       (ffi_prep_closure): ... this.
+       * src/pa/ffi.c: Likewise.
+       * src/cris/ffi.c: Likewise.  Adjust.
+       * src/frv/ffi.c: Likewise.
+       * src/ia64/ffi.c: Likewise.
+       * src/mips/ffi.c: Likewise.
+       * src/powerpc/ffi_darwin.c: Likewise.
+       * src/s390/ffi.c: Likewise.
+       * src/sh/ffi.c: Likewise.
+       * src/sh64/ffi.c: Likewise.
+       * src/sparc/ffi.c: Likewise.
+       * src/x86/ffi64.c: Likewise.
+       * src/x86/ffi.c: Likewise.
+       (FFI_INIT_TRAMPOLINE): Adjust.
+       (ffi_prep_raw_closure_loc): Renamed and adjusted from...
+       (ffi_prep_raw_closure): ... this.
+       * src/powerpc/ffi.c (ffi_prep_closure_loc): Renamed from
+       (ffi_prep_closure): ... this.
+       (flush_icache): Adjust.
+
+2007-03-07  Alexandre Oliva  <aoliva@redhat.com>
+
+       * src/dlmalloc.c: New file, imported version 2.8.3 of Doug
+       Lea's malloc.
+
+2007-03-01  Brooks Moses  <brooks.moses@codesourcery.com>
+
+       * Makefile.am: Add dummy install-pdf target.
+       * Makefile.in: Regenerate
+
+2007-02-13  Andreas Krebbel  <krebbel1@de.ibm.com>
+
+       * src/s390/ffi.c (ffi_prep_args, ffi_prep_cif_machdep,
+       ffi_closure_helper_SYSV): Add long double handling.
+
+2007-02-02  Jakub Jelinek  <jakub@redhat.com>
+
+       * src/powerpc/linux64.S (ffi_call_LINUX64): Move restore of r2
+       immediately after bctrl instruction.
+
+2007-01-18  Alexandre Oliva  <aoliva@redhat.com>
+
+       * Makefile.am (all-recursive, install-recursive,
+       mostlyclean-recursive, clean-recursive, distclean-recursive,
+       maintainer-clean-recursive): Add missing targets.
+       * Makefile.in: Rebuilt.
+
+2006-12-14  Andreas Tobler  <a.tobler@schweiz.org>
+
+       * configure.ac: Add TARGET for x86_64-*-darwin*.
+       * Makefile.am (nodist_libffi_la_SOURCES): Add rules for 64-bit sources
+       for X86_DARWIN.
+       * src/x86/ffitarget.h: Set trampoline size for x86_64-*-darwin*.
+       * src/x86/darwin64.S: New file for x86_64-*-darwin* support.
+       * configure: Regenerate.
+       * Makefile.in: Regenerate.
+       * include/Makefile.in: Regenerate.
+       * testsuite/Makefile.in: Regenerate.
+       * testsuite/libffi.special/unwindtest_ffi_call.cc: New test case for
+       ffi_call only.
+
+2006-12-13  Andreas Tobler <a.tobler@schweiz.org>
+
+       * aclocal.m4: Regenerate with aclocal -I .. as written in the
+       Makefile.am.
+
+2006-10-31  Geoffrey Keating  <geoffk@apple.com>
+
+       * src/powerpc/ffi_darwin.c (darwin_adjust_aggregate_sizes): New.
+       (ffi_prep_cif_machdep): Call darwin_adjust_aggregate_sizes for
+       Darwin.
+       * testsuite/libffi.call/nested_struct4.c: Remove Darwin XFAIL.
+       * testsuite/libffi.call/nested_struct6.c: Remove Darwin XFAIL.
+
+2006-10-10  Paolo Bonzini  <bonzini@gnu.org>
+           Sandro Tolaini  <tolaini@libero.it>
+
+       * configure.ac [i*86-*-darwin*]: Set X86_DARWIN symbol and
+       conditional.
+       * configure: Regenerated.
+       * Makefile.am (nodist_libffi_la_SOURCES) [X86_DARWIN]: New case.
+       (EXTRA_DIST): Add src/x86/darwin.S.
+       * Makefile.in: Regenerated.
+       * include/Makefile.in: Regenerated.
+       * testsuite/Makefile.in: Regenerated.
+
+       * src/x86/ffi.c (ffi_prep_cif_machdep) [X86_DARWIN]: Treat like
+       X86_WIN32, and additionally align stack to 16 bytes.
+       * src/x86/darwin.S: New, based on sysv.S.
+       * src/prep_cif.c (ffi_prep_cif) [X86_DARWIN]: Align > 8-byte structs.
+
+2006-09-12  David Daney  <ddaney@avtrex.com>
+
+       PR libffi/23935
+       * include/Makefile.am: Install both ffi.h and ffitarget.h in
+       $(libdir)/gcc/$(target_alias)/$(gcc_version)/include.
+       * aclocal.m4: Regenerated for automake 1.9.6.
+       * Makefile.in: Regenerated.
+       * include/Makefile.in: Regenerated.
+       * testsuite/Makefile.in: Regenerated.
+
+2006-08-17  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * include/ffi_common.h (struct): Revert accidental commit.
+
+2006-08-15  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * include/ffi_common.h: Remove lint directives.
+       * include/ffi.h.in: Likewise.
+
+2006-07-25  Torsten Schoenfeld  <kaffeetisch@gmx.de>
+
+       * include/ffi.h.in (ffi_type_ulong, ffi_type_slong): Define correctly
+       for 32-bit architectures.
+       * testsuite/libffi.call/return_ul.c: New test case.
+
+2006-07-19  David Daney  <ddaney@avtrex.com>
+
+       * testsuite/libffi.call/closure_fn6.c: Remove xfail for mips,
+       xfail remains for mips64.
+
+2006-05-23  Carlos O'Donell  <carlos@codesourcery.com>
+
+       * Makefile.am: Add install-html target. Add install-html to .PHONY
+       * Makefile.in: Regenerate.
+       * aclocal.m4: Regenerate.
+       * include/Makefile.in: Regenerate.
+       * testsuite/Makefile.in: Regenerate.
+
+2006-05-18  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       * pa/ffi.c (ffi_prep_args_pa32): Load floating point arguments from
+       stack slot.
+
+2006-04-22  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * README: Remove notice about 'Crazy Comments'.
+       * src/debug.c: Remove lint directives. Cleanup white spaces.
+       * src/java_raw_api.c: Likewise.
+       * src/prep_cif.c: Likewise.
+       * src/raw_api.c: Likewise.
+       * src/ffitest.c: Delete. No longer needed, all test cases migrated
+       to the testsuite.
+       * src/arm/ffi.c: Remove lint directives.
+       * src/m32r/ffi.c: Likewise.
+       * src/pa/ffi.c: Likewise.
+       * src/powerpc/ffi.c: Likewise.
+       * src/powerpc/ffi_darwin.c: Likewise.
+       * src/sh/ffi.c: Likewise.
+       * src/sh64/ffi.c: Likewise.
+       * src/x86/ffi.c: Likewise.
+       * testsuite/libffi.call/float2.c: Likewise.
+       * testsuite/libffi.call/promotion.c: Likewise.
+       * testsuite/libffi.call/struct1.c: Likewise.
+
+2006-04-13  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/pa/hpux32.S: Correct unwind offset calculation for
+       ffi_closure_pa32.
+       * src/pa/linux.S: Likewise.
+
+2006-04-12  James E Wilson  <wilson@specifix.com>
+
+       PR libgcj/26483
+       * src/ia64/ffi.c (stf_spill, ldf_fill): Rewrite as macros.
+       (hfa_type_load): Call stf_spill.
+       (hfa_type_store): Call ldf_fill.
+       (ffi_call): Adjust calls to above routines.  Add local temps for
+       macro result.
+
+2006-04-10  Matthias Klose  <doko@debian.org>
+
+       * testsuite/lib/libffi-dg.exp (libffi-init): Recognize multilib
+       directory names containing underscores.
+
+2006-04-07  James E Wilson  <wilson@specifix.com>
+
+       * testsuite/libffi.call/float4.c: New testcase.
+
+2006-04-05  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+           Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * Makefile.am: Add PA_HPUX port.
+       * Makefile.in: Regenerate.
+       * include/Makefile.in: Likewise.
+       * testsuite/Makefile.in: Likewise.
+       * configure.ac: Add PA_HPUX rules.
+       * configure: Regenerate.
+       * src/pa/ffitarget.h: Rename linux target to PA_LINUX.
+       Add PA_HPUX and PA64_HPUX.
+       Rename FFI_LINUX ABI to FFI_PA32 ABI.
+       (FFI_TRAMPOLINE_SIZE): Define for 32-bit HP-UX targets.
+       (FFI_TYPE_SMALL_STRUCT2): Define.
+       (FFI_TYPE_SMALL_STRUCT4): Likewise.
+       (FFI_TYPE_SMALL_STRUCT8): Likewise.
+       (FFI_TYPE_SMALL_STRUCT3): Redefine.
+       (FFI_TYPE_SMALL_STRUCT5): Likewise.
+       (FFI_TYPE_SMALL_STRUCT6): Likewise.
+       (FFI_TYPE_SMALL_STRUCT7): Likewise.
+       * src/pa/ffi.c (ROUND_DOWN): Delete.
+       (fldw, fstw, fldd, fstd): Use '__asm__'.
+       (ffi_struct_type): Add support for FFI_TYPE_SMALL_STRUCT2,
+       FFI_TYPE_SMALL_STRUCT4 and FFI_TYPE_SMALL_STRUCT8.
+       (ffi_prep_args_LINUX): Rename to ffi_prep_args_pa32. Update comment.
+       Simplify incrementing of stack slot variable. Change type of local
+       'n' to unsigned int.
+       (ffi_size_stack_LINUX): Rename to ffi_size_stack_pa32. Handle long
+       double on PA_HPUX.
+       (ffi_prep_cif_machdep): Likewise.
+       (ffi_call): Likewise.
+       (ffi_closure_inner_LINUX): Rename to ffi_closure_inner_pa32. Change
+       return type to ffi_status. Simplify incrementing of stack slot
+       variable. Only copy floating point argument registers when PA_LINUX
+       is true. Reformat debug statement.
+       Add support for FFI_TYPE_SMALL_STRUCT2, FFI_TYPE_SMALL_STRUCT4 and
+       FFI_TYPE_SMALL_STRUCT8.
+       (ffi_closure_LINUX): Rename to ffi_closure_pa32. Add 'extern' to
+       declaration.
+       (ffi_prep_closure): Make linux trampoline conditional on PA_LINUX.
+       Add nops to cache flush.  Add trampoline for PA_HPUX.
+       * src/pa/hpux32.S: New file.
+       * src/pa/linux.S (ffi_call_LINUX): Rename to ffi_call_pa32. Rename
+       ffi_prep_args_LINUX to ffi_prep_args_pa32.
+       Localize labels. Add support for 2, 4 and 8-byte small structs. Handle
+       unaligned destinations in 3, 5, 6 and 7-byte small structs. Order
+       argument type checks so that common argument types appear first.
+       (ffi_closure_LINUX): Rename to ffi_closure_pa32. Rename
+       ffi_closure_inner_LINUX to ffi_closure_inner_pa32.
+
+2006-03-24  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/powerpc/ffitarget.h (enum ffi_abi): Add FFI_LINUX.  Default
+       for 32-bit using IBM extended double format.  Fix FFI_LAST_ABI.
+       * src/powerpc/ffi.c (ffi_prep_args_SYSV): Handle linux variant of
+       FFI_TYPE_LONGDOUBLE.
+       (ffi_prep_args64): Assert using IBM extended double.
+       (ffi_prep_cif_machdep): Don't munge FFI_TYPE_LONGDOUBLE type.
+       Handle FFI_LINUX FFI_TYPE_LONGDOUBLE return and args.
+       (ffi_call): Handle FFI_LINUX.
+       (ffi_closure_helper_SYSV): Non FFI_LINUX long double return needs
+       gpr3 return pointer as for struct return.  Handle FFI_LINUX
+       FFI_TYPE_LONGDOUBLE return and args.  Don't increment "nf"
+       unnecessarily.
+       * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Load both f1 and f2
+       for FFI_TYPE_LONGDOUBLE.  Move epilogue insns into case table.
+       Don't use r6 as pointer to results, instead use sp offset.  Don't
+       make a special call to load lr with case table address, instead
+       use offset from previous call.
+       * src/powerpc/sysv.S (ffi_call_SYSV): Save long double return.
+       * src/powerpc/linux64.S (ffi_call_LINUX64): Simplify long double
+       return.
+
+2006-03-15  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh64/ffi.c (ffi_prep_cif_machdep): Handle float arguments
+       passed with FP registers correctly.
+       (ffi_closure_helper_SYSV): Likewise.
+       * src/sh64/sysv.S: Likewise.
+
+2006-03-01  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.special/unwindtest.cc (closure_test_fn): Mark cif,
+       args and userdata unused.
+       (closure_test_fn1): Mark cif and userdata unused.
+       (main): Remove unused res.
+
+2006-02-28  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/call.exp: Adjust FSF address. Add test runs for
+       -O2, -O3, -Os and the warning flags -W -Wall.
+       * testsuite/libffi.special/special.exp: Likewise.
+       * testsuite/libffi.call/ffitest.h: Add an __UNUSED__ macro to mark
+       unused parameter unused for gcc or else do nothing.
+       * testsuite/libffi.special/ffitestcxx.h: Likewise.
+       * testsuite/libffi.call/cls_12byte.c (cls_struct_12byte_gn): Mark cif
+       and userdata unused.
+       * testsuite/libffi.call/cls_16byte.c (cls_struct_16byte_gn): Likewise.
+       * testsuite/libffi.call/cls_18byte.c (cls_struct_18byte_gn): Likewise.
+       * testsuite/libffi.call/cls_19byte.c (cls_struct_19byte_gn): Likewise.
+       * testsuite/libffi.call/cls_1_1byte.c (cls_struct_1_1byte_gn): Likewise.
+       * testsuite/libffi.call/cls_20byte.c (cls_struct_20byte_gn): Likewise.
+       * testsuite/libffi.call/cls_20byte1.c (cls_struct_20byte_gn): Likewise.
+       * testsuite/libffi.call/cls_24byte.c (cls_struct_24byte_gn): Likewise.
+       * testsuite/libffi.call/cls_2byte.c (cls_struct_2byte_gn): Likewise.
+       * testsuite/libffi.call/cls_3_1byte.c (cls_struct_3_1byte_gn): Likewise.
+       * testsuite/libffi.call/cls_3byte1.c (cls_struct_3byte_gn): Likewise.
+       * testsuite/libffi.call/cls_3byte2.c (cls_struct_3byte_gn1): Likewise.
+       * testsuite/libffi.call/cls_4_1byte.c (cls_struct_4_1byte_gn): Likewise.
+       * testsuite/libffi.call/cls_4byte.c (cls_struct_4byte_gn): Likewise.
+       * testsuite/libffi.call/cls_5_1_byte.c (cls_struct_5byte_gn): Likewise.
+       * testsuite/libffi.call/cls_5byte.c (cls_struct_5byte_gn): Likewise.
+       * testsuite/libffi.call/cls_64byte.c (cls_struct_64byte_gn): Likewise.
+       * testsuite/libffi.call/cls_6_1_byte.c (cls_struct_6byte_gn): Likewise.
+       * testsuite/libffi.call/cls_6byte.c (cls_struct_6byte_gn): Likewise.
+       * testsuite/libffi.call/cls_7_1_byte.c (cls_struct_7byte_gn): Likewise.
+       * testsuite/libffi.call/cls_7byte.c (cls_struct_7byte_gn): Likewise.
+       * testsuite/libffi.call/cls_8byte.c (cls_struct_8byte_gn): Likewise.
+       * testsuite/libffi.call/cls_9byte1.c (cls_struct_9byte_gn): Likewise.
+       * testsuite/libffi.call/cls_9byte2.c (cls_struct_9byte_gn): Likewise.
+       * testsuite/libffi.call/cls_align_double.c (cls_struct_align_gn):
+       Likewise.
+       * testsuite/libffi.call/cls_align_float.c (cls_struct_align_gn):
+       Likewise.
+       * testsuite/libffi.call/cls_align_longdouble.c (cls_struct_align_gn):
+       Likewise.
+       * testsuite/libffi.call/cls_align_pointer.c (cls_struct_align_fn): Cast
+       void* to avoid compiler warning.
+       (main): Likewise.
+       (cls_struct_align_gn): Mark cif and userdata unused.
+       * testsuite/libffi.call/cls_align_sint16.c (cls_struct_align_gn):
+       Likewise.
+       * testsuite/libffi.call/cls_align_sint32.c (cls_struct_align_gn):
+       Likewise.
+       * testsuite/libffi.call/cls_align_sint64.c (cls_struct_align_gn):
+       Likewise.
+       * testsuite/libffi.call/cls_align_uint16.c (cls_struct_align_gn):
+       Likewise.
+       * testsuite/libffi.call/cls_align_uint32.c (cls_struct_align_gn):
+       Likewise.
+       * testsuite/libffi.call/cls_double.c (cls_ret_double_fn): Likewise.
+       * testsuite/libffi.call/cls_float.c (cls_ret_float_fn): Likewise.
+       * testsuite/libffi.call/cls_multi_schar.c (test_func_gn): Mark cif and
+       data unused.
+       (main): Cast res_call to silence gcc.
+       * testsuite/libffi.call/cls_multi_sshort.c (test_func_gn): Mark cif and
+       data unused.
+       (main): Cast res_call to silence gcc.
+       * testsuite/libffi.call/cls_multi_sshortchar.c (test_func_gn): Mark cif
+       and data unused.
+       (main): Cast res_call to silence gcc.
+       * testsuite/libffi.call/cls_multi_uchar.c (test_func_gn): Mark cif and
+       data unused.
+       (main): Cast res_call to silence gcc.
+       * testsuite/libffi.call/cls_multi_ushort.c (test_func_gn): Mark cif and
+       data unused.
+       (main): Cast res_call to silence gcc.
+       * testsuite/libffi.call/cls_multi_ushortchar.c (test_func_gn): Mark cif
+       and data unused.
+       (main): Cast res_call to silence gcc.
+       * testsuite/libffi.call/cls_schar.c (cls_ret_schar_fn): Mark cif and
+       userdata unused.
+       (cls_ret_schar_fn): Cast printf parameter to silence gcc.
+       * testsuite/libffi.call/cls_sint.c (cls_ret_sint_fn): Mark cif and
+       userdata unused.
+       (cls_ret_sint_fn): Cast printf parameter to silence gcc.
+       * testsuite/libffi.call/cls_sshort.c (cls_ret_sshort_fn): Mark cif and
+       userdata unused.
+       (cls_ret_sshort_fn): Cast printf parameter to silence gcc.
+       * testsuite/libffi.call/cls_uchar.c (cls_ret_uchar_fn):  Mark cif and
+       userdata unused.
+       (cls_ret_uchar_fn): Cast printf parameter to silence gcc.
+       * testsuite/libffi.call/cls_uint.c (cls_ret_uint_fn): Mark cif and
+       userdata unused.
+       (cls_ret_uint_fn): Cast printf parameter to silence gcc.
+       * testsuite/libffi.call/cls_ulonglong.c (cls_ret_ulonglong_fn): Mark cif
+       and userdata unused.
+       * testsuite/libffi.call/cls_ushort.c (cls_ret_ushort_fn): Mark cif and
+       userdata unused.
+       (cls_ret_ushort_fn): Cast printf parameter to silence gcc.
+       * testsuite/libffi.call/float.c (floating): Remove unused parameter e.
+       * testsuite/libffi.call/float1.c (main): Remove unused variable i.
+       Cleanup white spaces.
+       * testsuite/libffi.call/negint.c (checking): Remove unused variable i.
+       * testsuite/libffi.call/nested_struct.c (cls_struct_combined_gn): Mark
+       cif and userdata unused.
+       * testsuite/libffi.call/nested_struct1.c (cls_struct_combined_gn):
+       Likewise.
+       * testsuite/libffi.call/nested_struct10.c (B_gn): Likewise.
+       * testsuite/libffi.call/nested_struct2.c (B_fn): Adjust printf
+       formatters to silence gcc.
+       (B_gn): Mark cif and userdata unused.
+       * testsuite/libffi.call/nested_struct3.c (B_gn): Mark cif and userdata
+       unused.
+       * testsuite/libffi.call/nested_struct4.c: Mention related PR.
+       (B_gn): Mark cif and userdata unused.
+       * testsuite/libffi.call/nested_struct5.c (B_gn): Mark cif and userdata
+       unused.
+       * testsuite/libffi.call/nested_struct6.c: Mention related PR.
+       (B_gn): Mark cif and userdata unused.
+       * testsuite/libffi.call/nested_struct7.c (B_gn): Mark cif and userdata
+       unused.
+       * testsuite/libffi.call/nested_struct8.c (B_gn): Likewise.
+       * testsuite/libffi.call/nested_struct9.c (B_gn): Likewise.
+       * testsuite/libffi.call/problem1.c (stub): Likewise.
+       * testsuite/libffi.call/pyobjc-tc.c (main): Cast the result to silence
+       gcc.
+       * testsuite/libffi.call/return_fl2.c (return_fl): Add the note mentioned
+       in the last commit for this test case in the test case itself.
+       * testsuite/libffi.call/closure_fn0.c (closure_test_fn0): Mark cif as
+       unused.
+       * testsuite/libffi.call/closure_fn1.c (closure_test_fn1): Likewise.
+       * testsuite/libffi.call/closure_fn2.c (closure_test_fn2): Likewise.
+       * testsuite/libffi.call/closure_fn3.c (closure_test_fn3): Likewise.
+       * testsuite/libffi.call/closure_fn4.c (closure_test_fn0): Likewise.
+       * testsuite/libffi.call/closure_fn5.c (closure_test_fn5): Likewise.
+       * testsuite/libffi.call/closure_fn6.c (closure_test_fn0): Likewise.
+
+2006-02-22  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh/sysv.S: Fix register numbers in the FDE for
+       ffi_closure_SYSV.
+
+2006-02-20  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/return_fl2.c (return_fl): Remove static
+       declaration to avoid a false negative on ix86. See PR323.
+
+2006-02-18  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh/ffi.c (ffi_closure_helper_SYSV): Remove unused variable
+       and cast integer to void * if needed.  Update the pointer to
+       the FP register saved area correctly.
+
+2006-02-17  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/nested_struct6.c: XFAIL this test until PR25630
+       is fixed.
+       * testsuite/libffi.call/nested_struct4.c: Likewise.
+
+2006-02-16  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/return_dbl.c: New test case.
+       * testsuite/libffi.call/return_dbl1.c: Likewise.
+       * testsuite/libffi.call/return_dbl2.c: Likewise.
+       * testsuite/libffi.call/return_fl.c: Likewise.
+       * testsuite/libffi.call/return_fl1.c: Likewise.
+       * testsuite/libffi.call/return_fl2.c: Likewise.
+       * testsuite/libffi.call/return_fl3.c: Likewise.
+       * testsuite/libffi.call/closure_fn6.c: Likewise.
+
+       * testsuite/libffi.call/nested_struct2.c: Remove ffi_type_mylong
+       definition.
+       * testsuite/libffi.call/ffitest.h: Add ffi_type_mylong definition
+       here to be used by other test cases too.
+
+       * testsuite/libffi.call/nested_struct10.c: New test case.
+       * testsuite/libffi.call/nested_struct9.c: Likewise.
+       * testsuite/libffi.call/nested_struct8.c: Likewise.
+       * testsuite/libffi.call/nested_struct7.c: Likewise.
+       * testsuite/libffi.call/nested_struct6.c: Likewise.
+       * testsuite/libffi.call/nested_struct5.c: Likewise.
+       * testsuite/libffi.call/nested_struct4.c: Likewise.
+
+2006-01-21  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * configure.ac: Enable libffi for sparc64-*-freebsd*.
+       * configure: Rebuilt.
+
+2006-01-18  Jakub Jelinek  <jakub@redhat.com>
+
+       * src/powerpc/sysv.S (smst_two_register): Don't call __ashldi3,
+       instead do the shifting inline.
+       * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't compute %r5
+       shift count unconditionally.  Simplify load sequences for 1, 2, 3, 4
+       and 8 byte structs, for the remaining struct sizes don't call
+       __lshrdi3, instead do the shifting inline.
+
+2005-12-07  Thiemo Seufer  <ths@networkno.de>
+
+       * src/mips/ffitarget.h: Remove obsolete sgidefs.h include. Add
+       missing parentheses.
+       * src/mips/o32.S (ffi_call_O32): Code formatting. Define
+       and use A3_OFF, FP_OFF, RA_OFF. Micro-optimizations.
+       (ffi_closure_O32): Likewise, but with newly defined A3_OFF2,
+       A2_OFF2, A1_OFF2, A0_OFF2, RA_OFF2, FP_OFF2, S0_OFF2, GP_OFF2,
+       V1_OFF2, V0_OFF2, FA_1_1_OFF2, FA_1_0_OFF2, FA_0_1_OFF2,
+       FA_0_0_OFF2.
+       * src/mips/ffi.c (ffi_prep_args): Code formatting. Fix
+       endianness bugs.
+       (ffi_prep_closure): Improve trampoline instruction scheduling.
+       (ffi_closure_mips_inner_O32): Fix endianness bugs.
+
+2005-12-03  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/powerpc/ffi.c: Formatting.
+       (ffi_prep_args_SYSV): Avoid possible aliasing problems by using unions.
+       (ffi_prep_args64): Likewise.
+
+2005-09-30  Geoffrey Keating  <geoffk@apple.com>
+
+       * testsuite/lib/libffi-dg.exp (libffi_target_compile): For
+       darwin, use -shared-libgcc not -lgcc_s, and explain why.
+
+2005-09-26  Tom Tromey  <tromey@redhat.com>
+
+       * testsuite/libffi.call/float1.c (value_type): New typedef.
+       (CANARY): New define.
+       (main): Check for result buffer overflow.
+       * src/powerpc/linux64.S: Handle linux64 long double returns.
+       * src/powerpc/ffi.c (FLAG_RETURNS_128BITS): New constant.
+       (ffi_prep_cif_machdep): Handle linux64 long double returns.
+
+2005-08-25  Alan Modra  <amodra@bigpond.net.au>
+
+       PR target/23404
+       * src/powerpc/ffi.c (ffi_prep_args_SYSV): Correct placement of stack
+       homed fp args.
+       (ffi_status ffi_prep_cif_machdep): Correct stack sizing for same.
+
+2005-08-11  Jakub Jelinek  <jakub@redhat.com>
+
+       * configure.ac (HAVE_HIDDEN_VISIBILITY_ATTRIBUTE): New test.
+       (AH_BOTTOM): Add FFI_HIDDEN definition.
+       * configure: Rebuilt.
+       * fficonfig.h.in: Rebuilt.
+       * src/powerpc/ffi.c (hidden): Remove.
+       (ffi_closure_LINUX64, ffi_prep_args64, ffi_call_LINUX64,
+       ffi_closure_helper_LINUX64): Use FFI_HIDDEN instead of hidden.
+       * src/powerpc/linux64_closure.S (ffi_closure_LINUX64,
+       .ffi_closure_LINUX64): Use FFI_HIDDEN instead of .hidden.
+       * src/x86/ffi.c (ffi_closure_SYSV, ffi_closure_raw_SYSV): Remove,
+       add FFI_HIDDEN to its prototype.
+       (ffi_closure_SYSV_inner): New.
+       * src/x86/sysv.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New.
+       * src/x86/win32.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New.
+
+2005-08-10  Alfred M. Szmidt  <ams@gnu.org>
+
+       PR libffi/21819:
+       * configure: Rebuilt.
+       * configure.ac: Handle i*86-*-gnu*.
+
+2005-08-09  Jakub Jelinek  <jakub@redhat.com>
+
+       * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Use
+       DW_CFA_offset_extended_sf rather than
+       DW_CFA_GNU_negative_offset_extended.
+       * src/powerpc/sysv.S (ffi_call_SYSV): Likewise.
+
+2005-07-22  SUGIOKA Toshinobu  <sugioka@itonet.co.jp>
+
+       * src/sh/sysv.S (ffi_call_SYSV): Stop argument popping correctly
+       on sh3.
+       (ffi_closure_SYSV): Change the stack layout for sh3 struct argument.
+       * src/sh/ffi.c (ffi_prep_args): Fix sh3 argument copy, when it is
+       partially on register.
+       (ffi_closure_helper_SYSV): Likewise.
+       (ffi_prep_cif_machdep): Don't set too many cif->flags.
+
+2005-07-20  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh/ffi.c (ffi_call): Handle small structures correctly.
+       Remove empty line.
+       * src/sh64/ffi.c (simple_type): Remove.
+       (return_type): Handle small structures correctly.
+       (ffi_prep_args): Likewise.
+       (ffi_call): Likewise.
+       (ffi_closure_helper_SYSV): Likewise.
+       * src/sh64/sysv.S (ffi_call_SYSV): Handle 1, 2 and 4-byte return.
+       Emit position independent code if PIC and remove wrong datalabel
+       prefixes from EH data.
+
+2005-07-19  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * Makefile.am (nodist_libffi_la_SOURCES): Add POWERPC_FREEBSD.
+       * Makefile.in: Regenerate.
+       * include/Makefile.in: Likewise.
+       * testsuite/Makefile.in: Likewise.
+       * configure.ac: Add POWERPC_FREEBSD rules.
+       * configure: Regenerate.
+       * src/powerpc/ffitarget.h: Add POWERPC_FREEBSD rules.
+       (FFI_SYSV_TYPE_SMALL_STRUCT): Define.
+       * src/powerpc/ffi.c: Add flags to handle small structure returns
+       in ffi_call_SYSV.
+       (ffi_prep_cif_machdep): Handle small structures for SYSV 4 ABI.
+       Aka FFI_SYSV.
+       (ffi_closure_helper_SYSV): Likewise.
+       * src/powerpc/ppc_closure.S: Add return types for small structures.
+       * src/powerpc/sysv.S: Add bits to handle small structures for
+       final SYSV 4 ABI.
+
+2005-07-10  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/cls_5_1_byte.c: New test file.
+       * testsuite/libffi.call/cls_6_1_byte.c: Likewise.
+       * testsuite/libffi.call/cls_7_1_byte.c: Likewise.
+
+2005-07-05  Randolph Chung  <tausq@debian.org>
+
+       * src/pa/ffi.c (ffi_struct_type): Rename FFI_TYPE_SMALL_STRUCT1
+       as FFI_TYPE_SMALL_STRUCT3.  Break out handling for 5-7 byte
+       structures.  Kill compilation warnings.
+       (ffi_closure_inner_LINUX): Print return values as hex in debug
+       message.  Rename FFI_TYPE_SMALL_STRUCT1 as FFI_TYPE_SMALL_STRUCT3.
+       Properly handle 5-7 byte structure returns.
+       * src/pa/ffitarget.h (FFI_TYPE_SMALL_STRUCT1)
+       (FFI_TYPE_SMALL_STRUCT2): Remove.
+       (FFI_TYPE_SMALL_STRUCT3, FFI_TYPE_SMALL_STRUCT5)
+       (FFI_TYPE_SMALL_STRUCT6, FFI_TYPE_SMALL_STRUCT7): Define.
+       * src/pa/linux.S: Mark source file as using PA1.1 assembly.
+       (checksmst1, checksmst2): Remove.
+       (checksmst3): Optimize handling of 3-byte struct returns.
+       (checksmst567): Properly handle 5-7 byte struct returns.
+
+2005-06-15  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       PR libgcj/21943
+       * src/mips/n32.S: Enforce PIC code.
+       * src/mips/o32.S: Likewise.
+
+2005-06-15  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * configure.ac: Treat i*86-*-solaris2.10 and up as X86_64.
+       * configure: Regenerate.
+
+2005-06-01  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't use JUMPTARGET
+       to call ffi_closure_helper_SYSV.  Append @local instead.
+       * src/powerpc/sysv.S (ffi_call_SYSV): Likewise for ffi_prep_args_SYSV.
+
+2005-05-17  Kelley Cook  <kcook@gcc.gnu.org>
+
+       * configure.ac: Use AC_C_BIGENDIAN instead of AC_C_BIGENDIAN_CROSS.
+       Use AC_CHECK_SIZEOF instead of AC_COMPILE_CHECK_SIZEOF.
+       * Makefile.am (ACLOCAL_AMFLAGS): Remove -I ../config.
+       * aclocal.m4, configure, fficonfig.h.in, Makefile.in,
+       include/Makefile.in, testsuite/Makefile.in: Regenerate.
+
+2005-05-09  Mike Stump  <mrs@apple.com>
+
+       * configure: Regenerate.
+
+2005-05-08  Richard Henderson  <rth@redhat.com>
+
+       PR libffi/21285
+       * src/alpha/osf.S: Update unwind into to match code.
+
+2005-05-04  Andreas Degert <ad@papyrus-gmbh.de>
+           Richard Henderson  <rth@redhat.com>
+
+       * src/x86/ffi64.c (ffi_prep_cif_machdep): Save sse-used flag in
+       bit 11 of flags.
+       (ffi_call): Mask return type field.  Pass ssecount to ffi_call_unix64.
+       (ffi_prep_closure): Set carry bit if sse-used flag set.
+       * src/x86/unix64.S (ffi_call_unix64): Add ssecount argument.
+       Only load sse registers if ssecount non-zero.
+       (ffi_closure_unix64): Only save sse registers if carry set on entry.
+
+2005-04-29  Ralf Corsepius  <ralf.corsepius@rtems.org>
+
+       * configure.ac: Add i*86-*-rtems*, sparc*-*-rtems*,
+       powerpc-*rtems*, arm*-*-rtems*, sh-*-rtems*.
+       * configure: Regenerate.
+
+2005-04-20  Hans-Peter Nilsson  <hp@axis.com>
+
+       * testsuite/lib/libffi-dg.exp (libffi-dg-test-1): In regsub use,
+       have Tcl8.3-compatible intermediate variable.
+
+2005-04-18  Simon Posnjak <simon.posnjak@siol.net>
+           Hans-Peter Nilsson  <hp@axis.com>
+
+       * Makefile.am: Add CRIS support.
+       * configure.ac: Likewise.
+       * Makefile.in, configure, testsuite/Makefile.in,
+       include/Makefile.in: Regenerate.
+       * src/cris: New directory.
+       * src/cris/ffi.c, src/cris/sysv.S, src/cris/ffitarget.h: New files.
+       * src/prep_cif.c (ffi_prep_cif): Wrap in #ifndef __CRIS__.
+
+       * testsuite/lib/libffi-dg.exp (libffi-dg-test-1): Replace \n with
+       \r?\n in output tests.
+
+2005-04-12  Mike Stump  <mrs@apple.com>
+
+       * configure: Regenerate.
+
+2005-03-30  Hans Boehm  <Hans.Boehm@hp.com>
+
+       * src/ia64/ffitarget.h (ffi_arg): Use long long instead of DI.
+
+2005-03-30  Steve Ellcey  <sje@cup.hp.com>
+
+       * src/ia64/ffitarget.h (ffi_arg) ADD DI attribute.
+       (ffi_sarg) Ditto.
+       * src/ia64/unix.S (ffi_closure_unix): Extend gp
+       to 64 bits in ILP32 mode.
+       Load 64 bits even for short data.
+
+2005-03-23  Mike Stump  <mrs@apple.com>
+
+       * src/powerpc/darwin.S: Update for -m64 multilib.
+       * src/powerpc/darwin_closure.S: Likewise.
+
+2005-03-21  Zack Weinberg  <zack@codesourcery.com>
+
+       * configure.ac: Do not invoke TL_AC_GCC_VERSION.
+       Do not set tool_include_dir.
+       * aclocal.m4, configure, Makefile.in, testsuite/Makefile.in:
+       Regenerate.
+       * include/Makefile.am: Set gcc_version and toollibffidir.
+       * include/Makefile.in: Regenerate.
+
+2005-02-22  Andrew Haley  <aph@redhat.com>
+
+       * src/powerpc/ffi.c (ffi_prep_cif_machdep): Bump alignment to
+       odd-numbered register pairs for 64-bit integer types.
+
+2005-02-23  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       PR libffi/20104
+       * testsuite/libffi.call/return_ll1.c: New test case.
+
+2005-02-11  Janis Johnson  <janis187@us.ibm.com>
+
+       * testsuite/libffi.call/cls_align_longdouble.c: Remove dg-options.
+       * testsuite/libffi.call/float.c: Ditto.
+       * testsuite/libffi.call/float2.c: Ditto.
+       * testsuite/libffi.call/float3.c: Ditto.
+
+2005-02-08  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/frv/ffitarget.h: Remove PPC stuff which does not belong to frv.
+
+2005-01-12  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * testsuite/libffi.special/special.exp (cxx_options): Add
+       -shared-libgcc.
+
+2004-12-31  Richard Henderson  <rth@redhat.com>
+
+       * src/types.c (FFI_AGGREGATE_TYPEDEF): Remove.
+       (FFI_TYPEDEF): Rename from FFI_INTEGRAL_TYPEDEF.  Replace size and
+       offset parameters with a type parameter; deduce size and structure
+       alignment.  Update all users.
+
+2004-12-31  Richard Henderson  <rth@redhat.com>
+
+       * src/types.c (FFI_TYPE_POINTER): Define with sizeof.
+       (FFI_TYPE_LONGDOUBLE): Fix for ia64.
+       * src/ia64/ffitarget.h (struct ffi_ia64_trampoline_struct): Move
+       into ffi_prep_closure.
+       * src/ia64/ia64_flags.h, src/ia64/ffi.c, src/ia64/unix.S: Rewrite
+       from scratch.
+
+2004-12-27  Richard Henderson  <rth@redhat.com>
+
+       * src/x86/unix64.S: Fix typo in unwind info.
+
+2004-12-25  Richard Henderson  <rth@redhat.com>
+
+       * src/x86/ffi64.c (struct register_args): Rename from stackLayout.
+       (enum x86_64_reg_class): Add X86_64_COMPLEX_X87_CLASS.
+       (merge_classes): Check for it.
+       (SSE_CLASS_P): New.
+       (classify_argument): Pass byte_offset by value; perform all updates
+       inside struct case.
+       (examine_argument): Add classes argument; handle
+       X86_64_COMPLEX_X87_CLASS.
+       (ffi_prep_args): Merge into ...
+       (ffi_call): ... here.  Share stack frame with ffi_call_unix64.
+       (ffi_prep_cif_machdep): Setup cif->flags for proper structure return.
+       (ffi_fill_return_value): Remove.
+       (ffi_prep_closure): Remove dead assert.
+       (ffi_closure_unix64_inner): Rename from ffi_closure_UNIX64_inner.
+       Rewrite to use struct register_args instead of va_list.  Create
+       flags for handling structure returns.
+       * src/x86/unix64.S: Remove dead strings.
+       (ffi_call_unix64): Rename from ffi_call_UNIX64.  Rewrite to share
+       stack frame with ffi_call.  Handle structure returns properly.
+       (float2sse, floatfloat2sse, double2sse): Remove.
+       (sse2float, sse2double, sse2floatfloat): Remove.
+       (ffi_closure_unix64): Rename from ffi_closure_UNIX64.  Rewrite
+       to handle structure returns properly.
+
+2004-12-08  David Edelsohn  <edelsohn@gnu.org>
+
+       * Makefile.am (AM_MAKEFLAGS): Remove duplicate LIBCFLAGS and
+       PICFLAG.
+       * Makefile.in: Regenerated.
+
+2004-12-02  Richard Sandiford  <rsandifo@redhat.com>
+
+       * configure.ac: Use TL_AC_GCC_VERSION to set gcc_version.
+       * configure, aclocal.m4, Makefile.in: Regenerate.
+       * include/Makefile.in, testsuite/Makefile.in: Regenerate.
+
+2004-11-29  Kelley Cook  <kcook@gcc.gnu.org>
+
+       * configure: Regenerate for libtool change.
+
+2004-11-25  Kelley Cook  <kcook@gcc.gnu.org>
+
+       * configure: Regenerate for libtool reversion.
+
+2004-11-24  Kelley Cook  <kcook@gcc.gnu.org>
+
+       * configure: Regenerate for libtool change.
+
+2004-11-23  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       * testsuite/lib/libffi-dg.exp: Use new procs in target-libpath.exp.
+
+2004-11-23  Richard Sandiford  <rsandifo@redhat.com>
+
+       * src/mips/o32.S (ffi_call_O32, ffi_closure_O32): Use jalr instead
+       of jal.  Use an absolute encoding for the frame information.
+
+2004-11-23  Kelley Cook  <kcook@gcc.gnu.org>
+
+       * Makefile.am: Remove no-dependencies.  Add ACLOCAL_AMFLAGS.
+       * acinclude.m4: Delete logic for sincludes.
+       * aclocal.m4, Makefile.in, configure: Regenerate.
+       * include/Makefile: Likewise.
+       * testsuite/Makefile: Likewise.
+
+2004-11-22  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * src/sparc/ffi.c (ffi_prep_closure): Align doubles and 64-bit integers
+       on a 8-byte boundary.
+       * src/sparc/v8.S (ffi_closure_v8): Reserve frame space for arguments.
+
+2004-10-27  Richard Earnshaw  <rearnsha@arm.com>
+
+       * src/arm/ffi.c (ffi_prep_cif_machdep): Handle functions that return
+       long long values.  Round stack allocation to a multiple of 8 bytes
+       for ATPCS compatibility.
+       * src/arm/sysv.S (ffi_call_SYSV): Rework to avoid use of APCS register
+       names.  Handle returning long long types.  Add Thumb and interworking
+       support.  Improve soft-float code.
+
+2004-10-27  Richard Earnshaw  <rearnsha@arm.com>
+
+       * testsuite/lib/libffi-db.exp (load_gcc_lib): New function.
+       (libffi_exit): New function.
+       (libffi_init): Build the testglue wrapper if needed.
+
+2004-10-25  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR other/18138
+       * testsuite/lib/libffi-dg.exp: Accept more than one multilib libgcc.
+
+2004-10-25  Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com>
+
+       * src/m32r/libffitarget.h (FFI_CLOSURES): Set to 0.
+
+2004-10-20  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh/sysv.S (ffi_call_SYSV): Don't align for double data.
+       * testsuite/libffi.call/float3.c: New test case.
+
+2004-10-18  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh/ffi.c (ffi_prep_closure): Set T bit in trampoline for
+       the function returning a structure pointed with R2.
+       * src/sh/sysv.S (ffi_closure_SYSV): Use R2 as the pointer to
+       the structure return value if T bit set.  Emit position
+       independent code and EH data if PIC.
+
+2004-10-13  Kazuhiro Inaoka  <inaoka.kazuhiro@renesas.com>
+
+       * Makefile.am: Add m32r support.
+       * configure.ac: Likewise.
+       * Makefile.in: Regenerate.
+       * confiugre: Regenerate.
+       * src/types.c: Add m32r port to FFI_INTERNAL_TYPEDEF
+       (uint64, sint64, double, longdouble)
+       * src/m32r: New directory.
+       * src/m32r/ffi.c: New file.
+       * src/m32r/sysv.S: Likewise.
+       * src/m32r/ffitarget.h: Likewise.
+
+2004-10-02  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * testsuite/libffi.call/negint.c: New test case.
+
+2004-09-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR libgcj/17465
+       * testsuite/lib/libffi-dg.exp: Don't use global ld_library_path.
+       Set up LD_LIBRARY_PATH, SHLIB_PATH, LD_LIBRARYN32_PATH,
+       LD_LIBRARY64_PATH, LD_LIBRARY_PATH_32, LD_LIBRARY_PATH_64 and
+       DYLD_LIBRARY_PATH.
+
+2004-09-05  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/many_win32.c: Remove whitespaces.
+       * testsuite/libffi.call/promotion.c: Likewise.
+       * testsuite/libffi.call/return_ll.c: Remove unused var. Cleanup
+       whitespaces.
+       * testsuite/libffi.call/return_sc.c: Likewise.
+       * testsuite/libffi.call/return_uc.c: Likewise.
+
+2004-09-05  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/powerpc/darwin.S: Fix comments and identation.
+       * src/powerpc/darwin_closure.S: Likewise.
+
+2004-09-02  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/powerpc/ffi_darwin.c: Add flag for longdouble return values.
+       (ffi_prep_args): Handle longdouble arguments.
+       (ffi_prep_cif_machdep): Set flags for longdouble. Calculate space for
+       longdouble.
+       (ffi_closure_helper_DARWIN): Add closure handling for longdouble.
+       * src/powerpc/darwin.S (_ffi_call_DARWIN): Add handling of longdouble
+       values.
+       * src/powerpc/darwin_closure.S (_ffi_closure_ASM): Likewise.
+       * src/types.c: Defined longdouble size and alignment for darwin.
+
+2004-09-02  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/powerpc/aix.S: Remove whitespaces.
+       * src/powerpc/aix_closure.S: Likewise.
+       * src/powerpc/asm.h: Likewise.
+       * src/powerpc/ffi.c: Likewise.
+       * src/powerpc/ffitarget.h: Likewise.
+       * src/powerpc/linux64.S: Likewise.
+       * src/powerpc/linux64_closure.S: Likewise.
+       * src/powerpc/ppc_closure.S: Likewise.
+       * src/powerpc/sysv.S: Likewise.
+
+2004-08-30  Anthony Green  <green@redhat.com>
+
+       * Makefile.am: Add frv support.
+       * Makefile.in, testsuite/Makefile.in: Rebuilt.
+       * configure.ac: Read configure.host.
+       * configure.in: Read configure.host.
+       * configure.host: New file.  frv-elf needs libgloss.
+       * include/ffi.h.in: Force ffi_closure to have a nice big (8)
+       alignment.  This is needed to frv and shouldn't harm the others.
+       * include/ffi_common.h (ALIGN_DOWN): New macro.
+       * src/frv/ffi.c, src/frv/ffitarget.h, src/frv/eabi.S: New files.
+
+2004-08-24  David Daney  <daney@avtrex.com>
+
+       * testsuite/libffi.call/closure_fn0.c: Xfail mips64* instead of mips*.
+       * testsuite/libffi.call/closure_fn1.c: Likewise.
+       * testsuite/libffi.call/closure_fn2.c  Likewise.
+       * testsuite/libffi.call/closure_fn3.c: Likewise.
+       * testsuite/libffi.call/closure_fn4.c: Likewise.
+       * testsuite/libffi.call/closure_fn5.c: Likewise.
+       * testsuite/libffi.call/cls_18byte.c: Likewise.
+       * testsuite/libffi.call/cls_19byte.c: Likewise.
+       * testsuite/libffi.call/cls_1_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte1.c: Likewise.
+       * testsuite/libffi.call/cls_24byte.c: Likewise.
+       * testsuite/libffi.call/cls_2byte.c: Likewise.
+       * testsuite/libffi.call/cls_3_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_3byte1.c: Likewise.
+       * testsuite/libffi.call/cls_3byte2.c: Likewise.
+       * testsuite/libffi.call/cls_4_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_4byte.c: Likewise.
+       * testsuite/libffi.call/cls_64byte.c: Likewise.
+       * testsuite/libffi.call/cls_6byte.c: Likewise.
+       * testsuite/libffi.call/cls_7byte.c: Likewise.
+       * testsuite/libffi.call/cls_8byte.c: Likewise.
+       * testsuite/libffi.call/cls_9byte1.c: Likewise.
+       * testsuite/libffi.call/cls_9byte2.c: Likewise.
+       * testsuite/libffi.call/cls_align_double.c: Likewise.
+       * testsuite/libffi.call/cls_align_float.c: Likewise.
+       * testsuite/libffi.call/cls_align_longdouble.c: Likewise.
+       * testsuite/libffi.call/cls_align_pointer.c: Likewise.
+       * testsuite/libffi.call/cls_align_sint16.c: Likewise.
+       * testsuite/libffi.call/cls_align_sint32.c: Likewise.
+       * testsuite/libffi.call/cls_align_sint64.c: Likewise.
+       * testsuite/libffi.call/cls_align_uint16.c: Likewise.
+       * testsuite/libffi.call/cls_align_uint32.c: Likewise.
+       * testsuite/libffi.call/cls_align_uint64.c: Likewise.
+       * testsuite/libffi.call/cls_double.c: Likewise.
+       * testsuite/libffi.call/cls_float.c: Likewise.
+       * testsuite/libffi.call/cls_multi_schar.c: Likewise.
+       * testsuite/libffi.call/cls_multi_sshort.c: Likewise.
+       * testsuite/libffi.call/cls_multi_sshortchar.c: Likewise.
+       * testsuite/libffi.call/cls_multi_uchar.c: Likewise.
+       * testsuite/libffi.call/cls_multi_ushort.c: Likewise.
+       * testsuite/libffi.call/cls_multi_ushortchar.c: Likewise.
+       * testsuite/libffi.call/cls_schar.c: Likewise.
+       * testsuite/libffi.call/cls_sint.c: Likewise.
+       * testsuite/libffi.call/cls_sshort.c: Likewise.
+       * testsuite/libffi.call/cls_uchar.c: Likewise.
+       * testsuite/libffi.call/cls_uint.c: Likewise.
+       * testsuite/libffi.call/cls_ulonglong.c: Likewise.
+       * testsuite/libffi.call/cls_ushort.c: Likewise.
+       * testsuite/libffi.call/nested_struct.c: Likewise.
+       * testsuite/libffi.call/nested_struct1.c: Likewise.
+       * testsuite/libffi.call/nested_struct2.c: Likewise.
+       * testsuite/libffi.call/nested_struct3.c: Likewise.
+       * testsuite/libffi.call/problem1.c: Likewise.
+       * testsuite/libffi.special/unwindtest.cc: Likewise.
+       * testsuite/libffi.call/cls_12byte.c: Likewise and set return value
+       to zero.
+       * testsuite/libffi.call/cls_16byte.c: Likewise.
+       * testsuite/libffi.call/cls_5byte.c: Likewise.
+
+2004-08-23  David Daney <daney@avtrex.com>
+
+       PR libgcj/13141
+       * src/mips/ffitarget.h (FFI_O32_SOFT_FLOAT): New ABI.
+       * src/mips/ffi.c (ffi_prep_args): Fix alignment calculation.
+       (ffi_prep_cif_machdep): Handle FFI_O32_SOFT_FLOAT floating point
+       parameters and return types.
+       (ffi_call): Handle FFI_O32_SOFT_FLOAT ABI.
+       (ffi_prep_closure): Ditto.
+       (ffi_closure_mips_inner_O32): Handle FFI_O32_SOFT_FLOAT ABI, fix
+       alignment calculations.
+       * src/mips/o32.S (ffi_closure_O32): Don't use floating point
+       instructions if FFI_O32_SOFT_FLOAT, make stack frame ABI compliant.
+
+2004-08-14  Casey Marshall <csm@gnu.org>
+
+       * src/mips/ffi.c (ffi_pref_cif_machdep): set `cif->flags' to
+       contain `FFI_TYPE_UINT64' as return type for any 64-bit
+       integer (O32 ABI only).
+       (ffi_prep_closure): new function.
+       (ffi_closure_mips_inner_O32): new function.
+       * src/mips/ffitarget.h: Define `FFI_CLOSURES' and
+       `FFI_TRAMPOLINE_SIZE' appropriately if the ABI is o32.
+       * src/mips/o32.S (ffi_call_O32): add labels for .eh_frame. Return
+       64 bit integers correctly.
+       (ffi_closure_O32): new function.
+       Added DWARF-2 unwind info for both functions.
+
+2004-08-10  Andrew Haley  <aph@redhat.com>
+
+       * src/x86/ffi64.c (ffi_prep_args ): 8-align all stack arguments.
+
+2004-08-01  Robert Millan  <robertmh@gnu.org>
+
+       * configure.ac: Detect knetbsd-gnu and kfreebsd-gnu.
+       * configure: Regenerate.
+
+2004-07-30  Maciej W. Rozycki  <macro@linux-mips.org>
+
+       * acinclude.m4 (AC_FUNC_MMAP_BLACKLIST): Check for <sys/mman.h>
+       and mmap() explicitly instead of relying on preset autoconf cache
+       variables.
+       * aclocal.m4: Regenerate.
+       * configure: Regenerate.
+
+2004-07-11  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * src/s390/ffi.c (ffi_prep_args): Fix C aliasing violation.
+       (ffi_check_float_struct): Remove unused prototype.
+
+2004-06-30  Geoffrey Keating  <geoffk@apple.com>
+
+       * src/powerpc/ffi_darwin.c (flush_icache): ';' is a comment
+       character on Darwin, use '\n\t' instead.
+
+2004-06-26  Matthias Klose  <doko@debian.org>
+
+       * libtool-version: Fix typo in revision/age.
+
+2004-06-17  Matthias Klose  <doko@debian.org>
+
+       * libtool-version: New.
+       * Makefile.am (libffi_la_LDFLAGS): Use -version-info for soname.
+       * Makefile.in: Regenerate.
+
+2004-06-15  Paolo Bonzini  <bonzini@gnu.org>
+
+       * Makefile.am: Remove useless multilib rules.
+       * Makefile.in: Regenerate.
+       * aclocal.m4: Regenerate with automake 1.8.5.
+       * configure.ac: Remove useless multilib configury.
+       * configure: Regenerate.
+
+2004-06-15  Paolo Bonzini  <bonzini@gnu.org>
+
+       * .cvsignore: New file.
+
+2004-06-10  Jakub Jelinek  <jakub@redhat.com>
+
+       * src/ia64/unix.S (ffi_call_unix): Insert group barrier break
+       fp_done.
+       (ffi_closure_UNIX): Fix f14/f15 adjustment if FLOAT_SZ is ever
+       changed from 8.
+
+2004-06-06  Sean McNeil  <sean@mcneil.com>
+
+       * configure.ac: Add x86_64-*-freebsd* support.
+       * configure: Regenerate.
+
+2004-04-26  Joe Buck <jbuck@welsh-buck.org>
+
+       Bug 15093
+       * configure.ac: Test for existence of mmap and sys/mman.h before
+       checking blacklist.  Fix suggested by Jim Wilson.
+       * configure: Regenerate.
+
+2004-04-26  Matt Austern  <austern@apple.com>
+
+       * src/powerpc/darwin.S: Go through a non-lazy pointer for initial
+       FDE location.
+       * src/powerpc/darwin_closure.S: Likewise.
+
+2004-04-24  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/cls_multi_schar.c (main): Fix initialization
+       error. Reported by Thomas Heller <theller@python.net>.
+       * testsuite/libffi.call/cls_multi_sshort.c (main): Likewise.
+       * testsuite/libffi.call/cls_multi_ushort.c (main): Likewise.
+
+2004-03-20  Matthias Klose  <doko@debian.org>
+
+       * src/pa/linux.S: Fix typo.
+
+2004-03-19  Matthias Klose  <doko@debian.org>
+
+       * Makefile.am: Update.
+       * Makefile.in: Regenerate.
+       * src/pa/ffi.h.in: Remove.
+       * src/pa/ffitarget.h: New file.
+
+2004-02-10  Randolph Chung  <tausq@debian.org>
+
+       * Makefile.am: Add PA support.
+       * Makefile.in: Regenerate.
+       * include/Makefile.in: Regenerate.
+       * configure.ac: Add PA target.
+       * configure: Regenerate.
+       * src/pa/ffi.c: New file.
+       * src/pa/ffi.h.in: Add PA support.
+       * src/pa/linux.S: New file.
+       * prep_cif.c: Add PA support.
+
+2004-03-16  Hosaka Yuji  <hos@tamanegi.org>
+
+       * src/types.c: Fix alignment size of X86_WIN32 case int64 and
+       double.
+       * src/x86/ffi.c (ffi_prep_args): Replace ecif->cif->rtype->type
+       with ecif->cif->flags.
+       (ffi_call, ffi_prep_incoming_args_SYSV): Replace cif->rtype->type
+       with cif->flags.
+       (ffi_prep_cif_machdep): Add X86_WIN32 struct case.
+       (ffi_closure_SYSV): Add 1 or 2-bytes struct case for X86_WIN32.
+       * src/x86/win32.S (retstruct1b, retstruct2b, sc_retstruct1b,
+       sc_retstruct2b): Add for 1 or 2-bytes struct case.
+
+2004-03-15 Kelley Cook <kcook@gcc.gnu.org>
+
+       * configure.in: Rename file to ...
+       * configure.ac: ... this.
+       * fficonfig.h.in: Regenerate.
+       * Makefile.in: Regenerate.
+       * include/Makefile.in: Regenerate.
+       * testsuite/Makefile.in: Regenerate.
+
+2004-03-12  Matt Austern  <austern@apple.com>
+
+       * src/powerpc/darwin.S: Fix EH information so it corresponds to
+       changes in EH format resulting from addition of linkonce support.
+       * src/powerpc/darwin_closure.S: Likewise.
+
+2004-03-11  Andreas Tobler  <a.tobler@schweiz.ch>
+           Paolo Bonzini  <bonzini@gnu.org>
+
+       * Makefile.am (AUTOMAKE_OPTIONS): Set them.
+       Remove VPATH. Remove rules for object files. Remove multilib support.
+       (AM_CCASFLAGS): Add.
+       * configure.in (AC_CONFIG_HEADERS): Relace AM_CONFIG_HEADER.
+       (AC_PREREQ): Bump version to 2.59.
+       (AC_INIT): Fill with version info and bug address.
+       (ORIGINAL_LD_FOR_MULTILIBS): Remove.
+       (AM_ENABLE_MULTILIB): Use this instead of AC_ARG_ENABLE.
+       De-precious CC so that the right flags are passed down to multilibs.
+       (AC_MSG_ERROR): Replace obsolete macro AC_ERROR.
+       (AC_CONFIG_FILES): Replace obsolete macro AC_LINK_FILES.
+       (AC_OUTPUT): Reorganize the output with AC_CONFIG_COMMANDS.
+       * configure: Rebuilt.
+       * aclocal.m4: Likewise.
+       * Makefile.in, include/Makefile.in, testsuite/Makefile.in: Likewise.
+       * fficonfig.h.in: Likewise.
+
+2004-03-11  Andreas Schwab  <schwab@suse.de>
+
+       * src/ia64/ffi.c (ffi_prep_incoming_args_UNIX): Get floating point
+       arguments from fp registers only for the first 8 parameter slots.
+       Don't convert a float parameter when passed in memory.
+
+2004-03-09  Hans-Peter Nilsson  <hp@axis.com>
+
+       * configure: Regenerate for config/accross.m4 correction.
+
+2004-02-25  Matt Kraai  <kraai@alumni.cmu.edu>
+
+       * src/powerpc/ffi.c (ffi_prep_args_SYSV): Change
+       ecif->cif->bytes to bytes.
+       (ffi_prep_cif_machdep): Add braces around nested if statement.
+
+2004-02-09  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/types.c (pointer): POWERPC64 has 8 byte pointers.
+
+       * src/powerpc/ffi.c (ffi_prep_args64): Correct long double handling.
+       (ffi_closure_helper_LINUX64): Fix typo.
+       * testsuite/libffi.call/cls_align_longdouble.c: Pass -mlong-double-128
+       for powerpc64-*-*.
+       * testsuite/libffi.call/float.c: Likewise.
+       * testsuite/libffi.call/float2.c: Likewise.
+
+2004-02-08  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/powerpc/ffi.c (ffi_prep_cif_machdep <FFI_LINUX64>): Correct
+       long double function return and long double arg handling.
+       (ffi_closure_helper_LINUX64): Formatting.  Delete unused "ng" var.
+       Use "end_pfr" instead of "nf".  Correct long double handling.
+       Localise "temp".
+       * src/powerpc/linux64.S (ffi_call_LINUX64): Save f2 long double
+       return value.
+       * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Allocate
+       space for long double return value.  Adjust stack frame and offsets.
+       Load f2 long double return.
+
+2004-02-07  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/types.c: Use 16 byte long double for POWERPC64.
+
+2004-01-25  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * src/sparc/ffi.c (ffi_prep_args_v9): Shift the parameter array
+       when the structure return address is passed in %o0.
+       (ffi_V9_return_struct): Rename into ffi_v9_layout_struct.
+       (ffi_v9_layout_struct): Align the field following a nested structure
+       on a word boundary.  Use memmove instead of memcpy.
+       (ffi_call): Update call to ffi_V9_return_struct.
+       (ffi_prep_closure): Define 'ctx' only for V8.
+       (ffi_closure_sparc_inner): Clone into ffi_closure_sparc_inner_v8
+       and ffi_closure_sparc_inner_v9.
+       (ffi_closure_sparc_inner_v8): Return long doubles by reference.
+       Always skip the structure return address.  For structures and long
+       doubles, copy the argument directly.
+       (ffi_closure_sparc_inner_v9): Skip the structure return address only
+       if required.  Shift the maximum floating-point slot accordingly.  For
+       big structures, copy the argument directly; otherwise, left-justify the
+       argument and call ffi_v9_layout_struct to lay out the structure on
+       the stack.
+       * src/sparc/v8.S: Undef STACKFRAME before defining it.
+       (ffi_closure_v8): Pass the structure return address.  Update call to
+       ffi_closure_sparc_inner_v8.  Short-circuit FFI_TYPE_INT handling.
+       Skip the 'unimp' insn when returning long doubles and structures.
+       * src/sparc/v9.S: Undef STACKFRAME before defining it.
+       (ffi_closure_v9): Increase the frame size by 2 words.  Short-circuit
+       FFI_TYPE_INT handling.  Load structures both in integers and
+       floating-point registers on return.
+       * README: Update status of the SPARC port.
+
+2004-01-24  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/pyobjc-tc.c (main): Treat result value
+       as of type ffi_arg.
+       * testsuite/libffi.call/struct3.c (main): Fix CHECK.
+
+2004-01-22  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * testsuite/libffi.call/cls_uint.c (cls_ret_uint_fn): Treat result
+       value as of type ffi_arg, not unsigned int.
+
+2004-01-21  Michael Ritzert  <ritzert@t-online.de>
+
+       * ffi64.c (ffi_prep_args): Cast the RHS of an assignment instead
+       of the LHS.
+
+2004-01-12  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/lib/libffi-dg.exp: Set LD_LIBRARY_PATH_32 for
+       Solaris.
+
+2004-01-08  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * testsuite/libffi.call/ffitest.h (allocate_mmap): Cast MAP_FAILED
+       to void *.
+
+2003-12-10  Richard Henderson  <rth@redhat.com>
+
+       * testsuite/libffi.call/cls_align_pointer.c: Cast pointers to
+       size_t instead of int.
+
+2003-12-04  Hosaka Yuji  <hos@tamanegi.org>
+
+       * testsuite/libffi.call/many_win32.c: Include <float.h>.
+       * testsuite/libffi.call/many_win32.c (main): Replace variable
+       int i with unsigned long ul.
+
+       * testsuite/libffi.call/cls_align_uint64.c: New test case.
+       * testsuite/libffi.call/cls_align_sint64.c: Likewise.
+       * testsuite/libffi.call/cls_align_uint32.c: Likewise.
+       * testsuite/libffi.call/cls_align_sint32.c: Likewise.
+       * testsuite/libffi.call/cls_align_uint16.c: Likewise.
+       * testsuite/libffi.call/cls_align_sint16.c: Likewise.
+       * testsuite/libffi.call/cls_align_float.c: Likewise.
+       * testsuite/libffi.call/cls_align_double.c: Likewise.
+       * testsuite/libffi.call/cls_align_longdouble.c: Likewise.
+       * testsuite/libffi.call/cls_align_pointer.c: Likewise.
+
+2003-12-02  Hosaka Yuji  <hos@tamanegi.org>
+
+       PR other/13221
+       * src/x86/ffi.c (ffi_prep_args, ffi_prep_incoming_args_SYSV):
+       Align arguments to 32 bits.
+
+2003-12-01  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       PR other/13221
+       * testsuite/libffi.call/cls_multi_sshort.c: New test case.
+       * testsuite/libffi.call/cls_multi_sshortchar.c: Likewise.
+       * testsuite/libffi.call/cls_multi_uchar.c: Likewise.
+       * testsuite/libffi.call/cls_multi_schar.c: Likewise.
+       * testsuite/libffi.call/cls_multi_ushortchar.c: Likewise.
+       * testsuite/libffi.call/cls_multi_ushort.c: Likewise.
+
+       * testsuite/libffi.special/unwindtest.cc: Cosmetics.
+
+2003-11-26  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * testsuite/libffi.call/ffitest.h: Include <fcntl.h>.
+       * testsuite/libffi.special/ffitestcxx.h: Likewise.
+
+2003-11-22  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * Makefile.in: Rebuilt.
+       * configure: Likewise.
+       * testsuite/libffi.special/unwindtest.cc: Convert the mmap to
+       the right type.
+
+2003-11-21  Andreas Jaeger  <aj@suse.de>
+           Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * acinclude.m4: Add AC_FUNC_MMAP_BLACKLIST.
+       * configure.in: Call AC_FUNC_MMAP_BLACKLIST.
+       * Makefile.in: Rebuilt.
+       * aclocal.m4: Likewise.
+       * configure: Likewise.
+       * fficonfig.h.in: Likewise.
+       * testsuite/lib/libffi-dg.exp: Add include dir.
+       * testsuite/libffi.call/ffitest.h: Add MMAP definitions.
+       * testsuite/libffi.special/ffitestcxx.h: Likewise.
+       * testsuite/libffi.call/closure_fn0.c: Use MMAP functionality
+       for ffi_closure if available.
+       * testsuite/libffi.call/closure_fn1.c: Likewise.
+       * testsuite/libffi.call/closure_fn2.c: Likewise.
+       * testsuite/libffi.call/closure_fn3.c: Likewise.
+       * testsuite/libffi.call/closure_fn4.c: Likewise.
+       * testsuite/libffi.call/closure_fn5.c: Likewise.
+       * testsuite/libffi.call/cls_12byte.c: Likewise.
+       * testsuite/libffi.call/cls_16byte.c: Likewise.
+       * testsuite/libffi.call/cls_18byte.c: Likewise.
+       * testsuite/libffi.call/cls_19byte.c: Likewise.
+       * testsuite/libffi.call/cls_1_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte1.c: Likewise.
+       * testsuite/libffi.call/cls_24byte.c: Likewise.
+       * testsuite/libffi.call/cls_2byte.c: Likewise.
+       * testsuite/libffi.call/cls_3_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_3byte1.c: Likewise.
+       * testsuite/libffi.call/cls_3byte2.c: Likewise.
+       * testsuite/libffi.call/cls_4_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_4byte.c: Likewise.
+       * testsuite/libffi.call/cls_5byte.c: Likewise.
+       * testsuite/libffi.call/cls_64byte.c: Likewise.
+       * testsuite/libffi.call/cls_6byte.c: Likewise.
+       * testsuite/libffi.call/cls_7byte.c: Likewise.
+       * testsuite/libffi.call/cls_8byte.c: Likewise.
+       * testsuite/libffi.call/cls_9byte1.c: Likewise.
+       * testsuite/libffi.call/cls_9byte2.c: Likewise.
+       * testsuite/libffi.call/cls_double.c: Likewise.
+       * testsuite/libffi.call/cls_float.c: Likewise.
+       * testsuite/libffi.call/cls_schar.c: Likewise.
+       * testsuite/libffi.call/cls_sint.c: Likewise.
+       * testsuite/libffi.call/cls_sshort.c: Likewise.
+       * testsuite/libffi.call/cls_uchar.c: Likewise.
+       * testsuite/libffi.call/cls_uint.c: Likewise.
+       * testsuite/libffi.call/cls_ulonglong.c: Likewise.
+       * testsuite/libffi.call/cls_ushort.c: Likewise.
+       * testsuite/libffi.call/nested_struct.c: Likewise.
+       * testsuite/libffi.call/nested_struct1.c: Likewise.
+       * testsuite/libffi.call/nested_struct2.c: Likewise.
+       * testsuite/libffi.call/nested_struct3.c: Likewise.
+       * testsuite/libffi.call/problem1.c: Likewise.
+       * testsuite/libffi.special/unwindtest.cc: Likewise.
+
+2003-11-20  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/lib/libffi-dg.exp: Make the -lgcc_s conditional.
+
+2003-11-19  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/lib/libffi-dg.exp: Add DYLD_LIBRARY_PATH for darwin.
+       Add -lgcc_s to additional flags.
+
+2003-11-12  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * configure.in, include/Makefile.am: PR libgcj/11147, install
+       the ffitarget.h header file in a gcc versioned and target
+       dependent place.
+       * configure: Regenerated.
+       * Makefile.in, include/Makefile.in: Likewise.
+       * testsuite/Makefile.in: Likewise.
+
+2003-11-09  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/closure_fn0.c: Print result and check
+       with dg-output to make debugging easier.
+       * testsuite/libffi.call/closure_fn1.c: Likewise.
+       * testsuite/libffi.call/closure_fn2.c: Likewise.
+       * testsuite/libffi.call/closure_fn3.c: Likewise.
+       * testsuite/libffi.call/closure_fn4.c: Likewise.
+       * testsuite/libffi.call/closure_fn5.c: Likewise.
+       * testsuite/libffi.call/cls_12byte.c: Likewise.
+       * testsuite/libffi.call/cls_16byte.c: Likewise.
+       * testsuite/libffi.call/cls_18byte.c: Likewise.
+       * testsuite/libffi.call/cls_19byte.c: Likewise.
+       * testsuite/libffi.call/cls_1_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte1.c: Likewise.
+       * testsuite/libffi.call/cls_24byte.c: Likewise.
+       * testsuite/libffi.call/cls_2byte.c: Likewise.
+       * testsuite/libffi.call/cls_3_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_3byte1.c: Likewise.
+       * testsuite/libffi.call/cls_3byte2.c: Likewise.
+       * testsuite/libffi.call/cls_4_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_4byte.c: Likewise.
+       * testsuite/libffi.call/cls_5byte.c: Likewise.
+       * testsuite/libffi.call/cls_64byte.c: Likewise.
+       * testsuite/libffi.call/cls_6byte.c: Likewise.
+       * testsuite/libffi.call/cls_7byte.c: Likewise.
+       * testsuite/libffi.call/cls_8byte.c: Likewise.
+       * testsuite/libffi.call/cls_9byte1.c: Likewise.
+       * testsuite/libffi.call/cls_9byte2.c: Likewise.
+       * testsuite/libffi.call/cls_double.c: Likewise.
+       * testsuite/libffi.call/cls_float.c: Likewise.
+       * testsuite/libffi.call/cls_schar.c: Likewise.
+       * testsuite/libffi.call/cls_sint.c: Likewise.
+       * testsuite/libffi.call/cls_sshort.c: Likewise.
+       * testsuite/libffi.call/cls_uchar.c: Likewise.
+       * testsuite/libffi.call/cls_uint.c: Likewise.
+       * testsuite/libffi.call/cls_ulonglong.c: Likewise.
+       * testsuite/libffi.call/cls_ushort.c: Likewise.
+       * testsuite/libffi.call/problem1.c: Likewise.
+
+       * testsuite/libffi.special/unwindtest.cc: Make ffi_closure
+       static.
+
+2003-11-08  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/cls_9byte2.c: New test case.
+       * testsuite/libffi.call/cls_9byte1.c: Likewise.
+       * testsuite/libffi.call/cls_64byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte1.c: Likewise.
+       * testsuite/libffi.call/cls_19byte.c: Likewise.
+       * testsuite/libffi.call/cls_18byte.c: Likewise.
+       * testsuite/libffi.call/closure_fn4.c: Likewise.
+       * testsuite/libffi.call/closure_fn5.c: Likewise.
+       * testsuite/libffi.call/cls_schar.c: Likewise.
+       * testsuite/libffi.call/cls_sint.c: Likewise.
+       * testsuite/libffi.call/cls_sshort.c: Likewise.
+       * testsuite/libffi.call/nested_struct2.c: Likewise.
+       * testsuite/libffi.call/nested_struct3.c: Likewise.
+
+2003-11-08  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/cls_double.c: Do a check on the result.
+       * testsuite/libffi.call/cls_uchar.c: Likewise.
+       * testsuite/libffi.call/cls_uint.c: Likewise.
+       * testsuite/libffi.call/cls_ulonglong.c: Likewise.
+       * testsuite/libffi.call/cls_ushort.c: Likewise.
+       * testsuite/libffi.call/return_sc.c: Cleanup whitespaces.
+
+2003-11-06  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/prep_cif.c (ffi_prep_cif): Move the validity check after
+       the initialization.
+
+2003-10-23  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/java_raw_api.c (ffi_java_ptrarray_to_raw): Replace
+       FFI_ASSERT(FALSE) with FFI_ASSERT(0).
+
+2003-10-22  David Daney  <ddaney@avtrex.com>
+
+       * src/mips/ffitarget.h: Replace undefined UINT32 and friends with
+       __attribute__((__mode__(__SI__))) and friends.
+
+2003-10-22  Andreas Schwab  <schwab@suse.de>
+
+       * src/ia64/ffi.c: Replace FALSE/TRUE with false/true.
+
+2003-10-21  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * configure.in: AC_LINK_FILES(ffitarget.h).
+       * configure: Regenerate.
+       * Makefile.in: Likewise.
+       * include/Makefile.in: Likewise.
+       * testsuite/Makefile.in: Likewise.
+       * fficonfig.h.in: Likewise.
+
+2003-10-21  Paolo Bonzini  <bonzini@gnu.org>
+           Richard Henderson  <rth@redhat.com>
+
+       Avoid that ffi.h includes fficonfig.h.
+
+       * Makefile.am (EXTRA_DIST): Include ffitarget.h files
+       (TARGET_SRC_MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX.
+       (TARGET_SRC_MIPS_SGI): Removed.
+       (MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX.
+       (MIPS_SGI): Removed.
+       (CLEANFILES): Removed.
+       (mostlyclean-am, clean-am, mostlyclean-sub, clean-sub): New
+       targets.
+       * acconfig.h: Removed.
+       * configure.in: Compute sizeofs only for double and long double.
+       Use them to define and subst HAVE_LONG_DOUBLE.  Include comments
+       into AC_DEFINE instead of using acconfig.h.  Create
+       include/ffitarget.h instead of include/fficonfig.h.  Rename
+       MIPS_GCC to MIPS_IRIX, drop MIPS_SGI since we are in gcc's tree.
+       AC_DEFINE EH_FRAME_FLAGS.
+       * include/Makefile.am (DISTCLEANFILES): New automake macro.
+       (hack_DATA): Add ffitarget.h.
+       * include/ffi.h.in: Remove all system specific definitions.
+       Declare raw API even if it is not installed, why bother?
+       Use limits.h instead of SIZEOF_* to define ffi_type_*.  Do
+       not define EH_FRAME_FLAGS, it is in fficonfig.h now.  Include
+       ffitarget.h instead of fficonfig.h.  Remove ALIGN macro.
+       (UINT_ARG, INT_ARG): Removed, use ffi_arg and ffi_sarg instead.
+       * include/ffi_common.h (bool): Do not define.
+       (ffi_assert): Accept failed assertion.
+       (ffi_type_test): Return void and accept file/line.
+       (FFI_ASSERT): Pass stringized failed assertion.
+       (FFI_ASSERT_AT): New macro.
+       (FFI_ASSERT_VALID_TYPE): New macro.
+       (UINT8, SINT8, UINT16, SINT16, UINT32, SINT32,
+       UINT64, SINT64): Define here with gcc's __attribute__ macro
+       instead of in ffi.h
+       (FLOAT32, ALIGN): Define here instead of in ffi.h
+       * include/ffi-mips.h: Removed.  Its content moved to
+       src/mips/ffitarget.h after separating assembly and C sections.
+       * src/alpha/ffi.c, src/alpha/ffi.c, src/java_raw_api.c
+       src/prep_cif.c, src/raw_api.c, src/ia64/ffi.c,
+       src/mips/ffi.c, src/mips/n32.S, src/mips/o32.S,
+       src/mips/ffitarget.h, src/sparc/ffi.c, src/x86/ffi64.c:
+       SIZEOF_ARG -> FFI_SIZEOF_ARG.
+       * src/ia64/ffi.c: Include stdbool.h (provided by GCC 2.95+).
+       * src/debug.c (ffi_assert): Accept stringized failed assertion.
+       (ffi_type_test): Rewritten.
+       * src/prep-cif.c (initialize_aggregate, ffi_prep_cif): Call
+       FFI_ASSERT_VALID_TYPE.
+       * src/alpha/ffitarget.h, src/arm/ffitarget.h,
+       src/ia64/ffitarget.h, src/m68k/ffitarget.h,
+       src/mips/ffitarget.h, src/powerpc/ffitarget.h,
+       src/s390/ffitarget.h, src/sh/ffitarget.h,
+       src/sh64/ffitarget.h, src/sparc/ffitarget.h,
+       src/x86/ffitarget.h: New files.
+       * src/alpha/osf.S, src/arm/sysv.S, src/ia64/unix.S,
+       src/m68k/sysv.S, src/mips/n32.S, src/mips/o32.S,
+       src/powerpc/aix.S, src/powerpc/darwin.S,
+       src/powerpc/ffi_darwin.c, src/powerpc/linux64.S,
+       src/powerpc/linux64_closure.S, src/powerpc/ppc_closure.S,
+       src/powerpc/sysv.S, src/s390/sysv.S, src/sh/sysv.S,
+       src/sh64/sysv.S, src/sparc/v8.S, src/sparc/v9.S,
+       src/x86/sysv.S, src/x86/unix64.S, src/x86/win32.S:
+       include fficonfig.h
+
+2003-10-20  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * src/mips/ffi.c: Use _ABIN32, _ABIO32 instead of external
+       _MIPS_SIM_NABI32, _MIPS_SIM_ABI32.
+
+2003-10-19  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Declare bytes again.
+       Used when FFI_DEBUG = 1.
+
+2003-10-14  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/types.c (double, longdouble): Default POWERPC64 to 8 byte size
+       and align.
+
+2003-10-06  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * include/ffi_mips.h: Define FFI_MIPS_N32 for N32/N64 ABIs,
+       FFI_MIPS_O32 for O32 ABI.
+
+2003-10-01  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/lib/libffi-dg.exp: Set LD_LIBRARY_PATH_64 for
+       SPARC64. Cleanup whitespaces.
+
+2003-09-19  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * testsuite/libffi.call/closure_fn0.c: Xfail mips, arm,
+       strongarm, xscale. Cleanup whitespaces.
+       * testsuite/libffi.call/closure_fn1.c: Likewise.
+       * testsuite/libffi.call/closure_fn2.c: Likewise.
+       * testsuite/libffi.call/closure_fn3.c: Likewise.
+       * testsuite/libffi.call/cls_12byte.c: Likewise.
+       * testsuite/libffi.call/cls_16byte.c: Likewise.
+       * testsuite/libffi.call/cls_1_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte.c: Likewise.
+       * testsuite/libffi.call/cls_24byte.c: Likewise.
+       * testsuite/libffi.call/cls_2byte.c: Likewise.
+       * testsuite/libffi.call/cls_3_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_3byte1.c: Likewise.
+       * testsuite/libffi.call/cls_3byte2.c: Likewise.
+       * testsuite/libffi.call/cls_4_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_4byte.c: Likewise.
+       * testsuite/libffi.call/cls_5byte.c: Likewise.
+       * testsuite/libffi.call/cls_6byte.c: Likewise.
+       * testsuite/libffi.call/cls_7byte.c: Likewise.
+       * testsuite/libffi.call/cls_8byte.c: Likewise.
+       * testsuite/libffi.call/cls_double.c: Likewise.
+       * testsuite/libffi.call/cls_float.c: Likewise.
+       * testsuite/libffi.call/cls_uchar.c: Likewise.
+       * testsuite/libffi.call/cls_uint.c: Likewise.
+       * testsuite/libffi.call/cls_ulonglong.c: Likewise.
+       * testsuite/libffi.call/cls_ushort.c: Likewise.
+       * testsuite/libffi.call/nested_struct.c: Likewise.
+       * testsuite/libffi.call/nested_struct1.c: Likewise.
+       * testsuite/libffi.call/problem1.c: Likewise.
+       * testsuite/libffi.special/unwindtest.cc: Likewise.
+       * testsuite/libffi.call/pyobjc-tc.c: Cleanup whitespaces.
+
+2003-09-18  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/aix.S: Cleanup whitespaces.
+       * src/powerpc/aix_closure.S: Likewise.
+
+2003-09-18  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/powerpc/darwin.S: Cleanup whitespaces, comment formatting.
+       * src/powerpc/darwin_closure.S: Likewise.
+       * src/powerpc/ffi_darwin.c: Likewise.
+
+2003-09-18  Andreas Tobler  <a.tobler@schweiz.ch>
+           David Edelsohn  <edelsohn@gnu.org>
+
+       * src/types.c (double): Add AIX and Darwin to the right TYPEDEF.
+       * src/powerpc/aix_closure.S: Remove the pointer to the outgoing
+       parameter stack.
+       * src/powerpc/darwin_closure.S: Likewise.
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Handle structures
+       according to the Darwin/AIX ABI.
+       (ffi_prep_cif_machdep): Likewise.
+       (ffi_closure_helper_DARWIN): Likewise.
+       Remove the outgoing parameter stack logic. Simplify the evaluation
+       of the different CASE types.
+       (ffi_prep_clousure): Avoid the casts on lvalues. Change the branch
+       statement in the trampoline code.
+
+2003-09-18  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh/ffi.c (ffi_prep_args): Take account into the alignement
+       for the register size.
+       (ffi_closure_helper_SYSV): Handle the structure return value
+       address correctly.
+       (ffi_closure_helper_SYSV): Return the appropriate type when
+       the registers are used for the structure return value.
+       * src/sh/sysv.S (ffi_closure_SYSV): Fix the stack layout for
+       the 64-bit return value.  Update copyright years.
+
+2003-09-17  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * testsuite/lib/libffi-dg.exp (libffi_target_compile): Search in
+       srcdir for ffi_mips.h.
+
+2003-09-12  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/prep_cif.c (initialize_aggregate): Include tail padding in
+       structure size.
+       * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Correct
+       placement of float result.
+       * testsuite/libffi.special/unwindtest.cc (closure_test_fn1): Correct
+       cast of "resp" for big-endian 64 bit machines.
+
+2003-09-11  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/types.c (double, longdouble): Merge identical SH and ARM
+       typedefs, and add POWERPC64.
+       * src/powerpc/ffi.c (ffi_prep_args64): Correct next_arg calc for
+       struct split over gpr and rest.
+       (ffi_prep_cif_machdep): Correct intarg_count for structures.
+       * src/powerpc/linux64.S (ffi_call_LINUX64): Fix gpr offsets.
+
+2003-09-09  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct
+       passing correctly.
+
+2003-09-09  Alan Modra  <amodra@bigpond.net.au>
+
+       * configure: Regenerate.
+
+2003-09-04  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * Makefile.am: Remove build rules for ffitest.
+       * Makefile.in: Rebuilt.
+
+2003-09-04  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/java_raw_api.c: Include <stdlib.h> to fix compiler warning
+       about implicit declaration of abort().
+
+2003-09-04  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * Makefile.am: Add dejagnu test framework. Fixes PR other/11411.
+       * Makefile.in: Rebuilt.
+       * configure.in: Add dejagnu test framework.
+       * configure: Rebuilt.
+
+       * testsuite/Makefile.am: New file.
+       * testsuite/Makefile.in: Built
+       * testsuite/lib/libffi-dg.exp: New file.
+       * testsuite/config/default.exp: Likewise.
+       * testsuite/libffi.call/call.exp: Likewise.
+       * testsuite/libffi.call/ffitest.h: Likewise.
+       * testsuite/libffi.call/closure_fn0.c: Likewise.
+       * testsuite/libffi.call/closure_fn1.c: Likewise.
+       * testsuite/libffi.call/closure_fn2.c: Likewise.
+       * testsuite/libffi.call/closure_fn3.c: Likewise.
+       * testsuite/libffi.call/cls_1_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_3_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_4_1byte.c: Likewise.
+       * testsuite/libffi.call/cls_2byte.c: Likewise.
+       * testsuite/libffi.call/cls_3byte1.c: Likewise.
+       * testsuite/libffi.call/cls_3byte2.c: Likewise.
+       * testsuite/libffi.call/cls_4byte.c: Likewise.
+       * testsuite/libffi.call/cls_5byte.c: Likewise.
+       * testsuite/libffi.call/cls_6byte.c: Likewise.
+       * testsuite/libffi.call/cls_7byte.c: Likewise.
+       * testsuite/libffi.call/cls_8byte.c: Likewise.
+       * testsuite/libffi.call/cls_12byte.c: Likewise.
+       * testsuite/libffi.call/cls_16byte.c: Likewise.
+       * testsuite/libffi.call/cls_20byte.c: Likewise.
+       * testsuite/libffi.call/cls_24byte.c: Likewise.
+       * testsuite/libffi.call/cls_double.c: Likewise.
+       * testsuite/libffi.call/cls_float.c: Likewise.
+       * testsuite/libffi.call/cls_uchar.c: Likewise.
+       * testsuite/libffi.call/cls_uint.c: Likewise.
+       * testsuite/libffi.call/cls_ulonglong.c: Likewise.
+       * testsuite/libffi.call/cls_ushort.c: Likewise.
+       * testsuite/libffi.call/float.c: Likewise.
+       * testsuite/libffi.call/float1.c: Likewise.
+       * testsuite/libffi.call/float2.c: Likewise.
+       * testsuite/libffi.call/many.c: Likewise.
+       * testsuite/libffi.call/many_win32.c: Likewise.
+       * testsuite/libffi.call/nested_struct.c: Likewise.
+       * testsuite/libffi.call/nested_struct1.c: Likewise.
+       * testsuite/libffi.call/pyobjc-tc.c: Likewise.
+       * testsuite/libffi.call/problem1.c: Likewise.
+       * testsuite/libffi.call/promotion.c: Likewise.
+       * testsuite/libffi.call/return_ll.c: Likewise.
+       * testsuite/libffi.call/return_sc.c: Likewise.
+       * testsuite/libffi.call/return_uc.c: Likewise.
+       * testsuite/libffi.call/strlen.c: Likewise.
+       * testsuite/libffi.call/strlen_win32.c: Likewise.
+       * testsuite/libffi.call/struct1.c: Likewise.
+       * testsuite/libffi.call/struct2.c: Likewise.
+       * testsuite/libffi.call/struct3.c: Likewise.
+       * testsuite/libffi.call/struct4.c: Likewise.
+       * testsuite/libffi.call/struct5.c: Likewise.
+       * testsuite/libffi.call/struct6.c: Likewise.
+       * testsuite/libffi.call/struct7.c: Likewise.
+       * testsuite/libffi.call/struct8.c: Likewise.
+       * testsuite/libffi.call/struct9.c: Likewise.
+       * testsuite/libffi.special/special.exp: New file.
+       * testsuite/libffi.special/ffitestcxx.h: Likewise.
+       * testsuite/libffi.special/unwindtest.cc: Likewise.
+
+
+2003-08-13  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh/ffi.c (OFS_INT16): Set 0 for little endian case.  Update
+       copyright years.
+
+2003-08-02  Alan Modra  <amodra@bigpond.net.au>
+
+       * src/powerpc/ffi.c (ffi_prep_args64): Modify for changed gcc
+       structure passing.
+       (ffi_closure_helper_LINUX64): Likewise.
+       * src/powerpc/linux64.S: Remove code writing to parm save area.
+       * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Use return
+       address in lr from ffi_closure_helper_LINUX64 call to calculate
+       table address.  Optimize function tail.
+
+2003-07-28  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/sparc/ffi.c: Handle all floating point registers.
+       * src/sparc/v9.S: Likewise. Fixes second part of PR target/11410.
+
+2003-07-11  Gerald Pfeifer  <pfeifer@dbai.tuwien.ac.at>
+
+       * README: Note that libffi is not part of GCC.  Update the project
+       URL and status.
+
+2003-06-19  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+       * src/powerpc/ppc_closure.S: Include ffi.h.
+
+2003-06-13  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * src/x86/sysv.S: Avoid gas-only .uleb128/.sleb128 directives.
+       Use C style comments.
+
+2003-06-13  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+       * Makefile.am: Add SHmedia support.  Fix a typo of SH support.
+       * Makefile.in: Regenerate.
+       * configure.in (sh64-*-linux*, sh5*-*-linux*): Add target.
+       * configure: Regenerate.
+       * include/ffi.h.in: Add SHmedia support.
+       * src/sh64/ffi.c: New file.
+       * src/sh64/sysv.S: New file.
+
+2003-05-16  Jakub Jelinek  <jakub@redhat.com>
+
+       * configure.in (HAVE_RO_EH_FRAME): Check whether .eh_frame section
+       should be read-only.
+       * configure: Rebuilt.
+       * fficonfig.h.in: Rebuilt.
+       * include/ffi.h.in (EH_FRAME_FLAGS): Define.
+       * src/alpha/osf.S: Use EH_FRAME_FLAGS.
+       * src/powerpc/linux64.S: Likewise.
+       * src/powerpc/linux64_closure.S: Likewise.  Include ffi.h.
+       * src/powerpc/sysv.S: Use EH_FRAME_FLAGS.  Use pcrel encoding
+       if -fpic/-fPIC/-mrelocatable.
+       * src/powerpc/powerpc_closure.S: Likewise.
+       * src/sparc/v8.S: If HAVE_RO_EH_FRAME is defined, don't include
+       #write in .eh_frame flags.
+       * src/sparc/v9.S: Likewise.
+       * src/x86/unix64.S: Use EH_FRAME_FLAGS.
+       * src/x86/sysv.S: Likewise.  Use pcrel encoding if -fpic/-fPIC.
+       * src/s390/sysv.S: Use EH_FRAME_FLAGS.  Include ffi.h.
+
+2003-05-07  Jeff Sturm  <jsturm@one-point.com>
+
+       Fixes PR bootstrap/10656
+       * configure.in (HAVE_AS_REGISTER_PSEUDO_OP): Test assembler
+       support for .register pseudo-op.
+       * src/sparc/v8.S: Use it.
+       * fficonfig.h.in: Rebuilt.
+       * configure: Rebuilt.
+
+2003-04-18  Jakub Jelinek  <jakub@redhat.com>
+
+       * include/ffi.h.in (POWERPC64): Define if 64-bit.
+       (enum ffi_abi): Add FFI_LINUX64 on POWERPC.
+       Make it the default on POWERPC64.
+       (FFI_TRAMPOLINE_SIZE): Define to 24 on POWERPC64.
+       * configure.in: Change powerpc-*-linux* into powerpc*-*-linux*.
+       * configure: Rebuilt.
+       * src/powerpc/ffi.c (hidden): Define.
+       (ffi_prep_args_SYSV): Renamed from
+       ffi_prep_args.  Cast pointers to unsigned long to shut up warnings.
+       (NUM_GPR_ARG_REGISTERS64, NUM_FPR_ARG_REGISTERS64,
+       ASM_NEEDS_REGISTERS64): New.
+       (ffi_prep_args64): New function.
+       (ffi_prep_cif_machdep): Handle FFI_LINUX64 ABI.
+       (ffi_call): Likewise.
+       (ffi_prep_closure): Likewise.
+       (flush_icache): Surround by #ifndef POWERPC64.
+       (ffi_dblfl): New union type.
+       (ffi_closure_helper_SYSV): Use it to avoid aliasing problems.
+       (ffi_closure_helper_LINUX64): New function.
+       * src/powerpc/ppc_closure.S: Surround whole file by #ifndef
+       __powerpc64__.
+       * src/powerpc/sysv.S: Likewise.
+       (ffi_call_SYSV): Rename ffi_prep_args to ffi_prep_args_SYSV.
+       * src/powerpc/linux64.S: New file.
+       * src/powerpc/linux64_closure.S: New file.
+       * Makefile.am (EXTRA_DIST): Add src/powerpc/linux64.S and
+       src/powerpc/linux64_closure.S.
+       (TARGET_SRC_POWERPC): Likewise.
+
+       * src/ffitest.c (closure_test_fn, closure_test_fn1, closure_test_fn2,
+       closure_test_fn3): Fix result printing on big-endian 64-bit
+       machines.
+       (main): Print tst2_arg instead of uninitialized tst2_result.
+
+       * src/ffitest.c (main): Hide what closure pointer really points to
+       from the compiler.
+
+2003-04-16  Richard Earnshaw  <rearnsha@arm.com>
+
+       * configure.in (arm-*-netbsdelf*): Add configuration.
+       (configure): Regenerated.
+
+2003-04-04  Loren J. Rittle  <ljrittle@acm.org>
+
+       * include/Makefile.in: Regenerate.
+
+2003-03-21  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
+
+       * libffi/include/ffi.h.in: Define X86 instead of X86_64 in 32
+       bit mode.
+       * libffi/src/x86/ffi.c (ffi_closure_SYSV, ffi_closure_raw_SYSV):
+       Receive closure pointer through parameter, read args using
+       __builtin_dwarf_cfa.
+       (FFI_INIT_TRAMPOLINE): Send closure reference through eax.
+
+2003-03-12  Andreas Schwab  <schwab@suse.de>
+
+       * configure.in: Avoid trailing /. in toolexeclibdir.
+       * configure: Rebuilt.
+
+2003-03-03  Andreas Tobler <a.tobler@schweiz.ch>
+
+       * src/powerpc/darwin_closure.S: Recode to fit dynamic libraries.
+
+2003-02-06  Andreas Tobler <a.tobler@schweiz.ch>
+
+       * libffi/src/powerpc/darwin_closure.S:
+       Fix alignement bug, allocate 8 bytes for the result.
+       * libffi/src/powerpc/aix_closure.S:
+       Likewise.
+       * libffi/src/powerpc/ffi_darwin.c:
+       Update stackframe description for aix/darwin_closure.S.
+
+2003-02-06  Jakub Jelinek  <jakub@redhat.com>
+
+       * src/s390/ffi.c (ffi_closure_helper_SYSV): Add hidden visibility
+       attribute.
+
+2003-01-31  Christian Cornelssen  <ccorn@cs.tu-berlin.de>,
+           Andreas Schwab  <schwab@suse.de>
+
+       * configure.in: Adjust command to source config-ml.in to account
+       for changes to the libffi_basedir definition.
+       (libffi_basedir): Remove ${srcdir} from value and include trailing
+       slash if nonempty.
+
+       * configure: Regenerate.
+
+2003-01-29  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+       * src/powerpc/ppc_closure.S: Recode to fit shared libs.
+
+2003-01-28  Andrew Haley  <aph@redhat.com>
+
+       * include/ffi.h.in: Enable FFI_CLOSURES for x86_64.
+       * src/x86/ffi64.c (ffi_prep_closure): New.
+       (ffi_closure_UNIX64_inner): New.
+       * src/x86/unix64.S (ffi_closure_UNIX64): New.
+
+2003-01-27  Alexandre Oliva  <aoliva@redhat.com>
+
+       * configure.in (toolexecdir, toolexeclibdir): Set and AC_SUBST.
+       Remove USE_LIBDIR conditional.
+       * Makefile.am (toolexecdir, toolexeclibdir): Don't override.
+       * Makefile.in, configure: Rebuilt.
+
+2003-01027  David Edelsohn  <edelsohn@gnu.org>
+
+       * Makefile.am (TARGET_SRC_POWERPC_AIX): Fix typo.
+       * Makefile.in: Regenerate.
+
+2003-01-22  Andrew Haley  <aph@redhat.com>
+
+       * src/powerpc/darwin.S (_ffi_call_AIX): Add Augmentation size to
+       unwind info.
+
+2003-01-21  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/powerpc/darwin.S: Add unwind info.
+       * src/powerpc/darwin_closure.S: Likewise.
+
+2003-01-14  Andrew Haley  <aph@redhat.com>
+
+       * src/x86/ffi64.c (ffi_prep_args): Check for void retval.
+       (ffi_prep_cif_machdep): Likewise.
+       * src/x86/unix64.S: Add unwind info.
+
+2003-01-14  Andreas Jaeger  <aj@suse.de>
+
+       * src/ffitest.c (main): Only use ffi_closures if those are
+       supported.
+
+2003-01-13 Andreas Tobler <a.tobler@schweiz.ch>
+
+       * libffi/src/ffitest.c
+        add closure testcases
+
+2003-01-13 Kevin B. Hendricks <khendricks@ivey.uwo.ca>
+
+       * libffi/src/powerpc/ffi.c
+        fix alignment bug for float (4 byte aligned iso 8 byte)
+
+2003-01-09  Geoffrey Keating  <geoffk@apple.com>
+
+       * src/powerpc/ffi_darwin.c: Remove RCS version string.
+       * src/powerpc/darwin.S: Remove RCS version string.
+
+2003-01-03  Jeff Sturm  <jsturm@one-point.com>
+
+       * include/ffi.h.in: Add closure defines for SPARC, SPARC64.
+       * src/ffitest.c (main): Use static storage for closure.
+       * src/sparc/ffi.c (ffi_prep_closure, ffi_closure_sparc_inner): New.
+       * src/sparc/v8.S (ffi_closure_v8): New.
+       * src/sparc/v9.S (ffi_closure_v9): New.
+
+2002-11-10  Ranjit Mathew <rmathew@hotmail.com>
+
+       * include/ffi.h.in: Added FFI_STDCALL ffi_type
+         enumeration for X86_WIN32.
+       * src/x86/win32.S: Added ffi_call_STDCALL function
+         definition.
+       * src/x86/ffi.c (ffi_call/ffi_raw_call): Added
+         switch cases for recognising FFI_STDCALL and
+         calling ffi_call_STDCALL if target is X86_WIN32.
+       * src/ffitest.c (my_stdcall_strlen/stdcall_many):
+         stdcall versions of the "my_strlen" and "many"
+         test functions (for X86_WIN32).
+         Added test cases to test stdcall invocation using
+         these functions.
+
+2002-12-02  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * src/sh/sysv.S: Add DWARF2 unwind info.
+
+2002-11-27  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * src/s390/sysv.S (.eh_frame section): Make section read-only.
+
+2002-11-26  Jim Wilson  <wilson@redhat.com>
+
+       * src/types.c (FFI_TYPE_POINTER): Has size 8 on IA64.
+
+2002-11-23  H.J. Lu <hjl@gnu.org>
+
+       * acinclude.m4: Add dummy AM_PROG_LIBTOOL.
+       Include ../config/accross.m4.
+       * aclocal.m4; Rebuild.
+       * configure: Likewise.
+
+2002-11-15  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * src/s390/sysv.S (.eh_frame section): Adapt to pcrel FDE encoding.
+
+2002-11-11  DJ Delorie  <dj@redhat.com>
+
+       * configure.in: Look for common files in the right place.
+
+2002-10-08  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * src/java_raw_api.c (ffi_java_raw_to_ptrarray): Interpret
+       raw data as _Jv_word values, not ffi_raw.
+       (ffi_java_ptrarray_to_raw): Likewise.
+       (ffi_java_rvalue_to_raw): New function.
+       (ffi_java_raw_call): Call it.
+       (ffi_java_raw_to_rvalue): New function.
+       (ffi_java_translate_args): Call it.
+       * src/ffitest.c (closure_test_fn): Interpret return value
+       as ffi_arg, not int.
+       * src/s390/ffi.c (ffi_prep_cif_machdep): Add missing
+       FFI_TYPE_POINTER case.
+       (ffi_closure_helper_SYSV): Likewise.  Also, assume return
+       values extended to word size.
+
+2002-10-02  Andreas Jaeger  <aj@suse.de>
+
+       * src/x86/ffi64.c (ffi_prep_cif_machdep): Remove debug output.
+
+2002-10-01  Bo Thorsen  <bo@smetana.suse.de>
+
+       * include/ffi.h.in: Fix i386 win32 compilation.
+
+2002-09-30  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * configure.in: Add s390x-*-linux-* target.
+       * configure: Regenerate.
+       * include/ffi.h.in: Define S390X for s390x targets.
+       (FFI_CLOSURES): Define for s390/s390x.
+       (FFI_TRAMPOLINE_SIZE): Likewise.
+       (FFI_NATIVE_RAW_API): Likewise.
+       * src/prep_cif.c (ffi_prep_cif): Do not compute stack space for s390.
+       * src/types.c (FFI_TYPE_POINTER): Use 8-byte pointers on s390x.
+       * src/s390/ffi.c: Major rework of existing code.  Add support for
+       s390x targets.  Add closure support.
+       * src/s390/sysv.S: Likewise.
+
+2002-09-29  Richard Earnshaw  <rearnsha@arm.com>
+
+       * src/arm/sysv.S: Fix typo.
+
+2002-09-28  Richard Earnshaw  <rearnsha@arm.com>
+
+       * src/arm/sysv.S: If we don't have machine/asm.h and the pre-processor
+       has defined __USER_LABEL_PREFIX__, then use it in CNAME.
+       (ffi_call_SYSV): Handle soft-float.
+
+2002-09-27  Bo Thorsen  <bo@suse.de>
+
+       * include/ffi.h.in: Fix multilib x86-64 support.
+
+2002-09-22  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * Makefile.am (all-multi): Fix multilib parallel build.
+
+2002-07-19  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * configure.in (sh[34]*-*-linux*): Add brackets.
+       * configure: Regenerate.
+
+2002-07-18  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       * Makefile.am: Add SH support.
+       * Makefile.in: Regenerate.
+       * configure.in (sh-*-linux*, sh[34]*-*-linux*): Add target.
+       * configure: Regenerate.
+       * include/ffi.h.in: Add SH support.
+       * src/sh/ffi.c: New file.
+       * src/sh/sysv.S: New file.
+       * src/types.c: Add SH support.
+
+2002-07-16  Bo Thorsen  <bo@suse.de>
+
+       * src/x86/ffi64.c: New file that adds x86-64 support.
+       * src/x86/unix64.S: New file that handles argument setup for
+       x86-64.
+       * src/x86/sysv.S: Don't use this on x86-64.
+       * src/x86/ffi.c: Don't use this on x86-64.
+       Remove unused vars.
+       * src/prep_cif.c (ffi_prep_cif): Don't do stack size calculation
+       for x86-64.
+       * src/ffitest.c (struct6): New test that tests a special case in
+       the x86-64 ABI.
+       (struct7): Likewise.
+       (struct8): Likewise.
+       (struct9): Likewise.
+       (closure_test_fn): Silence warning about this when it's not used.
+       (main): Add the new tests.
+       (main): Fix a couple of wrong casts and silence some compiler warnings.
+       * include/ffi.h.in: Add x86-64 ABI definition.
+       * fficonfig.h.in: Regenerate.
+       * Makefile.am: Add x86-64 support.
+       * configure.in: Likewise.
+       * Makefile.in: Regenerate.
+       * configure: Likewise.
+
+2002-06-24  Bo Thorsen  <bo@suse.de>
+
+       * src/types.c: Merge settings for similar architectures.
+       Add x86-64 sizes and alignments.
+
+2002-06-23  Bo Thorsen  <bo@suse.de>
+
+       * src/arm/ffi.c (ffi_prep_args): Remove unused vars.
+       * src/sparc/ffi.c (ffi_prep_args_v8): Likewise.
+       * src/mips/ffi.c (ffi_prep_args): Likewise.
+       * src/m68k/ffi.c (ffi_prep_args): Likewise.
+
+2002-07-18  H.J. Lu  (hjl@gnu.org)
+
+       * Makefile.am (TARGET_SRC_MIPS_LINUX): New.
+       (libffi_la_SOURCES): Support MIPS_LINUX.
+       (libffi_convenience_la_SOURCES): Likewise.
+       * Makefile.in: Regenerated.
+
+       * configure.in (mips64*-*): Skip.
+       (mips*-*-linux*): New.
+       * configure: Regenerated.
+
+       * src/mips/ffi.c: Include <sgidefs.h>.
+
+2002-06-06  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * src/s390/sysv.S: Save/restore %r6.  Add DWARF-2 unwind info.
+
+2002-05-27  Roger Sayle  <roger@eyesopen.com>
+
+       * src/x86/ffi.c (ffi_prep_args): Remove reference to avn.
+
+2002-05-27  Bo Thorsen  <bo@suse.de>
+
+       * src/x86/ffi.c (ffi_prep_args): Remove unused variable and
+       fix formatting.
+
+2002-05-13  Andreas Tobler  <a.tobler@schweiz.ch>
+
+       * src/powerpc/ffi_darwin.c (ffi_prep_closure): Declare fd at
+       beginning of function (for older apple cc).
+
+2002-05-08  Alexandre Oliva  <aoliva@redhat.com>
+
+       * configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at
+       script entry, and set LD to it when configuring multilibs.
+       * configure: Rebuilt.
+
+2002-05-05  Jason Thorpe  <thorpej@wasabisystems.com>
+
+       * configure.in (sparc64-*-netbsd*): Add target.
+       (sparc-*-netbsdelf*): Likewise.
+       * configure: Regenerate.
+
+2002-04-28  David S. Miller  <davem@redhat.com>
+
+       * configure.in, configure: Fix SPARC test in previous change.
+
+2002-04-29  Gerhard Tonn  <GerhardTonn@swol.de>
+
+       * Makefile.am: Add Linux for S/390 support.
+       * Makefile.in: Regenerate.
+       * configure.in: Add Linux for S/390 support.
+       * configure: Regenerate.
+       * include/ffi.h.in: Add Linux for S/390 support.
+       * src/s390/ffi.c: New file from libffi CVS tree.
+       * src/s390/sysv.S: New file from libffi CVS tree.
+
+2002-04-28  Jakub Jelinek  <jakub@redhat.com>
+
+       * configure.in (HAVE_AS_SPARC_UA_PCREL): Check for working
+       %r_disp32().
+       * src/sparc/v8.S: Use it.
+       * src/sparc/v9.S: Likewise.
+       * fficonfig.h.in: Rebuilt.
+       * configure: Rebuilt.
+
+2002-04-08  Hans Boehm  <Hans_Boehm@hp.com>
+
+       * src/java_raw_api.c (ffi_java_raw_size): Handle FFI_TYPE_DOUBLE
+       correctly.
+       * src/ia64/unix.S: Add unwind information. Fix comments.
+       Save sp in a way that's compatible with unwind info.
+       (ffi_call_unix): Correctly restore sp in all cases.
+       * src/ia64/ffi.c: Add, fix comments.
+
+2002-04-08  Jakub Jelinek  <jakub@redhat.com>
+
+       * src/sparc/v8.S: Make .eh_frame dependent on target word size.
+
+2002-04-06  Jason Thorpe  <thorpej@wasabisystems.com>
+
+       * configure.in (alpha*-*-netbsd*): Add target.
+       * configure: Regenerate.
+
+2002-04-04  Jeff Sturm  <jsturm@one-point.com>
+
+       * src/sparc/v8.S: Add unwind info.
+       * src/sparc/v9.S: Likewise.
+
+2002-03-30  Krister Walfridsson  <cato@df.lth.se>
+
+       * configure.in: Enable i*86-*-netbsdelf*.
+       * configure: Rebuilt.
+
+2002-03-29  David Billinghurst <David.Billinghurst@riotinto.com>
+
+       PR other/2620
+       * src/mips/n32.s: Delete
+       * src/mips/o32.s: Delete
+
+2002-03-21  Loren J. Rittle  <ljrittle@acm.org>
+
+       * configure.in: Enable alpha*-*-freebsd*.
+       * configure: Rebuilt.
+
+2002-03-17  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
+
+       * Makefile.am: libfficonvenience -> libffi_convenience.
+       * Makefile.in: Rebuilt.
+
+       * Makefile.am: Define ffitest_OBJECTS.
+       * Makefile.in: Rebuilt.
+
+2002-03-07  Andreas Tobler  <toa@pop.agri.ch>
+           David Edelsohn  <edelsohn@gnu.org>
+
+       * Makefile.am (EXTRA_DIST): Add Darwin and AIX closure files.
+       (TARGET_SRC_POWERPC_AIX): Add aix_closure.S.
+       (TARGET_SRC_POWERPC_DARWIN): Add darwin_closure.S.
+       * Makefile.in: Regenerate.
+       * include/ffi.h.in: Add AIX and Darwin closure definitions.
+       * src/powerpc/ffi_darwin.c (ffi_prep_closure): New function.
+       (flush_icache, flush_range): New functions.
+       (ffi_closure_helper_DARWIN): New function.
+       * src/powerpc/aix_closure.S: New file.
+       * src/powerpc/darwin_closure.S: New file.
+
+2002-02-24  Jeff Sturm  <jsturm@one-point.com>
+
+       * include/ffi.h.in: Add typedef for ffi_arg.
+       * src/ffitest.c (main): Declare rint with ffi_arg.
+
+2002-02-21  Andreas Tobler  <toa@pop.agri.ch>
+
+       * src/powerpc/ffi_darwin.c (ffi_prep_args): Skip appropriate
+       number of GPRs for floating-point arguments.
+
+2002-01-31  Anthony Green  <green@redhat.com>
+
+       * configure: Rebuilt.
+       * configure.in: Replace CHECK_SIZEOF and endian tests with
+       cross-compiler friendly macros.
+       * aclocal.m4 (AC_COMPILE_CHECK_SIZEOF, AC_C_BIGENDIAN_CROSS): New
+       macros.
+
+2002-01-18  David Edelsohn  <edelsohn@gnu.org>
+
+       * src/powerpc/darwin.S (_ffi_call_AIX): New.
+       * src/powerpc/aix.S (ffi_call_DARWIN): New.
+
+2002-01-17  David Edelsohn  <edelsohn@gnu.org>
+
+       * Makefile.am (EXTRA_DIST): Add Darwin and AIX files.
+       (TARGET_SRC_POWERPC_AIX): New.
+       (POWERPC_AIX): New stanza.
+       * Makefile.in: Regenerate.
+       * configure.in: Add AIX case.
+       * configure: Regenerate.
+       * include/ffi.h.in (ffi_abi): Add FFI_AIX.
+       * src/powerpc/ffi_darwin.c (ffi_status): Use "long" to scale frame
+       size.  Fix "long double" support.
+       (ffi_call): Add FFI_AIX case.
+       * src/powerpc/aix.S: New.
+
+2001-10-09  John Hornkvist  <john@toastedmarshmallow.com>
+
+       Implement Darwin PowerPC ABI.
+       * configure.in: Handle powerpc-*-darwin*.
+       * Makefile.am: Set source files for POWERPC_DARWIN.
+       * configure: Rebuilt.
+       * Makefile.in: Rebuilt.
+       * include/ffi.h.in: Define FFI_DARWIN and FFI_DEFAULT_ABI for
+       POWERPC_DARWIN.
+       * src/powerpc/darwin.S: New file.
+       * src/powerpc/ffi_darwin.c: New file.
+
+2001-10-07  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * src/x86/ffi.c: Fix spelling error of "separate" as "seperate".
+
+2001-07-16  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * src/x86/sysv.S: Avoid gas-only .balign directive.
+       Use C style comments.
+
+2001-07-16  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * src/alpha/ffi.c (ffi_prep_closure): Avoid gas-only mnemonic.
+       Fixes PR bootstrap/3563.
+
+2001-06-26  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * src/alpha/osf.S (ffi_closure_osf): Use .rdata for ECOFF.
+
+2001-06-25  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       * configure.in: Recognize sparc*-sun-* host.
+       * configure: Regenerate.
+
+2001-06-06  Andrew Haley  <aph@redhat.com>
+
+       * src/alpha/osf.S (__FRAME_BEGIN__): Conditionalize for ELF.
+
+2001-06-03  Andrew Haley  <aph@redhat.com>
+
+       * src/alpha/osf.S: Add unwind info.
+       * src/powerpc/sysv.S: Add unwind info.
+       * src/powerpc/ppc_closure.S: Likewise.
+
+2000-05-31  Jeff Sturm  <jsturm@one-point.com>
+
+       * configure.in: Fix AC_ARG_ENABLE usage.
+       * configure: Rebuilt.
+
+2001-05-06  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
+
+       * configure.in: Remove warning about beta code.
+       * configure: Rebuilt.
+
+2001-04-25  Hans Boehm <Hans_Boehm@hp.com>
+
+       * src/ia64/unix.S: Restore stack pointer when returning from
+       ffi_closure_UNIX.
+       * src/ia64/ffi.c: Fix typo in comment.
+
+2001-04-18  Jim Wilson  <wilson@redhat.com>
+
+       * src/ia64/unix.S: Delete unnecessary increment and decrement of loc2
+       to eliminate RAW DV.
+
+2001-04-12  Bryce McKinlay  <bryce@albatross.co.nz>
+
+       * Makefile.am: Make a libtool convenience library.
+       * Makefile.in: Rebuilt.
+
+2001-03-29  Bryce McKinlay  <bryce@albatross.co.nz>
+
+       * configure.in: Use different syntax for subdirectory creation.
+       * configure: Rebuilt.
+
+2001-03-27  Jon Beniston  <jon@beniston.com>
+
+       * configure.in: Added X86_WIN32 target (Win32, CygWin, MingW).
+       * configure: Rebuilt.
+       * Makefile.am: Added X86_WIN32 target support.
+       * Makefile.in: Rebuilt.
+
+       * include/ffi.h.in: Added X86_WIN32 target support.
+
+       * src/ffitest.c: Doesn't run structure tests for X86_WIN32 targets.
+       * src/types.c: Added X86_WIN32 target support.
+
+       * src/x86/win32.S: New file. Based on sysv.S, but with EH
+       stuff removed and made to work with CygWin's gas.
+
+2001-03-26  Bryce McKinlay  <bryce@albatross.co.nz>
+
+       * configure.in: Make target subdirectory in build dir.
+       * Makefile.am: Override suffix based rules to specify correct output
+       subdirectory.
+       * Makefile.in: Rebuilt.
+       * configure: Rebuilt.
+
+2001-03-23  Kevin B Hendricks  <khendricks@ivey.uwo.ca>
+
+       * src/powerpc/ppc_closure.S: New file.
+       * src/powerpc/ffi.c (ffi_prep_args): Fixed ABI compatibility bug
+       involving long long and register pairs.
+       (ffi_prep_closure): New function.
+       (flush_icache): Likewise.
+       (ffi_closure_helper_SYSV): Likewise.
+       * include/ffi.h.in (FFI_CLOSURES): Define on PPC.
+       (FFI_TRAMPOLINE_SIZE): Likewise.
+       (FFI_NATIVE_RAW_API): Likewise.
+       * Makefile.in: Rebuilt.
+       * Makefile.am (EXTRA_DIST): Added src/powerpc/ppc_closure.S.
+       (TARGET_SRC_POWERPC): Likewise.
+
+2001-03-19  Tom Tromey  <tromey@redhat.com>
+
+       * Makefile.in: Rebuilt.
+       * Makefile.am (ffitest_LDFLAGS): New macro.
+
+2001-03-02  Nick Clifton  <nickc@redhat.com>
+
+       * include/ffi.h.in: Remove RCS ident string.
+       * include/ffi_mips.h: Remove RCS ident string.
+       * src/debug.c: Remove RCS ident string.
+       * src/ffitest.c: Remove RCS ident string.
+       * src/prep_cif.c: Remove RCS ident string.
+       * src/types.c: Remove RCS ident string.
+       * src/alpha/ffi.c: Remove RCS ident string.
+       * src/alpha/osf.S: Remove RCS ident string.
+       * src/arm/ffi.c: Remove RCS ident string.
+       * src/arm/sysv.S: Remove RCS ident string.
+       * src/mips/ffi.c: Remove RCS ident string.
+       * src/mips/n32.S: Remove RCS ident string.
+       * src/mips/o32.S: Remove RCS ident string.
+       * src/sparc/ffi.c: Remove RCS ident string.
+       * src/sparc/v8.S: Remove RCS ident string.
+       * src/sparc/v9.S: Remove RCS ident string.
+       * src/x86/ffi.c: Remove RCS ident string.
+       * src/x86/sysv.S: Remove RCS ident string.
+
+2001-02-08  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * include/ffi.h.in: Change sourceware.cygnus.com references to
+       gcc.gnu.org.
+
+2000-12-09  Richard Henderson  <rth@redhat.com>
+
+       * src/alpha/ffi.c (ffi_call): Simplify struct return test.
+       (ffi_closure_osf_inner): Index rather than increment avalue
+       and arg_types.  Give ffi_closure_osf the raw return value type.
+       * src/alpha/osf.S (ffi_closure_osf): Handle return value type
+       promotion.
+
+2000-12-07  Richard Henderson  <rth@redhat.com>
+
+       * src/raw_api.c (ffi_translate_args): Fix typo.
+       (ffi_prep_closure): Likewise.
+
+       * include/ffi.h.in [ALPHA]: Define FFI_CLOSURES and
+       FFI_TRAMPOLINE_SIZE.
+       * src/alpha/ffi.c (ffi_prep_cif_machdep): Adjust minimal
+       cif->bytes for new ffi_call_osf implementation.
+       (ffi_prep_args): Absorb into ...
+       (ffi_call): ... here.  Do all stack allocation here and
+       avoid a callback function.
+       (ffi_prep_closure, ffi_closure_osf_inner): New.
+       * src/alpha/osf.S (ffi_call_osf): Reimplement with no callback.
+       (ffi_closure_osf): New.
+
+2000-09-10  Alexandre Oliva  <aoliva@redhat.com>
+
+       * config.guess, config.sub, install-sh: Removed.
+       * ltconfig, ltmain.sh, missing, mkinstalldirs: Likewise.
+       * Makefile.in: Rebuilt.
+
+       * acinclude.m4: Include libtool macros from the top level.
+       * aclocal.m4, configure: Rebuilt.
+
+2000-08-22  Alexandre Oliva  <aoliva@redhat.com>
+
+       * configure.in [i*86-*-freebsd*] (TARGET, TARGETDIR): Set.
+       * configure: Rebuilt.
+
+2000-05-11  Scott Bambrough  <scottb@netwinder.org>
+
+       * libffi/src/arm/sysv.S (ffi_call_SYSV): Doubles are not saved to
+       memory correctly.  Use conditional instructions, not branches where
+       possible.
+
+2000-05-04  Tom Tromey  <tromey@cygnus.com>
+
+       * configure: Rebuilt.
+       * configure.in: Match `arm*-*-linux-*'.
+       From Chris Dornan <cdornan@arm.com>.
+
+2000-04-28  Jakub Jelinek  <jakub@redhat.com>
+
+       * Makefile.am (SUBDIRS): Define.
+       (AM_MAKEFLAGS): Likewise.
+       (Multilib support.): Add section.
+       * Makefile.in: Rebuilt.
+       * ltconfig (extra_compiler_flags, extra_compiler_flags_value):
+       New variables. Set for gcc using -print-multi-lib. Export them
+       to libtool.
+       (sparc64-*-linux-gnu*): Use libsuff 64 for search paths.
+       * ltmain.sh (B|b|V): Don't throw away gcc's -B, -b and -V options
+       for -shared links.
+       (extra_compiler_flags_value, extra_compiler_flags): Check these
+       for extra compiler options which need to be passed down in
+       compiler_flags.
+
+2000-04-16  Anthony Green  <green@redhat.com>
+
+       * configure: Rebuilt.
+       * configure.in: Change i*86-pc-linux* to i*86-*-linux*.
+
+2000-04-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * include/ffi.h.in (SPARC64): Define for 64bit SPARC builds.
+       Set SPARC FFI_DEFAULT_ABI based on SPARC64 define.
+       * src/sparc/ffi.c (ffi_prep_args_v8): Renamed from ffi_prep_args.
+       Replace all void * sizeofs with sizeof(int).
+       Only compare type with FFI_TYPE_LONGDOUBLE if LONGDOUBLE is
+       different than DOUBLE.
+       Remove FFI_TYPE_SINT32 and FFI_TYPE_UINT32 cases (handled elsewhere).
+       (ffi_prep_args_v9): New function.
+       (ffi_prep_cif_machdep): Handle V9 ABI and long long on V8.
+       (ffi_V9_return_struct): New function.
+       (ffi_call): Handle FFI_V9 ABI from 64bit code and FFI_V8 ABI from
+       32bit code (not yet cross-arch calls).
+       * src/sparc/v8.S: Add struct return delay nop.
+       Handle long long.
+       * src/sparc/v9.S: New file.
+       * src/prep_cif.c (ffi_prep_cif): Return structure pointer
+       is used on sparc64 only for structures larger than 32 bytes.
+       Pass by reference for structures is done for structure arguments
+       larger than 16 bytes.
+       * src/ffitest.c (main): Use 64bit rint on sparc64.
+       Run long long tests on sparc.
+       * src/types.c (FFI_TYPE_POINTER): Pointer is 64bit on alpha and
+       sparc64.
+       (FFI_TYPE_LONGDOUBLE): long double is 128 bit aligned to 128 bits
+       on sparc64.
+       * configure.in (sparc-*-linux*): New supported target.
+       (sparc64-*-linux*): Likewise.
+       * configure: Rebuilt.
+       * Makefile.am: Add v9.S to SPARC files.
+       * Makefile.in: Likewise.
+       (LINK): Surround $(CCLD) into double quotes, so that multilib
+       compiles work correctly.
+
+2000-04-04  Alexandre Petit-Bianco  <apbianco@cygnus.com>
+
+       * configure: Rebuilt.
+       * configure.in: (i*86-*-solaris*): New libffi target. Patch
+       proposed by Bryce McKinlay.
+
+2000-03-20  Tom Tromey  <tromey@cygnus.com>
+
+       * Makefile.in: Hand edit for java_raw_api.lo.
+
+2000-03-08  Bryce McKinlay  <bryce@albatross.co.nz>
+
+       * config.guess, config.sub: Update from the gcc tree.
+       Fix for PR libgcj/168.
+
+2000-03-03  Tom Tromey  <tromey@cygnus.com>
+
+       * Makefile.in: Fixed ia64 by hand.
+
+       * configure: Rebuilt.
+       * configure.in (--enable-multilib): New option.
+       (libffi_basedir): New subst.
+       (AC_OUTPUT): Added multilib code.
+
+2000-03-02  Tom Tromey  <tromey@cygnus.com>
+
+       * Makefile.in: Rebuilt.
+       * Makefile.am (TARGET_SRC_IA64): Use `ia64', not `alpha', as
+       directory name.
+
+2000-02-25  Hans Boehm <boehm@acm.org>
+
+       * src/ia64/ffi.c, src/ia64/ia64_flags.h, src/ia64/unix.S: New
+       files.
+       * src/raw_api.c (ffi_translate_args): Fixed typo in argument
+       list.
+       (ffi_prep_raw_closure): Use ffi_translate_args, not
+       ffi_closure_translate.
+       * src/java_raw_api.c: New file.
+       * src/ffitest.c (closure_test_fn): New function.
+       (main): Define `rint' as long long on IA64.  Added new test when
+       FFI_CLOSURES is defined.
+       * include/ffi.h.in (ALIGN): Use size_t, not unsigned.
+       (ffi_abi): Recognize IA64.
+       (ffi_raw): Added `flt' field.
+       Added "Java raw API" code.
+       * configure.in: Recognize ia64.
+       * Makefile.am (TARGET_SRC_IA64): New macro.
+       (libffi_la_common_SOURCES): Added java_raw_api.c.
+       (libffi_la_SOURCES): Define in IA64 case.
+
+2000-01-04  Tom Tromey  <tromey@cygnus.com>
+
+       * Makefile.in: Rebuilt with newer automake.
+
+1999-12-31  Tom Tromey  <tromey@cygnus.com>
+
+       * Makefile.am (INCLUDES): Added -I$(top_srcdir)/src.
+
+1999-09-01  Tom Tromey  <tromey@cygnus.com>
+
+       * include/ffi.h.in: Removed PACKAGE and VERSION defines and
+       undefs.
+       * fficonfig.h.in: Rebuilt.
+       * configure: Rebuilt.
+       * configure.in: Pass 3rd argument to AM_INIT_AUTOMAKE.
+       Use AM_PROG_LIBTOOL (automake 1.4 compatibility).
+       * acconfig.h: Don't #undef PACKAGE or VERSION.
+
+1999-08-09  Anthony Green  <green@cygnus.com>
+
+       * include/ffi.h.in: Try to work around messy header problem
+       with PACKAGE and VERSION.
+
+       * configure: Rebuilt.
+       * configure.in: Change version to 2.00-beta.
+
+       * fficonfig.h.in: Rebuilt.
+       * acconfig.h (FFI_NO_STRUCTS, FFI_NO_RAW_API): Define.
+
+       * src/x86/ffi.c (ffi_raw_call): Rename.
+
+1999-08-02  Kresten Krab Thorup  <krab@dominiq.is.s.u-tokyo.ac.jp>
+
+       * src/x86/ffi.c (ffi_closure_SYSV): New function.
+       (ffi_prep_incoming_args_SYSV): Ditto.
+       (ffi_prep_closure): Ditto.
+       (ffi_closure_raw_SYSV): Ditto.
+       (ffi_prep_raw_closure): More ditto.
+       (ffi_call_raw): Final ditto.
+
+       * include/ffi.h.in: Add definitions for closure and raw API.
+
+       * src/x86/ffi.c (ffi_prep_cif_machdep): Added case for
+       FFI_TYPE_UINT64.
+
+       * Makefile.am (libffi_la_common_SOURCES): Added raw_api.c
+
+       * src/raw_api.c: New file.
+
+       * include/ffi.h.in (ffi_raw): New type.
+       (UINT_ARG, SINT_ARG): New defines.
+       (ffi_closure, ffi_raw_closure): New types.
+       (ffi_prep_closure, ffi_prep_raw_closure): New declarations.
+
+       * configure.in: Add check for endianness and sizeof void*.
+
+       * src/x86/sysv.S (ffi_call_SYSV): Call fixup routine via argument,
+       instead of directly.
+
+       * configure: Rebuilt.
+
+Thu Jul  8 14:28:42 1999  Anthony Green  <green@cygnus.com>
+
+       * configure.in: Add x86 and powerpc BeOS configurations.
+       From Makoto Kato <m_kato@ga2.so-net.ne.jp>.
+
+1999-05-09  Anthony Green  <green@cygnus.com>
+
+       * configure.in: Add warning about this being beta code.
+       Remove src/Makefile.am from the picture.
+       * configure: Rebuilt.
+
+       * Makefile.am: Move logic from src/Makefile.am.  Add changes
+       to support libffi as a target library.
+       * Makefile.in: Rebuilt.
+
+       * aclocal.m4, config.guess, config.sub, ltconfig, ltmain.sh:
+       Upgraded to new autoconf, automake, libtool.
+
+       * README: Tweaks.
+
+       * LICENSE: Update copyright date.
+
+       * src/Makefile.am, src/Makefile.in: Removed.
+
+1998-11-29  Anthony Green  <green@cygnus.com>
+
+       * include/ChangeLog: Removed.
+       * src/ChangeLog: Removed.
+       * src/mips/ChangeLog: Removed.
+       * src/sparc/ChangeLog: Remboved.
+       * src/x86/ChangeLog: Removed.
+
+       * ChangeLog.v1: Created.
diff --git a/.pc/aarch64/README b/.pc/aarch64/README
new file mode 100644 (file)
index 0000000..ccd4f8b
--- /dev/null
@@ -0,0 +1,366 @@
+Status
+======
+
+libffi-3.0.12 was released on XXXXXXX.  Check the libffi web page for
+updates: <URL:http://sourceware.org/libffi/>.
+
+
+What is libffi?
+===============
+
+Compilers for high level languages generate code that follow certain
+conventions. These conventions are necessary, in part, for separate
+compilation to work. One such convention is the "calling
+convention". The "calling convention" is essentially a set of
+assumptions made by the compiler about where function arguments will
+be found on entry to a function. A "calling convention" also specifies
+where the return value for a function is found.
+
+Some programs may not know at the time of compilation what arguments
+are to be passed to a function. For instance, an interpreter may be
+told at run-time about the number and types of arguments used to call
+a given function. Libffi can be used in such programs to provide a
+bridge from the interpreter program to compiled code.
+
+The libffi library provides a portable, high level programming
+interface to various calling conventions. This allows a programmer to
+call any function specified by a call interface description at run
+time.  
+
+FFI stands for Foreign Function Interface.  A foreign function
+interface is the popular name for the interface that allows code
+written in one language to call code written in another language. The
+libffi library really only provides the lowest, machine dependent
+layer of a fully featured foreign function interface. A layer must
+exist above libffi that handles type conversions for values passed
+between the two languages.
+
+
+Supported Platforms
+===================
+
+Libffi has been ported to many different platforms.
+For specific configuration details and testing status, please
+refer to the wiki page here:
+
+ http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.11
+
+At the time of release, the following basic configurations have been
+tested:
+
+|-----------------+------------------|
+| Architecture    | Operating System |
+|-----------------+------------------|
+| Alpha           | Linux            |
+| Alpha           | Tru64            |
+| ARM             | Linux            |
+| ARM             | iOS              |
+| AVR32           | Linux            |
+| Blackfin        | uClinux          |
+| HPPA            | HPUX             |
+| IA-64           | Linux            |
+| M68K            | FreeMiNT         |
+| M68K            | RTEMS            |
+| MIPS            | IRIX             |
+| MIPS            | Linux            |
+| MIPS            | RTEMS            |
+| MIPS64          | Linux            |
+| PowerPC         | AMIGA            |
+| PowerPC         | Linux            |
+| PowerPC         | Mac OSX          |
+| PowerPC         | FreeBSD          |
+| PowerPC64       | Linux            |
+| S390            | Linux            |
+| S390X           | Linux            |
+| SPARC           | Linux            |
+| SPARC           | Solaris          |
+| SPARC64         | Linux            |
+| SPARC64         | FreeBSD          |
+| TILE-Gx/TILEPro | Linux            |
+| X86             | FreeBSD          |
+| X86             | Interix          |
+| X86             | kFreeBSD         |
+| X86             | Linux            |
+| X86             | Mac OSX          |
+| X86             | OpenBSD          |
+| X86             | OS/2             |
+| X86             | Solaris          |
+| X86             | Windows/Cygwin   |
+| X86             | Windows/MingW    |
+| X86-64          | FreeBSD          |
+| X86-64          | Linux            |
+| X86-64          | Linux/x32        |
+| X86-64          | OpenBSD          |
+| X86-64          | Windows/MingW    |
+|-----------------+------------------|
+
+Please send additional platform test results to
+libffi-discuss@sourceware.org and feel free to update the wiki page
+above.
+
+Installing libffi
+=================
+
+First you must configure the distribution for your particular
+system. Go to the directory you wish to build libffi in and run the
+"configure" program found in the root directory of the libffi source
+distribution.
+
+You may want to tell configure where to install the libffi library and
+header files. To do that, use the --prefix configure switch.  Libffi
+will install under /usr/local by default. 
+
+If you want to enable extra run-time debugging checks use the the
+--enable-debug configure switch. This is useful when your program dies
+mysteriously while using libffi. 
+
+Another useful configure switch is --enable-purify-safety. Using this
+will add some extra code which will suppress certain warnings when you
+are using Purify with libffi. Only use this switch when using 
+Purify, as it will slow down the library.
+
+It's also possible to build libffi on Windows platforms with
+Microsoft's Visual C++ compiler.  In this case, use the msvcc.sh
+wrapper script during configuration like so:
+
+path/to/configure CC=path/to/msvcc.sh LD=link CPP=\"cl -nologo -EP\"
+
+For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64".
+You may also need to specify --build appropriately. When building with MSVC
+under a MingW environment, you may need to remove the line in configure
+that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not
+present in MingW, and is not required when using MingW-style paths.)
+
+For iOS builds, the 'libffi.xcodeproj' Xcode project is available.
+
+Configure has many other options. Use "configure --help" to see them all.
+
+Once configure has finished, type "make". Note that you must be using
+GNU make.  You can ftp GNU make from prep.ai.mit.edu:/pub/gnu.
+
+To ensure that libffi is working as advertised, type "make check".
+This will require that you have DejaGNU installed.
+
+To install the library and header files, type "make install".
+
+
+History
+=======
+
+See the ChangeLog files for details.
+
+3.0.12 XXX-XX-XX
+       Add Blackfin support.
+       Add TILE-Gx/TILEPro support.
+
+3.0.11 Apr-11-12
+        Lots of build fixes.
+       Add Amiga newer MacOS support.
+       Add support for variadic functions (ffi_prep_cif_var).
+       Add Linux/x32 support.
+       Add thiscall, fastcall and MSVC cdecl support on Windows.
+       Add Amiga and newer MacOS support.
+       Add m68k FreeMiNT support.
+       Integration with iOS' xcode build tools.
+       Fix Octeon and MC68881 support.
+       Fix code pessimizations.
+       Lots of build fixes.
+
+3.0.10 Aug-23-11
+        Add support for Apple's iOS.
+       Add support for ARM VFP ABI.
+        Add RTEMS support for MIPS and M68K.
+       Fix instruction cache clearing problems on
+         ARM and SPARC.
+       Fix the N64 build on mips-sgi-irix6.5.
+       Enable builds with Microsoft's compiler.
+       Enable x86 builds with Oracle's Solaris compiler.
+       Fix support for calling code compiled with Oracle's Sparc
+         Solaris compiler.
+       Testsuite fixes for Tru64 Unix.
+       Additional platform support.
+
+3.0.9 Dec-31-09
+        Add AVR32 and win64 ports.  Add ARM softfp support.
+       Many fixes for AIX, Solaris, HP-UX, *BSD.
+       Several PowerPC and x86-64 bug fixes.
+       Build DLL for windows.
+
+3.0.8 Dec-19-08
+        Add *BSD, BeOS, and PA-Linux support.
+
+3.0.7 Nov-11-08
+        Fix for ppc FreeBSD.
+       (thanks to Andreas Tobler)
+
+3.0.6 Jul-17-08
+        Fix for closures on sh.
+       Mark the sh/sh64 stack as non-executable.
+       (both thanks to Kaz Kojima)
+
+3.0.5 Apr-3-08
+        Fix libffi.pc file.
+       Fix #define ARM for IcedTea users.
+       Fix x86 closure bug.
+
+3.0.4 Feb-24-08
+        Fix x86 OpenBSD configury.
+
+3.0.3 Feb-22-08
+        Enable x86 OpenBSD thanks to Thomas Heller, and
+       x86-64 FreeBSD thanks to Björn König and Andreas Tobler.
+       Clean up test instruction in README.
+
+3.0.2 Feb-21-08
+        Improved x86 FreeBSD support.
+       Thanks to Björn König.
+
+3.0.1 Feb-15-08
+        Fix instruction cache flushing bug on MIPS.
+       Thanks to David Daney.
+
+3.0.0 Feb-15-08
+        Many changes, mostly thanks to the GCC project.
+       Cygnus Solutions is now Red Hat.
+
+  [10 years go by...]
+
+1.20 Oct-5-98
+       Raffaele Sena produces ARM port.
+
+1.19 Oct-5-98
+       Fixed x86 long double and long long return support.
+       m68k bug fixes from Andreas Schwab.
+       Patch for DU assembler compatibility for the Alpha from Richard
+       Henderson.
+
+1.18 Apr-17-98
+       Bug fixes and MIPS configuration changes.
+
+1.17 Feb-24-98
+       Bug fixes and m68k port from Andreas Schwab. PowerPC port from
+       Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes.
+
+1.16 Feb-11-98
+       Richard Henderson produces Alpha port.
+
+1.15 Dec-4-97
+       Fixed an n32 ABI bug. New libtool, auto* support.
+
+1.14 May-13-97
+       libtool is now used to generate shared and static libraries.
+       Fixed a minor portability problem reported by Russ McManus
+       <mcmanr@eq.gs.com>.
+
+1.13 Dec-2-96
+       Added --enable-purify-safety to keep Purify from complaining
+       about certain low level code.
+       Sparc fix for calling functions with < 6 args.
+       Linux x86 a.out fix.
+
+1.12 Nov-22-96
+       Added missing ffi_type_void, needed for supporting void return 
+       types. Fixed test case for non MIPS machines. Cygnus Support 
+       is now Cygnus Solutions. 
+
+1.11 Oct-30-96
+       Added notes about GNU make.
+
+1.10 Oct-29-96
+       Added configuration fix for non GNU compilers.
+
+1.09 Oct-29-96
+       Added --enable-debug configure switch. Clean-ups based on LCLint 
+       feedback. ffi_mips.h is always installed. Many configuration 
+       fixes. Fixed ffitest.c for sparc builds.
+
+1.08 Oct-15-96
+       Fixed n32 problem. Many clean-ups.
+
+1.07 Oct-14-96
+       Gordon Irlam rewrites v8.S again. Bug fixes.
+
+1.06 Oct-14-96
+       Gordon Irlam improved the sparc port. 
+
+1.05 Oct-14-96
+       Interface changes based on feedback.
+
+1.04 Oct-11-96
+       Sparc port complete (modulo struct passing bug).
+
+1.03 Oct-10-96
+       Passing struct args, and returning struct values works for
+       all architectures/calling conventions. Expanded tests.
+
+1.02 Oct-9-96
+       Added SGI n32 support. Fixed bugs in both o32 and Linux support.
+       Added "make test".
+
+1.01 Oct-8-96
+       Fixed float passing bug in mips version. Restructured some
+       of the code. Builds cleanly with SGI tools.
+
+1.00 Oct-7-96
+       First release. No public announcement.
+
+
+Authors & Credits
+=================
+
+libffi was originally written by Anthony Green <green@redhat.com>.
+
+The developers of the GNU Compiler Collection project have made
+innumerable valuable contributions.  See the ChangeLog file for
+details.
+
+Some of the ideas behind libffi were inspired by Gianni Mariani's free
+gencall library for Silicon Graphics machines.
+
+The closure mechanism was designed and implemented by Kresten Krab
+Thorup.
+
+Major processor architecture ports were contributed by the following
+developers:
+
+alpha          Richard Henderson
+arm            Raffaele Sena
+blackfin        Alexandre Keunecke I. de Mendonca
+cris           Simon Posnjak, Hans-Peter Nilsson
+frv            Anthony Green
+ia64           Hans Boehm
+m32r           Kazuhiro Inaoka
+m68k           Andreas Schwab
+mips           Anthony Green, Casey Marshall
+mips64         David Daney
+pa             Randolph Chung, Dave Anglin, Andreas Tobler
+powerpc                Geoffrey Keating, Andreas Tobler, 
+                        David Edelsohn, John Hornkvist
+powerpc64      Jakub Jelinek
+s390           Gerhard Tonn, Ulrich Weigand
+sh             Kaz Kojima
+sh64           Kaz Kojima
+sparc          Anthony Green, Gordon Irlam
+tile-gx/tilepro Walter Lee
+x86            Anthony Green, Jon Beniston
+x86-64         Bo Thorsen
+
+Jesper Skov and Andrew Haley both did more than their fair share of
+stepping through the code and tracking down bugs.
+
+Thanks also to Tom Tromey for bug fixes, documentation and
+configuration help.
+
+Thanks to Jim Blandy, who provided some useful feedback on the libffi
+interface.
+
+Andreas Tobler has done a tremendous amount of work on the testsuite.
+
+Alex Oliva solved the executable page problem for SElinux.
+
+The list above is almost certainly incomplete and inaccurate.  I'm
+happy to make corrections or additions upon request.
+
+If you have a problem, or have found a bug, please send a note to the
+author at green@moxielogic.com, or the project mailing list at
+libffi-discuss@sourceware.org.
diff --git a/.pc/aarch64/src/aarch64/ffi.c b/.pc/aarch64/src/aarch64/ffi.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/src/aarch64/ffitarget.h b/.pc/aarch64/src/aarch64/ffitarget.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/src/aarch64/sysv.S b/.pc/aarch64/src/aarch64/sysv.S
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/lib/libffi.exp b/.pc/aarch64/testsuite/lib/libffi.exp
new file mode 100644 (file)
index 0000000..4a65ed1
--- /dev/null
@@ -0,0 +1,350 @@
+#   Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+proc load_gcc_lib { filename } {
+    global srcdir
+    load_file $srcdir/lib/$filename
+}
+
+load_lib dg.exp
+load_lib libgloss.exp
+load_gcc_lib target-libpath.exp
+load_gcc_lib wrapper.exp
+
+
+# Define libffi callbacks for dg.exp.
+
+proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } {
+
+    # To get all \n in dg-output test strings to match printf output
+    # in a system that outputs it as \015\012 (i.e. not just \012), we
+    # need to change all \n into \r?\n.  As there is no dejagnu flag
+    # or hook to do that, we simply change the text being tested.
+    # Unfortunately, we have to know that the variable is called
+    # dg-output-text and lives in the caller of libffi-dg-test, which
+    # is two calls up.  Overriding proc dg-output would be longer and
+    # would necessarily have the same assumption.
+    upvar 2 dg-output-text output_match
+
+    if { [llength $output_match] > 1 } {
+       regsub -all "\n" [lindex $output_match 1] "\r?\n" x
+       set output_match [lreplace $output_match 1 1 $x]
+    }
+
+    # Set up the compiler flags, based on what we're going to do.
+
+    set options [list]
+    switch $do_what {
+       "compile" {
+           set compile_type "assembly"
+           set output_file "[file rootname [file tail $prog]].s"
+       }
+       "link" {
+           set compile_type "executable"
+           set output_file "[file rootname [file tail $prog]].exe"
+           # The following line is needed for targets like the i960 where
+           # the default output file is b.out.  Sigh.
+       }
+       "run" {
+           set compile_type "executable"
+           # FIXME: "./" is to cope with "." not being in $PATH.
+           # Should this be handled elsewhere?
+           # YES.
+           set output_file "./[file rootname [file tail $prog]].exe"
+           # This is the only place where we care if an executable was
+           # created or not.  If it was, dg.exp will try to run it.
+           remote_file build delete $output_file;
+       }
+       default {
+           perror "$do_what: not a valid dg-do keyword"
+           return ""
+       }
+    }
+
+    if { $extra_tool_flags != "" } {
+       lappend options "additional_flags=$extra_tool_flags"
+    }
+
+    set comp_output [libffi_target_compile "$prog" "$output_file" "$compile_type" $options];
+
+
+    return [list $comp_output $output_file]
+}
+
+
+proc libffi-dg-test { prog do_what extra_tool_flags } {
+    return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags]
+}
+
+proc libffi-init { args } {
+    global gluefile wrap_flags;
+    global srcdir
+    global blddirffi
+    global objdir
+    global TOOL_OPTIONS
+    global tool
+    global libffi_include
+    global libffi_link_flags
+    global tool_root_dir
+    global ld_library_path
+
+    set blddirffi [pwd]/.. 
+    verbose "libffi $blddirffi"
+
+    set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
+    if {$gccdir != ""} {
+       set gccdir [file dirname $gccdir]
+    }
+    verbose "gccdir $gccdir"
+
+    set ld_library_path "."
+    append ld_library_path ":${gccdir}"
+
+    set compiler "${gccdir}/xgcc"
+    if { [is_remote host] == 0 && [which $compiler] != 0 } {
+       foreach i "[exec $compiler --print-multi-lib]" {
+           set mldir ""
+           regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
+           set mldir [string trimright $mldir "\;@"]
+           if { "$mldir" == "." } {
+               continue
+           }
+           if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
+               append ld_library_path ":${gccdir}/${mldir}"
+           }
+       }
+    }
+    # add the library path for libffi.
+    append ld_library_path ":${blddirffi}/.libs"
+
+    verbose "ld_library_path: $ld_library_path"
+
+    # Point to the Libffi headers in libffi.
+    set libffi_include "${blddirffi}/include"
+    verbose "libffi_include $libffi_include"
+
+    set libffi_dir  "${blddirffi}/.libs"
+    verbose "libffi_dir $libffi_dir"
+    if { $libffi_dir != "" } {
+       set libffi_dir [file dirname ${libffi_dir}]
+       set libffi_link_flags "-L${libffi_dir}/.libs"
+    }
+
+    set_ld_library_path_env_vars
+    libffi_maybe_build_wrapper "${objdir}/testglue.o"
+}
+
+proc libffi_exit { } {
+    global gluefile;
+
+    if [info exists gluefile] {
+       file_on_build delete $gluefile;
+       unset gluefile;
+    }
+}
+
+proc libffi_target_compile { source dest type options } {
+    global gluefile wrap_flags;
+    global srcdir
+    global blddirffi
+    global TOOL_OPTIONS
+    global libffi_link_flags
+    global libffi_include
+    global target_triplet
+
+
+    if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
+       lappend options "libs=${gluefile}"
+       lappend options "ldflags=$wrap_flags"
+    }
+
+    # TOOL_OPTIONS must come first, so that it doesn't override testcase
+    # specific options.
+    if [info exists TOOL_OPTIONS] {
+       lappend  options [concat "additional_flags=$TOOL_OPTIONS" $options];
+    }
+
+    # search for ffi_mips.h in srcdir, too
+    lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include  -I${libffi_include}/.."
+    lappend options "additional_flags=${libffi_link_flags}"
+
+    # Darwin needs a stack execution allowed flag.
+
+    if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"]
+        || [istarget "*-*-darwin2*"] } {
+       lappend options "additional_flags=-Wl,-allow_stack_execute"
+    }
+
+    # If you're building the compiler with --prefix set to a place
+    # where it's not yet installed, then the linker won't be able to
+    # find the libgcc used by libffi.dylib.  We could pass the
+    # -dylib_file option, but that's complicated, and it's much easier
+    # to just make the linker find libgcc using -L options.
+    if { [string match "*-*-darwin*" $target_triplet] } {
+       lappend options "libs= -shared-libgcc"
+    }
+
+    if { [string match "*-*-openbsd*" $target_triplet] } {
+       lappend options "libs= -lpthread"
+    }
+
+    lappend options "libs= -lffi"
+
+    verbose "options: $options"
+    return [target_compile $source $dest $type $options]
+}
+
+# Utility routines.
+
+#
+# search_for -- looks for a string match in a file
+#
+proc search_for { file pattern } {
+    set fd [open $file r]
+    while { [gets $fd cur_line]>=0 } {
+       if [string match "*$pattern*" $cur_line] then {
+           close $fd
+           return 1
+       }
+    }
+    close $fd
+    return 0
+}
+
+# Modified dg-runtest that can cycle through a list of optimization options
+# as c-torture does.
+proc libffi-dg-runtest { testcases default-extra-flags } {
+    global runtests
+
+    foreach test $testcases {
+       # If we're only testing specific files and this isn't one of
+       # them, skip it.
+       if ![runtest_file_p $runtests $test] {
+           continue
+       }
+
+       # Look for a loop within the source code - if we don't find one,
+       # don't pass -funroll[-all]-loops.
+       global torture_with_loops torture_without_loops
+       if [expr [search_for $test "for*("]+[search_for $test "while*("]] {
+           set option_list $torture_with_loops
+       } else {
+           set option_list $torture_without_loops
+       }
+
+       set nshort [file tail [file dirname $test]]/[file tail $test]
+
+       foreach flags $option_list {
+           verbose "Testing $nshort, $flags" 1
+           dg-test $test $flags ${default-extra-flags}
+       }
+    }
+}
+
+
+# Like check_conditional_xfail, but callable from a dg test.
+
+proc dg-xfail-if { args } {
+    set args [lreplace $args 0 0]
+    set selector "target [join [lindex $args 1]]"
+    if { [dg-process-target $selector] == "S" } {
+       global compiler_conditional_xfail_data
+       set compiler_conditional_xfail_data $args
+    }
+}
+
+proc check-flags { args } {
+
+    # The args are within another list; pull them out.
+    set args [lindex $args 0]
+
+    # The next two arguments are optional.  If they were not specified,
+    # use the defaults.
+    if { [llength $args] == 2 } {
+       lappend $args [list "*"]
+    }
+    if { [llength $args] == 3 } {
+       lappend $args [list ""]
+    }
+
+    # If the option strings are the defaults, or the same as the
+    # defaults, there is no need to call check_conditional_xfail to
+    # compare them to the actual options.
+    if { [string compare [lindex $args 2] "*"] == 0
+        && [string compare [lindex $args 3] "" ] == 0 } {
+       set result 1    
+    } else {
+       # The target list might be an effective-target keyword, so replace
+       # the original list with "*-*-*", since we already know it matches.
+       set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]]
+    }
+
+    return $result
+}
+
+proc dg-skip-if { args } {
+    # Verify the number of arguments.  The last two are optional.
+    set args [lreplace $args 0 0]
+    if { [llength $args] < 2 || [llength $args] > 4 } {
+        error "dg-skip-if 2: need 2, 3, or 4 arguments"
+    }
+
+    # Don't bother if we're already skipping the test.
+    upvar dg-do-what dg-do-what
+    if { [lindex ${dg-do-what} 1] == "N" } {
+      return
+    }
+
+    set selector [list target [lindex $args 1]]
+    if { [dg-process-target $selector] == "S" } {
+        if [check-flags $args] {
+            upvar dg-do-what dg-do-what
+            set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+        }
+    }
+}
+
+# We need to make sure that additional_files and additional_sources
+# are both cleared out after every test.  It is not enough to clear
+# them out *before* the next test run because gcc-target-compile gets
+# run directly from some .exp files (outside of any test).  (Those
+# uses should eventually be eliminated.)
+
+# Because the DG framework doesn't provide a hook that is run at the
+# end of a test, we must replace dg-test with a wrapper.
+
+if { [info procs saved-dg-test] == [list] } {
+    rename dg-test saved-dg-test
+
+    proc dg-test { args } {
+       global additional_files
+       global additional_sources
+       global errorInfo
+
+       if { [ catch { eval saved-dg-test $args } errmsg ] } {
+           set saved_info $errorInfo
+           set additional_files ""
+           set additional_sources ""
+           error $errmsg $saved_info
+       }
+       set additional_files ""
+       set additional_sources ""
+    }
+}
+
+# Local Variables:
+# tcl-indent-level:4
+# End:
diff --git a/.pc/aarch64/testsuite/libffi.call/cls_struct_va1.c b/.pc/aarch64/testsuite/libffi.call/cls_struct_va1.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/cls_uchar_va.c b/.pc/aarch64/testsuite/libffi.call/cls_uchar_va.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/cls_uint_va.c b/.pc/aarch64/testsuite/libffi.call/cls_uint_va.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/cls_ulong_va.c b/.pc/aarch64/testsuite/libffi.call/cls_ulong_va.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/cls_ushort_va.c b/.pc/aarch64/testsuite/libffi.call/cls_ushort_va.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/nested_struct11.c b/.pc/aarch64/testsuite/libffi.call/nested_struct11.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/uninitialized.c b/.pc/aarch64/testsuite/libffi.call/uninitialized.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/va_1.c b/.pc/aarch64/testsuite/libffi.call/va_1.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/va_struct1.c b/.pc/aarch64/testsuite/libffi.call/va_struct1.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/va_struct2.c b/.pc/aarch64/testsuite/libffi.call/va_struct2.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/.pc/aarch64/testsuite/libffi.call/va_struct3.c b/.pc/aarch64/testsuite/libffi.call/va_struct3.c
new file mode 100644 (file)
index 0000000..e69de29
index 9f2b7a822c06eb4a896b8e7b3e5cb187c7a9b450..ae4c5342c4093dc9942dc006c1dac59e37171d02 100644 (file)
@@ -22,3 +22,4 @@ ios-fix
 mingw-check-fix
 whitespace-fix
 tile
+aarch64
index 596609cf95528051500c862c5294421a89e507b2..3c972c103287e0a9b029406832bdb310caf28656 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2012-10-30  James Greenhalgh  <james.greenhalgh at arm.com>
+            Marcus Shawcroft  <marcus.shawcroft at arm.com>
+
+        * README: Add details of aarch64 port.
+        * src/aarch64/ffi.c: New.
+        * src/aarch64/ffitarget.h: Likewise.
+        * src/aarch64/sysv.S: Likewise.
+
+2012-10-30  James Greenhalgh  <james.greenhalgh at arm.com>
+            Marcus Shawcroft  <marcus.shawcroft at arm.com>
+
+        * testsuite/lib/libffi.exp: Add support for aarch64.
+        * testsuite/libffi.call/cls_struct_va1.c: New.
+        * testsuite/libffi.call/cls_uchar_va.c: Likewise.
+        * testsuite/libffi.call/cls_uint_va.c: Likewise.
+        * testsuite/libffi.call/cls_ulong_va.c: Liekwise.
+        * testsuite/libffi.call/cls_ushort_va.c: Likewise.
+        * testsuite/libffi.call/nested_struct11.c: Likewise.
+        * testsuite/libffi.call/uninitialized.c: Likewise.
+        * testsuite/libffi.call/va_1.c: Likewise.
+        * testsuite/libffi.call/va_struct1.c: Likewise.
+        * testsuite/libffi.call/va_struct2.c: Likewise.
+        * testsuite/libffi.call/va_struct3.c: Likewise.
+
 2012-10-12  Walter Lee  <walt@tilera.com>
 
         * Makefile.am: Add TILE-Gx/TILEPro support.
diff --git a/README b/README
index ccd4f8b1ce8a19293bff56b454ed5812a8847669..71bd42a773713b7e6ec36adca30e6a998c3346c1 100644 (file)
--- a/README
+++ b/README
@@ -51,6 +51,7 @@ tested:
 |-----------------+------------------|
 | Architecture    | Operating System |
 |-----------------+------------------|
+| AArch64         | Linux            |
 | Alpha           | Linux            |
 | Alpha           | Tru64            |
 | ARM             | Linux            |
@@ -152,6 +153,7 @@ See the ChangeLog files for details.
 3.0.12 XXX-XX-XX
        Add Blackfin support.
        Add TILE-Gx/TILEPro support.
+       Add AArch64 support.
 
 3.0.11 Apr-11-12
         Lots of build fixes.
@@ -323,6 +325,7 @@ Thorup.
 Major processor architecture ports were contributed by the following
 developers:
 
+aarch64                Marcus Shawcroft, James Greenhalgh
 alpha          Richard Henderson
 arm            Raffaele Sena
 blackfin        Alexandre Keunecke I. de Mendonca
diff --git a/patches/aarch64 b/patches/aarch64
new file mode 100644 (file)
index 0000000..daada51
--- /dev/null
@@ -0,0 +1,2626 @@
+Index: libffi/README
+===================================================================
+--- libffi.orig/README
++++ libffi/README
+@@ -51,6 +51,7 @@ tested:
+ |-----------------+------------------|
+ | Architecture    | Operating System |
+ |-----------------+------------------|
++| AArch64         | Linux            |
+ | Alpha           | Linux            |
+ | Alpha           | Tru64            |
+ | ARM             | Linux            |
+@@ -152,6 +153,7 @@ See the ChangeLog files for details.
+ 3.0.12 XXX-XX-XX
+       Add Blackfin support.
+       Add TILE-Gx/TILEPro support.
++      Add AArch64 support.
+ 3.0.11 Apr-11-12
+         Lots of build fixes.
+@@ -323,6 +325,7 @@ Thorup.
+ Major processor architecture ports were contributed by the following
+ developers:
++aarch64               Marcus Shawcroft, James Greenhalgh
+ alpha         Richard Henderson
+ arm           Raffaele Sena
+ blackfin        Alexandre Keunecke I. de Mendonca
+Index: libffi/src/aarch64/ffi.c
+===================================================================
+--- /dev/null
++++ libffi/src/aarch64/ffi.c
+@@ -0,0 +1,1076 @@
++/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
++
++Permission is hereby granted, free of charge, to any person obtaining
++a copy of this software and associated documentation files (the
++``Software''), to deal in the Software without restriction, including
++without limitation the rights to use, copy, modify, merge, publish,
++distribute, sublicense, and/or sell copies of the Software, and to
++permit persons to whom the Software is furnished to do so, subject to
++the following conditions:
++
++The above copyright notice and this permission notice shall be
++included in all copies or substantial portions of the Software.
++
++THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
++EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
++CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
++TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
++SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
++
++#include <stdio.h>
++
++#include <ffi.h>
++#include <ffi_common.h>
++
++#include <stdlib.h>
++
++/* Stack alignment requirement in bytes */
++#define AARCH64_STACK_ALIGN 16
++
++#define N_X_ARG_REG 8
++#define N_V_ARG_REG 8
++
++#define AARCH64_FFI_WITH_V (1 << AARCH64_FFI_WITH_V_BIT)
++
++union _d
++{
++  UINT64 d;
++  UINT32 s[2];
++};
++
++struct call_context
++{
++  UINT64 x [AARCH64_N_XREG];
++  struct
++  {
++    union _d d[2];
++  } v [AARCH64_N_VREG];
++};
++
++static void *
++get_x_addr (struct call_context *context, unsigned n)
++{
++  return &context->x[n];
++}
++
++static void *
++get_s_addr (struct call_context *context, unsigned n)
++{
++#if defined __AARCH64EB__
++  return &context->v[n].d[1].s[1];
++#else
++  return &context->v[n].d[0].s[0];
++#endif
++}
++
++static void *
++get_d_addr (struct call_context *context, unsigned n)
++{
++#if defined __AARCH64EB__
++  return &context->v[n].d[1];
++#else
++  return &context->v[n].d[0];
++#endif
++}
++
++static void *
++get_v_addr (struct call_context *context, unsigned n)
++{
++  return &context->v[n];
++}
++
++/* Return the memory location at which a basic type would reside
++   were it to have been stored in register n.  */
++
++static void *
++get_basic_type_addr (unsigned short type, struct call_context *context,
++                   unsigned n)
++{
++  switch (type)
++    {
++    case FFI_TYPE_FLOAT:
++      return get_s_addr (context, n);
++    case FFI_TYPE_DOUBLE:
++      return get_d_addr (context, n);
++    case FFI_TYPE_LONGDOUBLE:
++      return get_v_addr (context, n);
++    case FFI_TYPE_UINT8:
++    case FFI_TYPE_SINT8:
++    case FFI_TYPE_UINT16:
++    case FFI_TYPE_SINT16:
++    case FFI_TYPE_UINT32:
++    case FFI_TYPE_SINT32:
++    case FFI_TYPE_INT:
++    case FFI_TYPE_POINTER:
++    case FFI_TYPE_UINT64:
++    case FFI_TYPE_SINT64:
++      return get_x_addr (context, n);
++    default:
++      FFI_ASSERT (0);
++      return NULL;
++    }
++}
++
++/* Return the alignment width for each of the basic types.  */
++
++static size_t
++get_basic_type_alignment (unsigned short type)
++{
++  switch (type)
++    {
++    case FFI_TYPE_FLOAT:
++    case FFI_TYPE_DOUBLE:
++      return sizeof (UINT64);
++    case FFI_TYPE_LONGDOUBLE:
++      return sizeof (long double);
++    case FFI_TYPE_UINT8:
++    case FFI_TYPE_SINT8:
++    case FFI_TYPE_UINT16:
++    case FFI_TYPE_SINT16:
++    case FFI_TYPE_UINT32:
++    case FFI_TYPE_INT:
++    case FFI_TYPE_SINT32:
++    case FFI_TYPE_POINTER:
++    case FFI_TYPE_UINT64:
++    case FFI_TYPE_SINT64:
++      return sizeof (UINT64);
++
++    default:
++      FFI_ASSERT (0);
++      return 0;
++    }
++}
++
++/* Return the size in bytes for each of the basic types.  */
++
++static size_t
++get_basic_type_size (unsigned short type)
++{
++  switch (type)
++    {
++    case FFI_TYPE_FLOAT:
++      return sizeof (UINT32);
++    case FFI_TYPE_DOUBLE:
++      return sizeof (UINT64);
++    case FFI_TYPE_LONGDOUBLE:
++      return sizeof (long double);
++    case FFI_TYPE_UINT8:
++      return sizeof (UINT8);
++    case FFI_TYPE_SINT8:
++      return sizeof (SINT8);
++    case FFI_TYPE_UINT16:
++      return sizeof (UINT16);
++    case FFI_TYPE_SINT16:
++      return sizeof (SINT16);
++    case FFI_TYPE_UINT32:
++      return sizeof (UINT32);
++    case FFI_TYPE_INT:
++    case FFI_TYPE_SINT32:
++      return sizeof (SINT32);
++    case FFI_TYPE_POINTER:
++    case FFI_TYPE_UINT64:
++      return sizeof (UINT64);
++    case FFI_TYPE_SINT64:
++      return sizeof (SINT64);
++
++    default:
++      FFI_ASSERT (0);
++      return 0;
++    }
++}
++
++extern void
++ffi_call_SYSV (unsigned (*)(struct call_context *context, unsigned char *,
++                          extended_cif *),
++               struct call_context *context,
++               extended_cif *,
++               unsigned,
++               void (*fn)(void));
++
++extern void
++ffi_closure_SYSV (ffi_closure *);
++
++/* Test for an FFI floating point representation.  */
++
++static unsigned
++is_floating_type (unsigned short type)
++{
++  return (type == FFI_TYPE_FLOAT || type == FFI_TYPE_DOUBLE
++        || type == FFI_TYPE_LONGDOUBLE);
++}
++
++/* Test for a homogeneous structure.  */
++
++static unsigned short
++get_homogeneous_type (ffi_type *ty)
++{
++  if (ty->type == FFI_TYPE_STRUCT && ty->elements)
++    {
++      unsigned i;
++      unsigned short candidate_type
++      = get_homogeneous_type (ty->elements[0]);
++      for (i =1; ty->elements[i]; i++)
++      {
++        unsigned short iteration_type = 0;
++        /* If we have a nested struct, we must find its homogeneous type.
++           If that fits with our candidate type, we are still
++           homogeneous.  */
++        if (ty->elements[i]->type == FFI_TYPE_STRUCT
++            && ty->elements[i]->elements)
++          {
++            iteration_type = get_homogeneous_type (ty->elements[i]);
++          }
++        else
++          {
++            iteration_type = ty->elements[i]->type;
++          }
++
++        /* If we are not homogeneous, return FFI_TYPE_STRUCT.  */
++        if (candidate_type != iteration_type)
++          return FFI_TYPE_STRUCT;
++      }
++      return candidate_type;
++    }
++
++  /* Base case, we have no more levels of nesting, so we
++     are a basic type, and so, trivially homogeneous in that type.  */
++  return ty->type;
++}
++
++/* Determine the number of elements within a STRUCT.
++
++   Note, we must handle nested structs.
++
++   If ty is not a STRUCT this function will return 0.  */
++
++static unsigned
++element_count (ffi_type *ty)
++{
++  if (ty->type == FFI_TYPE_STRUCT && ty->elements)
++    {
++      unsigned n;
++      unsigned elems = 0;
++      for (n = 0; ty->elements[n]; n++)
++      {
++        if (ty->elements[n]->type == FFI_TYPE_STRUCT
++            && ty->elements[n]->elements)
++          elems += element_count (ty->elements[n]);
++        else
++          elems++;
++      }
++      return elems;
++    }
++  return 0;
++}
++
++/* Test for a homogeneous floating point aggregate.
++
++   A homogeneous floating point aggregate is a homogeneous aggregate of
++   a half- single- or double- precision floating point type with one
++   to four elements.  Note that this includes nested structs of the
++   basic type.  */
++
++static int
++is_hfa (ffi_type *ty)
++{
++  if (ty->type == FFI_TYPE_STRUCT
++      && ty->elements[0]
++      && is_floating_type (get_homogeneous_type (ty)))
++    {
++      unsigned n = element_count (ty);
++      return n >= 1 && n <= 4;
++    }
++  return 0;
++}
++
++/* Test if an ffi_type is a candidate for passing in a register.
++
++   This test does not check that sufficient registers of the
++   appropriate class are actually available, merely that IFF
++   sufficient registers are available then the argument will be passed
++   in register(s).
++
++   Note that an ffi_type that is deemed to be a register candidate
++   will always be returned in registers.
++
++   Returns 1 if a register candidate else 0.  */
++
++static int
++is_register_candidate (ffi_type *ty)
++{
++  switch (ty->type)
++    {
++    case FFI_TYPE_VOID:
++    case FFI_TYPE_FLOAT:
++    case FFI_TYPE_DOUBLE:
++    case FFI_TYPE_LONGDOUBLE:
++    case FFI_TYPE_UINT8:
++    case FFI_TYPE_UINT16:
++    case FFI_TYPE_UINT32:
++    case FFI_TYPE_UINT64:
++    case FFI_TYPE_POINTER:
++    case FFI_TYPE_SINT8:
++    case FFI_TYPE_SINT16:
++    case FFI_TYPE_SINT32:
++    case FFI_TYPE_INT:
++    case FFI_TYPE_SINT64:
++      return 1;
++
++    case FFI_TYPE_STRUCT:
++      if (is_hfa (ty))
++        {
++          return 1;
++        }
++      else if (ty->size > 16)
++        {
++          /* Too large. Will be replaced with a pointer to memory. The
++             pointer MAY be passed in a register, but the value will
++             not. This test specifically fails since the argument will
++             never be passed by value in registers. */
++          return 0;
++        }
++      else
++        {
++          /* Might be passed in registers depending on the number of
++             registers required. */
++          return (ty->size + 7) / 8 < N_X_ARG_REG;
++        }
++      break;
++
++    default:
++      FFI_ASSERT (0);
++      break;
++    }
++
++  return 0;
++}
++
++/* Test if an ffi_type argument or result is a candidate for a vector
++   register.  */
++
++static int
++is_v_register_candidate (ffi_type *ty)
++{
++  return is_floating_type (ty->type)
++         || (ty->type == FFI_TYPE_STRUCT && is_hfa (ty));
++}
++
++/* Representation of the procedure call argument marshalling
++   state.
++
++   The terse state variable names match the names used in the AARCH64
++   PCS. */
++
++struct arg_state
++{
++  unsigned ngrn;                /* Next general-purpose register number. */
++  unsigned nsrn;                /* Next vector register number. */
++  unsigned nsaa;                /* Next stack offset. */
++};
++
++/* Initialize a procedure call argument marshalling state.  */
++static void
++arg_init (struct arg_state *state, unsigned call_frame_size)
++{
++  state->ngrn = 0;
++  state->nsrn = 0;
++  state->nsaa = 0;
++}
++
++/* Return the number of available consecutive core argument
++   registers.  */
++
++static unsigned
++available_x (struct arg_state *state)
++{
++  return N_X_ARG_REG - state->ngrn;
++}
++
++/* Return the number of available consecutive vector argument
++   registers.  */
++
++static unsigned
++available_v (struct arg_state *state)
++{
++  return N_V_ARG_REG - state->nsrn;
++}
++
++static void *
++allocate_to_x (struct call_context *context, struct arg_state *state)
++{
++  FFI_ASSERT (state->ngrn < N_X_ARG_REG)
++  return get_x_addr (context, (state->ngrn)++);
++}
++
++static void *
++allocate_to_s (struct call_context *context, struct arg_state *state)
++{
++  FFI_ASSERT (state->nsrn < N_V_ARG_REG)
++  return get_s_addr (context, (state->nsrn)++);
++}
++
++static void *
++allocate_to_d (struct call_context *context, struct arg_state *state)
++{
++  FFI_ASSERT (state->nsrn < N_V_ARG_REG)
++  return get_d_addr (context, (state->nsrn)++);
++}
++
++static void *
++allocate_to_v (struct call_context *context, struct arg_state *state)
++{
++  FFI_ASSERT (state->nsrn < N_V_ARG_REG)
++  return get_v_addr (context, (state->nsrn)++);
++}
++
++/* Allocate an aligned slot on the stack and return a pointer to it.  */
++static void *
++allocate_to_stack (struct arg_state *state, void *stack, unsigned alignment,
++                 unsigned size)
++{
++  void *allocation;
++
++  /* Round up the NSAA to the larger of 8 or the natural
++     alignment of the argument's type.  */
++  state->nsaa = ALIGN (state->nsaa, alignment);
++  state->nsaa = ALIGN (state->nsaa, alignment);
++  state->nsaa = ALIGN (state->nsaa, 8);
++
++  allocation = stack + state->nsaa;
++
++  state->nsaa += size;
++  return allocation;
++}
++
++static void
++copy_basic_type (void *dest, void *source, unsigned short type)
++{
++  /* This is neccessary to ensure that basic types are copied
++     sign extended to 64-bits as libffi expects.  */
++  switch (type)
++    {
++    case FFI_TYPE_FLOAT:
++      *(float *) dest = *(float *) source;
++      break;
++    case FFI_TYPE_DOUBLE:
++      *(double *) dest = *(double *) source;
++      break;
++    case FFI_TYPE_LONGDOUBLE:
++      *(long double *) dest = *(long double *) source;
++      break;
++    case FFI_TYPE_UINT8:
++      *(ffi_arg *) dest = *(UINT8 *) source;
++      break;
++    case FFI_TYPE_SINT8:
++      *(ffi_sarg *) dest = *(SINT8 *) source;
++      break;
++    case FFI_TYPE_UINT16:
++      *(ffi_arg *) dest = *(UINT16 *) source;
++      break;
++    case FFI_TYPE_SINT16:
++      *(ffi_sarg *) dest = *(SINT16 *) source;
++      break;
++    case FFI_TYPE_UINT32:
++      *(ffi_arg *) dest = *(UINT32 *) source;
++      break;
++    case FFI_TYPE_INT:
++    case FFI_TYPE_SINT32:
++      *(ffi_sarg *) dest = *(SINT32 *) source;
++      break;
++    case FFI_TYPE_POINTER:
++    case FFI_TYPE_UINT64:
++      *(ffi_arg *) dest = *(UINT64 *) source;
++      break;
++    case FFI_TYPE_SINT64:
++      *(ffi_sarg *) dest = *(SINT64 *) source;
++      break;
++
++    default:
++      FFI_ASSERT (0);
++    }
++}
++
++static void
++copy_hfa_to_reg_or_stack (void *memory,
++                        ffi_type *ty,
++                        struct call_context *context,
++                        unsigned char *stack,
++                        struct arg_state *state)
++{
++  unsigned elems = element_count (ty);
++  if (available_v (state) < elems)
++    {
++      /* There are insufficient V registers. Further V register allocations
++       are prevented, the NSAA is adjusted (by allocate_to_stack ())
++       and the argument is copied to memory at the adjusted NSAA.  */
++      state->nsrn = N_V_ARG_REG;
++      memcpy (allocate_to_stack (state, stack, ty->alignment, ty->size),
++            memory,
++            ty->size);
++    }
++  else
++    {
++      int i;
++      unsigned short type = get_homogeneous_type (ty);
++      unsigned elems = element_count (ty);
++      for (i = 0; i < elems; i++)
++      {
++        void *reg = allocate_to_v (context, state);
++        copy_basic_type (reg, memory, type);
++        memory += get_basic_type_size (type);
++      }
++    }
++}
++
++/* Either allocate an appropriate register for the argument type, or if
++   none are available, allocate a stack slot and return a pointer
++   to the allocated space.  */
++
++static void *
++allocate_to_register_or_stack (struct call_context *context,
++                             unsigned char *stack,
++                             struct arg_state *state,
++                             unsigned short type)
++{
++  size_t alignment = get_basic_type_alignment (type);
++  size_t size = alignment;
++  switch (type)
++    {
++    case FFI_TYPE_FLOAT:
++      /* This is the only case for which the allocated stack size
++       should not match the alignment of the type.  */
++      size = sizeof (UINT32);
++      /* Fall through.  */
++    case FFI_TYPE_DOUBLE:
++      if (state->nsrn < N_V_ARG_REG)
++      return allocate_to_d (context, state);
++      state->nsrn = N_V_ARG_REG;
++      break;
++    case FFI_TYPE_LONGDOUBLE:
++      if (state->nsrn < N_V_ARG_REG)
++      return allocate_to_v (context, state);
++      state->nsrn = N_V_ARG_REG;
++      break;
++    case FFI_TYPE_UINT8:
++    case FFI_TYPE_SINT8:
++    case FFI_TYPE_UINT16:
++    case FFI_TYPE_SINT16:
++    case FFI_TYPE_UINT32:
++    case FFI_TYPE_SINT32:
++    case FFI_TYPE_INT:
++    case FFI_TYPE_POINTER:
++    case FFI_TYPE_UINT64:
++    case FFI_TYPE_SINT64:
++      if (state->ngrn < N_X_ARG_REG)
++      return allocate_to_x (context, state);
++      state->ngrn = N_X_ARG_REG;
++      break;
++    default:
++      FFI_ASSERT (0);
++    }
++
++    return allocate_to_stack (state, stack, alignment, size);
++}
++
++/* Copy a value to an appropriate register, or if none are
++   available, to the stack.  */
++
++static void
++copy_to_register_or_stack (struct call_context *context,
++                         unsigned char *stack,
++                         struct arg_state *state,
++                         void *value,
++                         unsigned short type)
++{
++  copy_basic_type (
++        allocate_to_register_or_stack (context, stack, state, type),
++        value,
++        type);
++}
++
++/* Marshall the arguments from FFI representation to procedure call
++   context and stack.  */
++
++static unsigned
++aarch64_prep_args (struct call_context *context, unsigned char *stack,
++                 extended_cif *ecif)
++{
++  int i;
++  struct arg_state state;
++
++  arg_init (&state, ALIGN(ecif->cif->bytes, 16));
++
++  for (i = 0; i < ecif->cif->nargs; i++)
++    {
++      ffi_type *ty = ecif->cif->arg_types[i];
++      switch (ty->type)
++      {
++      case FFI_TYPE_VOID:
++        FFI_ASSERT (0);
++        break;
++
++      /* If the argument is a basic type the argument is allocated to an
++         appropriate register, or if none are available, to the stack.  */
++      case FFI_TYPE_FLOAT:
++      case FFI_TYPE_DOUBLE:
++      case FFI_TYPE_LONGDOUBLE:
++      case FFI_TYPE_UINT8:
++      case FFI_TYPE_SINT8:
++      case FFI_TYPE_UINT16:
++      case FFI_TYPE_SINT16:
++      case FFI_TYPE_UINT32:
++      case FFI_TYPE_INT:
++      case FFI_TYPE_SINT32:
++      case FFI_TYPE_POINTER:
++      case FFI_TYPE_UINT64:
++      case FFI_TYPE_SINT64:
++        copy_to_register_or_stack (context, stack, &state,
++                                   ecif->avalue[i], ty->type);
++        break;
++
++      case FFI_TYPE_STRUCT:
++        if (is_hfa (ty))
++          {
++            copy_hfa_to_reg_or_stack (ecif->avalue[i], ty, context,
++                                      stack, &state);
++          }
++        else if (ty->size > 16)
++          {
++            /* If the argument is a composite type that is larger than 16
++               bytes, then the argument has been copied to memory, and
++               the argument is replaced by a pointer to the copy.  */
++
++            copy_to_register_or_stack (context, stack, &state,
++                                       &(ecif->avalue[i]), FFI_TYPE_POINTER);
++          }
++        else if (available_x (&state) >= (ty->size + 7) / 8)
++          {
++            /* If the argument is a composite type and the size in
++               double-words is not more than the number of available
++               X registers, then the argument is copied into consecutive
++               X registers.  */
++            int j;
++            for (j = 0; j < (ty->size + 7) / 8; j++)
++              {
++                memcpy (allocate_to_x (context, &state),
++                        &(((UINT64 *) ecif->avalue[i])[j]),
++                        sizeof (UINT64));
++              }
++          }
++        else
++          {
++            /* Otherwise, there are insufficient X registers. Further X
++               register allocations are prevented, the NSAA is adjusted
++               (by allocate_to_stack ()) and the argument is copied to
++               memory at the adjusted NSAA.  */
++            state.ngrn = N_X_ARG_REG;
++
++            memcpy (allocate_to_stack (&state, stack, ty->alignment,
++                                       ty->size), ecif->avalue + i, ty->size);
++          }
++        break;
++
++      default:
++        FFI_ASSERT (0);
++        break;
++      }
++    }
++
++  return ecif->cif->aarch64_flags;
++}
++
++ffi_status
++ffi_prep_cif_machdep (ffi_cif *cif)
++{
++  /* Round the stack up to a multiple of the stack alignment requirement. */
++  cif->bytes =
++    (cif->bytes + (AARCH64_STACK_ALIGN - 1)) & ~ (AARCH64_STACK_ALIGN - 1);
++
++  /* Initialize our flags. We are interested if this CIF will touch a
++     vector register, if so we will enable context save and load to
++     those registers, otherwise not. This is intended to be friendly
++     to lazy float context switching in the kernel.  */
++  cif->aarch64_flags = 0;
++
++  if (is_v_register_candidate (cif->rtype))
++    {
++      cif->aarch64_flags |= AARCH64_FFI_WITH_V;
++    }
++  else
++    {
++      int i;
++      for (i = 0; i < cif->nargs; i++)
++        if (is_v_register_candidate (cif->arg_types[i]))
++          {
++            cif->aarch64_flags |= AARCH64_FFI_WITH_V;
++            break;
++          }
++    }
++
++  return FFI_OK;
++}
++
++/* Call a function with the provided arguments and capture the return
++   value.  */
++void
++ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
++{
++  extended_cif ecif;
++
++  ecif.cif = cif;
++  ecif.avalue = avalue;
++  ecif.rvalue = rvalue;
++
++  switch (cif->abi)
++    {
++    case FFI_SYSV:
++      {
++        struct call_context context;
++      unsigned stack_bytes;
++
++      /* Figure out the total amount of stack space we need, the
++         above call frame space needs to be 16 bytes aligned to
++         ensure correct alignment of the first object inserted in
++         that space hence the ALIGN applied to cif->bytes.*/
++      stack_bytes = ALIGN(cif->bytes, 16);
++
++      memset (&context, 0, sizeof (context));
++        if (is_register_candidate (cif->rtype))
++          {
++            ffi_call_SYSV (aarch64_prep_args, &context, &ecif, stack_bytes, fn);
++            switch (cif->rtype->type)
++              {
++              case FFI_TYPE_VOID:
++              case FFI_TYPE_FLOAT:
++              case FFI_TYPE_DOUBLE:
++              case FFI_TYPE_LONGDOUBLE:
++              case FFI_TYPE_UINT8:
++              case FFI_TYPE_SINT8:
++              case FFI_TYPE_UINT16:
++              case FFI_TYPE_SINT16:
++              case FFI_TYPE_UINT32:
++              case FFI_TYPE_SINT32:
++              case FFI_TYPE_POINTER:
++              case FFI_TYPE_UINT64:
++              case FFI_TYPE_INT:
++              case FFI_TYPE_SINT64:
++              {
++                void *addr = get_basic_type_addr (cif->rtype->type,
++                                                  &context, 0);
++                copy_basic_type (rvalue, addr, cif->rtype->type);
++                break;
++              }
++
++              case FFI_TYPE_STRUCT:
++                if (is_hfa (cif->rtype))
++                {
++                  int j;
++                  unsigned short type = get_homogeneous_type (cif->rtype);
++                  unsigned elems = element_count (cif->rtype);
++                  for (j = 0; j < elems; j++)
++                    {
++                      void *reg = get_basic_type_addr (type, &context, j);
++                      copy_basic_type (rvalue, reg, type);
++                      rvalue += get_basic_type_size (type);
++                    }
++                }
++                else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG)
++                  {
++                    unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64));
++                    memcpy (rvalue, get_x_addr (&context, 0), size);
++                  }
++                else
++                  {
++                    FFI_ASSERT (0);
++                  }
++                break;
++
++              default:
++                FFI_ASSERT (0);
++                break;
++              }
++          }
++        else
++          {
++            memcpy (get_x_addr (&context, 8), &rvalue, sizeof (UINT64));
++            ffi_call_SYSV (aarch64_prep_args, &context, &ecif,
++                         stack_bytes, fn);
++          }
++        break;
++      }
++
++    default:
++      FFI_ASSERT (0);
++      break;
++    }
++}
++
++static unsigned char trampoline [] =
++{ 0x70, 0x00, 0x00, 0x58,     /* ldr  x16, 1f */
++  0x91, 0x00, 0x00, 0x10,     /* adr  x17, 2f */
++  0x00, 0x02, 0x1f, 0xd6      /* br   x16     */
++};
++
++/* Build a trampoline.  */
++
++#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX,FLAGS)                      \
++  ({unsigned char *__tramp = (unsigned char*)(TRAMP);                 \
++    UINT64  __fun = (UINT64)(FUN);                                    \
++    UINT64  __ctx = (UINT64)(CTX);                                    \
++    UINT64  __flags = (UINT64)(FLAGS);                                        \
++    memcpy (__tramp, trampoline, sizeof (trampoline));                        \
++    memcpy (__tramp + 12, &__fun, sizeof (__fun));                    \
++    memcpy (__tramp + 20, &__ctx, sizeof (__ctx));                    \
++    memcpy (__tramp + 28, &__flags, sizeof (__flags));                        \
++    __clear_cache(__tramp, __tramp + FFI_TRAMPOLINE_SIZE);            \
++  })
++
++ffi_status
++ffi_prep_closure_loc (ffi_closure* closure,
++                      ffi_cif* cif,
++                      void (*fun)(ffi_cif*,void*,void**,void*),
++                      void *user_data,
++                      void *codeloc)
++{
++  if (cif->abi != FFI_SYSV)
++    return FFI_BAD_ABI;
++
++  FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV, codeloc,
++                     cif->aarch64_flags);
++
++  closure->cif  = cif;
++  closure->user_data = user_data;
++  closure->fun  = fun;
++
++  return FFI_OK;
++}
++
++/* Primary handler to setup and invoke a function within a closure.
++
++   A closure when invoked enters via the assembler wrapper
++   ffi_closure_SYSV(). The wrapper allocates a call context on the
++   stack, saves the interesting registers (from the perspective of
++   the calling convention) into the context then passes control to
++   ffi_closure_SYSV_inner() passing the saved context and a pointer to
++   the stack at the point ffi_closure_SYSV() was invoked.
++
++   On the return path the assembler wrapper will reload call context
++   regsiters.
++
++   ffi_closure_SYSV_inner() marshalls the call context into ffi value
++   desriptors, invokes the wrapped function, then marshalls the return
++   value back into the call context.  */
++
++void
++ffi_closure_SYSV_inner (ffi_closure *closure, struct call_context *context,
++                      void *stack)
++{
++  ffi_cif *cif = closure->cif;
++  void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
++  void *rvalue = NULL;
++  int i;
++  struct arg_state state;
++
++  arg_init (&state, ALIGN(cif->bytes, 16));
++
++  for (i = 0; i < cif->nargs; i++)
++    {
++      ffi_type *ty = cif->arg_types[i];
++
++      switch (ty->type)
++      {
++      case FFI_TYPE_VOID:
++        FFI_ASSERT (0);
++        break;
++
++      case FFI_TYPE_UINT8:
++      case FFI_TYPE_SINT8:
++      case FFI_TYPE_UINT16:
++      case FFI_TYPE_SINT16:
++      case FFI_TYPE_UINT32:
++      case FFI_TYPE_SINT32:
++      case FFI_TYPE_INT:
++      case FFI_TYPE_POINTER:
++      case FFI_TYPE_UINT64:
++      case FFI_TYPE_SINT64:
++      case  FFI_TYPE_FLOAT:
++      case  FFI_TYPE_DOUBLE:
++      case  FFI_TYPE_LONGDOUBLE:
++        avalue[i] = allocate_to_register_or_stack (context, stack,
++                                                   &state, ty->type);
++        break;
++
++      case FFI_TYPE_STRUCT:
++        if (is_hfa (ty))
++          {
++            unsigned n = element_count (ty);
++            if (available_v (&state) < n)
++              {
++                state.nsrn = N_V_ARG_REG;
++                avalue[i] = allocate_to_stack (&state, stack, ty->alignment,
++                                               ty->size);
++              }
++            else
++              {
++                switch (get_homogeneous_type (ty))
++                  {
++                  case FFI_TYPE_FLOAT:
++                    {
++                      /* Eeek! We need a pointer to the structure,
++                         however the homogeneous float elements are
++                         being passed in individual S registers,
++                         therefore the structure is not represented as
++                         a contiguous sequence of bytes in our saved
++                         register context. We need to fake up a copy
++                         of the structure layed out in memory
++                         correctly. The fake can be tossed once the
++                         closure function has returned hence alloca()
++                         is sufficient. */
++                      int j;
++                      UINT32 *p = avalue[i] = alloca (ty->size);
++                      for (j = 0; j < element_count (ty); j++)
++                        memcpy (&p[j],
++                                allocate_to_s (context, &state),
++                                sizeof (*p));
++                      break;
++                    }
++
++                  case FFI_TYPE_DOUBLE:
++                    {
++                      /* Eeek! We need a pointer to the structure,
++                         however the homogeneous float elements are
++                         being passed in individual S registers,
++                         therefore the structure is not represented as
++                         a contiguous sequence of bytes in our saved
++                         register context. We need to fake up a copy
++                         of the structure layed out in memory
++                         correctly. The fake can be tossed once the
++                         closure function has returned hence alloca()
++                         is sufficient. */
++                      int j;
++                      UINT64 *p = avalue[i] = alloca (ty->size);
++                      for (j = 0; j < element_count (ty); j++)
++                        memcpy (&p[j],
++                                allocate_to_d (context, &state),
++                                sizeof (*p));
++                      break;
++                    }
++
++                  case FFI_TYPE_LONGDOUBLE:
++                        memcpy (&avalue[i],
++                                allocate_to_v (context, &state),
++                                sizeof (*avalue));
++                    break;
++
++                  default:
++                    FFI_ASSERT (0);
++                    break;
++                  }
++              }
++          }
++        else if (ty->size > 16)
++          {
++            /* Replace Composite type of size greater than 16 with a
++               pointer.  */
++            memcpy (&avalue[i],
++                    allocate_to_register_or_stack (context, stack,
++                                                   &state, FFI_TYPE_POINTER),
++                    sizeof (avalue[i]));
++          }
++        else if (available_x (&state) >= (ty->size + 7) / 8)
++          {
++            avalue[i] = get_x_addr (context, state.ngrn);
++            state.ngrn += (ty->size + 7) / 8;
++          }
++        else
++          {
++            state.ngrn = N_X_ARG_REG;
++
++            avalue[i] = allocate_to_stack (&state, stack, ty->alignment,
++                                           ty->size);
++          }
++        break;
++
++      default:
++        FFI_ASSERT (0);
++        break;
++      }
++    }
++
++  /* Figure out where the return value will be passed, either in
++     registers or in a memory block allocated by the caller and passed
++     in x8.  */
++
++  if (is_register_candidate (cif->rtype))
++    {
++      /* Register candidates are *always* returned in registers. */
++
++      /* Allocate a scratchpad for the return value, we will let the
++         callee scrible the result into the scratch pad then move the
++         contents into the appropriate return value location for the
++         call convention.  */
++      rvalue = alloca (cif->rtype->size);
++      (closure->fun) (cif, rvalue, avalue, closure->user_data);
++
++      /* Copy the return value into the call context so that it is returned
++         as expected to our caller.  */
++      switch (cif->rtype->type)
++        {
++        case FFI_TYPE_VOID:
++          break;
++
++        case FFI_TYPE_UINT8:
++        case FFI_TYPE_UINT16:
++        case FFI_TYPE_UINT32:
++        case FFI_TYPE_POINTER:
++        case FFI_TYPE_UINT64:
++        case FFI_TYPE_SINT8:
++        case FFI_TYPE_SINT16:
++        case FFI_TYPE_INT:
++        case FFI_TYPE_SINT32:
++        case FFI_TYPE_SINT64:
++        case FFI_TYPE_FLOAT:
++        case FFI_TYPE_DOUBLE:
++        case FFI_TYPE_LONGDOUBLE:
++        {
++          void *addr = get_basic_type_addr (cif->rtype->type, context, 0);
++          copy_basic_type (addr, rvalue, cif->rtype->type);
++            break;
++        }
++        case FFI_TYPE_STRUCT:
++          if (is_hfa (cif->rtype))
++          {
++            int i;
++            unsigned short type = get_homogeneous_type (cif->rtype);
++            unsigned elems = element_count (cif->rtype);
++            for (i = 0; i < elems; i++)
++              {
++                void *reg = get_basic_type_addr (type, context, i);
++                copy_basic_type (reg, rvalue, type);
++                rvalue += get_basic_type_size (type);
++              }
++          }
++          else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG)
++            {
++              unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)) ;
++              memcpy (get_x_addr (context, 0), rvalue, size);
++            }
++          else
++            {
++              FFI_ASSERT (0);
++            }
++          break;
++        default:
++          FFI_ASSERT (0);
++          break;
++        }
++    }
++  else
++    {
++      memcpy (&rvalue, get_x_addr (context, 8), sizeof (UINT64));
++      (closure->fun) (cif, rvalue, avalue, closure->user_data);
++    }
++}
++
+Index: libffi/src/aarch64/ffitarget.h
+===================================================================
+--- /dev/null
++++ libffi/src/aarch64/ffitarget.h
+@@ -0,0 +1,59 @@
++/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
++
++Permission is hereby granted, free of charge, to any person obtaining
++a copy of this software and associated documentation files (the
++``Software''), to deal in the Software without restriction, including
++without limitation the rights to use, copy, modify, merge, publish,
++distribute, sublicense, and/or sell copies of the Software, and to
++permit persons to whom the Software is furnished to do so, subject to
++the following conditions:
++
++The above copyright notice and this permission notice shall be
++included in all copies or substantial portions of the Software.
++
++THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
++EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
++CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
++TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
++SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
++
++#ifndef LIBFFI_TARGET_H
++#define LIBFFI_TARGET_H
++
++#ifndef LIBFFI_H
++#error "Please do not include ffitarget.h directly into your source.  Use ffi.h instead."
++#endif
++
++#ifndef LIBFFI_ASM
++typedef unsigned long ffi_arg;
++typedef signed long ffi_sarg;
++
++typedef enum ffi_abi
++  {
++    FFI_FIRST_ABI = 0,
++    FFI_SYSV,
++    FFI_LAST_ABI,
++    FFI_DEFAULT_ABI = FFI_SYSV
++  } ffi_abi;
++#endif
++
++/* ---- Definitions for closures ----------------------------------------- */
++
++#define FFI_CLOSURES 1
++#define FFI_TRAMPOLINE_SIZE 36
++#define FFI_NATIVE_RAW_API 0
++
++/* ---- Internal ---- */
++
++
++#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_flags
++
++#define AARCH64_FFI_WITH_V_BIT 0
++
++#define AARCH64_N_XREG 32
++#define AARCH64_N_VREG 32
++#define AARCH64_CALL_CONTEXT_SIZE (AARCH64_N_XREG * 8 + AARCH64_N_VREG * 16)
++
++#endif
+Index: libffi/src/aarch64/sysv.S
+===================================================================
+--- /dev/null
++++ libffi/src/aarch64/sysv.S
+@@ -0,0 +1,307 @@
++/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
++
++Permission is hereby granted, free of charge, to any person obtaining
++a copy of this software and associated documentation files (the
++``Software''), to deal in the Software without restriction, including
++without limitation the rights to use, copy, modify, merge, publish,
++distribute, sublicense, and/or sell copies of the Software, and to
++permit persons to whom the Software is furnished to do so, subject to
++the following conditions:
++
++The above copyright notice and this permission notice shall be
++included in all copies or substantial portions of the Software.
++
++THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
++EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
++IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
++CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
++TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
++SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
++
++#define LIBFFI_ASM
++#include <fficonfig.h>
++#include <ffi.h>
++
++#define cfi_adjust_cfa_offset(off)    .cfi_adjust_cfa_offset off
++#define cfi_rel_offset(reg, off)      .cfi_rel_offset reg, off
++#define cfi_restore(reg)              .cfi_restore reg
++#define cfi_def_cfa_register(reg)     .cfi_def_cfa_register reg
++
++        .text
++        .globl ffi_call_SYSV
++        .type ffi_call_SYSV, #function
++
++/* ffi_call_SYSV()
++
++   Create a stack frame, setup an argument context, call the callee
++   and extract the result.
++
++   The maximum required argument stack size is provided,
++   ffi_call_SYSV() allocates that stack space then calls the
++   prepare_fn to populate register context and stack.  The
++   argument passing registers are loaded from the register
++   context and the callee called, on return the register passing
++   register are saved back to the context.  Our caller will
++   extract the return value from the final state of the saved
++   register context.
++
++   Prototype:
++
++   extern unsigned
++   ffi_call_SYSV (void (*)(struct call_context *context, unsigned char *,
++                         extended_cif *),
++                  struct call_context *context,
++                  extended_cif *,
++                  unsigned required_stack_size,
++                  void (*fn)(void));
++
++   Therefore on entry we have:
++
++   x0 prepare_fn
++   x1 &context
++   x2 &ecif
++   x3 bytes
++   x4 fn
++
++   This function uses the following stack frame layout:
++
++   ==
++                saved x30(lr)
++   x29(fp)->    saved x29(fp)
++                saved x24
++                saved x23
++                saved x22
++   sp'    ->    saved x21
++                ...
++   sp     ->    (constructed callee stack arguments)
++   ==
++
++   Voila! */
++
++#define ffi_call_SYSV_FS (8 * 4)
++
++        .cfi_startproc
++ffi_call_SYSV:
++        stp     x29, x30, [sp, #-16]!
++      cfi_adjust_cfa_offset (16)
++        cfi_rel_offset (x29, 0)
++        cfi_rel_offset (x30, 8)
++
++        mov     x29, sp
++      cfi_def_cfa_register (x29)
++        sub     sp, sp, #ffi_call_SYSV_FS
++
++        stp     x21, x22, [sp, 0]
++        cfi_rel_offset (x21, 0 - ffi_call_SYSV_FS)
++        cfi_rel_offset (x22, 8 - ffi_call_SYSV_FS)
++
++        stp     x23, x24, [sp, 16]
++        cfi_rel_offset (x23, 16 - ffi_call_SYSV_FS)
++        cfi_rel_offset (x24, 24 - ffi_call_SYSV_FS)
++
++        mov     x21, x1
++        mov     x22, x2
++        mov     x24, x4
++
++        /* Allocate the stack space for the actual arguments, many
++           arguments will be passed in registers, but we assume
++           worst case and allocate sufficient stack for ALL of
++           the arguments.  */
++        sub     sp, sp, x3
++
++        /* unsigned (*prepare_fn) (struct call_context *context,
++                                 unsigned char *stack, extended_cif *ecif);
++       */
++        mov     x23, x0
++        mov     x0, x1
++        mov     x1, sp
++        /* x2 already in place */
++        blr     x23
++
++        /* Preserve the flags returned.  */
++        mov     x23, x0
++
++        /* Figure out if we should touch the vector registers.  */
++        tbz     x23, #AARCH64_FFI_WITH_V_BIT, 1f
++
++        /* Load the vector argument passing registers.  */
++        ldp     q0, q1, [x21, #8*32 +  0]
++        ldp     q2, q3, [x21, #8*32 + 32]
++        ldp     q4, q5, [x21, #8*32 + 64]
++        ldp     q6, q7, [x21, #8*32 + 96]
++1:
++        /* Load the core argument passing registers.  */
++        ldp     x0, x1, [x21,  #0]
++        ldp     x2, x3, [x21, #16]
++        ldp     x4, x5, [x21, #32]
++        ldp     x6, x7, [x21, #48]
++
++        /* Don't forget x8 which may be holding the address of a return buffer.
++       */
++        ldr     x8,     [x21, #8*8]
++
++        blr     x24
++
++        /* Save the core argument passing registers.  */
++        stp     x0, x1, [x21,  #0]
++        stp     x2, x3, [x21, #16]
++        stp     x4, x5, [x21, #32]
++        stp     x6, x7, [x21, #48]
++
++        /* Note nothing useful ever comes back in x8!  */
++
++        /* Figure out if we should touch the vector registers.  */
++        tbz     x23, #AARCH64_FFI_WITH_V_BIT, 1f
++
++        /* Save the vector argument passing registers.  */
++        stp     q0, q1, [x21, #8*32 + 0]
++        stp     q2, q3, [x21, #8*32 + 32]
++        stp     q4, q5, [x21, #8*32 + 64]
++        stp     q6, q7, [x21, #8*32 + 96]
++1:
++        /* All done, unwind our stack frame.  */
++        ldp     x21, x22, [x29,  # - ffi_call_SYSV_FS]
++        cfi_restore (x21)
++        cfi_restore (x22)
++
++        ldp     x23, x24, [x29,  # - ffi_call_SYSV_FS + 16]
++        cfi_restore (x23)
++        cfi_restore (x24)
++
++        mov     sp, x29
++      cfi_def_cfa_register (sp)
++
++        ldp     x29, x30, [sp], #16
++      cfi_adjust_cfa_offset (-16)
++        cfi_restore (x29)
++        cfi_restore (x30)
++
++        ret
++
++        .cfi_endproc
++        .size ffi_call_SYSV, .-ffi_call_SYSV
++
++#define ffi_closure_SYSV_FS (8 * 2 + AARCH64_CALL_CONTEXT_SIZE)
++
++/* ffi_closure_SYSV
++
++   Closure invocation glue. This is the low level code invoked directly by
++   the closure trampoline to setup and call a closure.
++
++   On entry x17 points to a struct trampoline_data, x16 has been clobbered
++   all other registers are preserved.
++
++   We allocate a call context and save the argument passing registers,
++   then invoked the generic C ffi_closure_SYSV_inner() function to do all
++   the real work, on return we load the result passing registers back from
++   the call context.
++
++   On entry
++
++   extern void
++   ffi_closure_SYSV (struct trampoline_data *);
++
++   struct trampoline_data
++   {
++        UINT64 *ffi_closure;
++        UINT64 flags;
++   };
++
++   This function uses the following stack frame layout:
++
++   ==
++                saved x30(lr)
++   x29(fp)->    saved x29(fp)
++                saved x22
++                saved x21
++                ...
++   sp     ->    call_context
++   ==
++
++   Voila!  */
++
++        .text
++        .globl ffi_closure_SYSV
++        .cfi_startproc
++ffi_closure_SYSV:
++        stp     x29, x30, [sp, #-16]!
++      cfi_adjust_cfa_offset (16)
++        cfi_rel_offset (x29, 0)
++        cfi_rel_offset (x30, 8)
++
++        mov     x29, sp
++
++        sub     sp, sp, #ffi_closure_SYSV_FS
++      cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
++
++        stp     x21, x22, [x29, #-16]
++        cfi_rel_offset (x21, 0)
++        cfi_rel_offset (x22, 8)
++
++        /* Load x21 with &call_context.  */
++        mov     x21, sp
++        /* Preserve our struct trampoline_data *  */
++        mov     x22, x17
++
++        /* Save the rest of the argument passing registers.  */
++        stp     x0, x1, [x21, #0]
++        stp     x2, x3, [x21, #16]
++        stp     x4, x5, [x21, #32]
++        stp     x6, x7, [x21, #48]
++        /* Don't forget we may have been given a result scratch pad address.
++       */
++        str     x8,     [x21, #64]
++
++        /* Figure out if we should touch the vector registers.  */
++        ldr     x0, [x22, #8]
++        tbz     x0, #AARCH64_FFI_WITH_V_BIT, 1f
++
++        /* Save the argument passing vector registers.  */
++        stp     q0, q1, [x21, #8*32 + 0]
++        stp     q2, q3, [x21, #8*32 + 32]
++        stp     q4, q5, [x21, #8*32 + 64]
++        stp     q6, q7, [x21, #8*32 + 96]
++1:
++        /* Load &ffi_closure..  */
++        ldr     x0, [x22, #0]
++        mov     x1, x21
++        /* Compute the location of the stack at the point that the
++           trampoline was called.  */
++        add     x2, x29, #16
++
++        bl      ffi_closure_SYSV_inner
++
++        /* Figure out if we should touch the vector registers.  */
++        ldr     x0, [x22, #8]
++        tbz     x0, #AARCH64_FFI_WITH_V_BIT, 1f
++
++        /* Load the result passing vector registers.  */
++        ldp     q0, q1, [x21, #8*32 + 0]
++        ldp     q2, q3, [x21, #8*32 + 32]
++        ldp     q4, q5, [x21, #8*32 + 64]
++        ldp     q6, q7, [x21, #8*32 + 96]
++1:
++        /* Load the result passing core registers.  */
++        ldp     x0, x1, [x21,  #0]
++        ldp     x2, x3, [x21, #16]
++        ldp     x4, x5, [x21, #32]
++        ldp     x6, x7, [x21, #48]
++        /* Note nothing usefull is returned in x8.  */
++
++        /* We are done, unwind our frame.  */
++        ldp     x21, x22, [x29,  #-16]
++        cfi_restore (x21)
++        cfi_restore (x22)
++
++        mov     sp, x29
++      cfi_adjust_cfa_offset (-ffi_closure_SYSV_FS)
++
++        ldp     x29, x30, [sp], #16
++      cfi_adjust_cfa_offset (-16)
++        cfi_restore (x29)
++        cfi_restore (x30)
++
++        ret
++        .cfi_endproc
++        .size ffi_closure_SYSV, .-ffi_closure_SYSV
+Index: libffi/testsuite/lib/libffi.exp
+===================================================================
+--- libffi.orig/testsuite/lib/libffi.exp
++++ libffi/testsuite/lib/libffi.exp
+@@ -203,6 +203,10 @@ proc libffi_target_compile { source dest
+     lappend options "libs= -lffi"
++    if { [string match "aarch64*-*-linux*" $target_triplet] } {
++      lappend options "libs= -lpthread"
++    }
++
+     verbose "options: $options"
+     return [target_compile $source $dest $type $options]
+ }
+Index: libffi/testsuite/libffi.call/cls_struct_va1.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/cls_struct_va1.c
+@@ -0,0 +1,114 @@
++/* Area:              ffi_call, closure_call
++   Purpose:           Test doubles passed in variable argument lists.
++   Limitations:       none.
++   PR:                        none.
++   Originator:        Blake Chaffin 6/6/2007   */
++
++/* { dg-do run } */
++/* { dg-output "" { xfail avr32*-*-* } } */
++#include "ffitest.h"
++
++struct small_tag
++{
++  unsigned char a;
++  unsigned char b;
++};
++
++struct large_tag
++{
++  unsigned a;
++  unsigned b;
++  unsigned c;
++  unsigned d;
++  unsigned e;
++};
++
++static void
++test_fn (ffi_cif* cif __UNUSED__, void* resp,
++       void** args, void* userdata __UNUSED__)
++{
++  int n = *(int*)args[0];
++  struct small_tag s1 = * (struct small_tag *) args[1];
++  struct large_tag l1 = * (struct large_tag *) args[2];
++  struct small_tag s2 = * (struct small_tag *) args[3];
++
++  printf ("%d %d %d %d %d %d %d %d %d %d\n", n, s1.a, s1.b,
++        l1.a, l1.b, l1.c, l1.d, l1.e,
++        s2.a, s2.b);
++  * (int*) resp = 42;
++}
++
++int
++main (void)
++{
++  ffi_cif cif;
++  void *code;
++  ffi_closure *pcl = ffi_closure_alloc (sizeof (ffi_closure), &code);
++  ffi_type* arg_types[5];
++
++  ffi_arg res = 0;
++
++  ffi_type s_type;
++  ffi_type *s_type_elements[3];
++
++  ffi_type l_type;
++  ffi_type *l_type_elements[6];
++
++  struct small_tag s1;
++  struct small_tag s2;
++  struct large_tag l1;
++
++  int si;
++
++  s_type.size = 0;
++  s_type.alignment = 0;
++  s_type.type = FFI_TYPE_STRUCT;
++  s_type.elements = s_type_elements;
++
++  s_type_elements[0] = &ffi_type_uchar;
++  s_type_elements[1] = &ffi_type_uchar;
++  s_type_elements[2] = NULL;
++
++  l_type.size = 0;
++  l_type.alignment = 0;
++  l_type.type = FFI_TYPE_STRUCT;
++  l_type.elements = l_type_elements;
++
++  l_type_elements[0] = &ffi_type_uint;
++  l_type_elements[1] = &ffi_type_uint;
++  l_type_elements[2] = &ffi_type_uint;
++  l_type_elements[3] = &ffi_type_uint;
++  l_type_elements[4] = &ffi_type_uint;
++  l_type_elements[5] = NULL;
++
++  arg_types[0] = &ffi_type_sint;
++  arg_types[1] = &s_type;
++  arg_types[2] = &l_type;
++  arg_types[3] = &s_type;
++  arg_types[4] = NULL;
++
++  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint,
++                       arg_types) == FFI_OK);
++
++  si = 4;
++  s1.a = 5;
++  s1.b = 6;
++
++  s2.a = 20;
++  s2.b = 21;
++
++  l1.a = 10;
++  l1.b = 11;
++  l1.c = 12;
++  l1.d = 13;
++  l1.e = 14;
++
++  CHECK(ffi_prep_closure_loc(pcl, &cif, test_fn, NULL, code) == FFI_OK);
++
++  res = ((int (*)(int, ...))(code))(si, s1, l1, s2);
++  // { dg-output "4 5 6 10 11 12 13 14 20 21" }
++  printf("res: %d\n", (int) res);
++  // { dg-output "\nres: 42" }
++
++  exit(0);
++}
+Index: libffi/testsuite/libffi.call/cls_uchar_va.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/cls_uchar_va.c
+@@ -0,0 +1,44 @@
++/* Area:      closure_call
++   Purpose:   Test anonymous unsigned char argument.
++   Limitations:       none.
++   PR:                none.
++   Originator:        ARM Ltd. */
++
++/* { dg-do run } */
++#include "ffitest.h"
++
++typedef unsigned char T;
++
++static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
++                       void* userdata __UNUSED__)
++ {
++   *(T *)resp = *(T *)args[0];
++
++   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
++ }
++
++typedef T (*cls_ret_T)(T, ...);
++
++int main (void)
++{
++  ffi_cif cif;
++  void *code;
++  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
++  ffi_type * cl_arg_types[3];
++  T res;
++
++  cl_arg_types[0] = &ffi_type_uchar;
++  cl_arg_types[1] = &ffi_type_uchar;
++  cl_arg_types[2] = NULL;
++
++  /* Initialize the cif */
++  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
++                       &ffi_type_uchar, cl_arg_types) == FFI_OK);
++
++  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code)  == FFI_OK);
++  res = ((((cls_ret_T)code)(67, 4)));
++  /* { dg-output "67: 67 4" } */
++  printf("res: %d\n", res);
++  /* { dg-output "\nres: 67" } */
++  exit(0);
++}
+Index: libffi/testsuite/libffi.call/cls_uint_va.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/cls_uint_va.c
+@@ -0,0 +1,45 @@
++/* Area:      closure_call
++   Purpose:   Test anonymous unsigned int argument.
++   Limitations:       none.
++   PR:                none.
++   Originator:        ARM Ltd. */
++
++/* { dg-do run } */
++
++#include "ffitest.h"
++
++typedef unsigned int T;
++
++static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
++                       void* userdata __UNUSED__)
++ {
++   *(T *)resp = *(T *)args[0];
++
++   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
++ }
++
++typedef T (*cls_ret_T)(T, ...);
++
++int main (void)
++{
++  ffi_cif cif;
++  void *code;
++  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
++  ffi_type * cl_arg_types[3];
++  T res;
++
++  cl_arg_types[0] = &ffi_type_uint;
++  cl_arg_types[1] = &ffi_type_uint;
++  cl_arg_types[2] = NULL;
++
++  /* Initialize the cif */
++  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
++                       &ffi_type_uint, cl_arg_types) == FFI_OK);
++
++  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code)  == FFI_OK);
++  res = ((((cls_ret_T)code)(67, 4)));
++  /* { dg-output "67: 67 4" } */
++  printf("res: %d\n", res);
++  /* { dg-output "\nres: 67" } */
++  exit(0);
++}
+Index: libffi/testsuite/libffi.call/cls_ulong_va.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/cls_ulong_va.c
+@@ -0,0 +1,45 @@
++/* Area:      closure_call
++   Purpose:   Test anonymous unsigned long argument.
++   Limitations:       none.
++   PR:                none.
++   Originator:        ARM Ltd. */
++
++/* { dg-do run } */
++
++#include "ffitest.h"
++
++typedef unsigned long T;
++
++static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
++                       void* userdata __UNUSED__)
++ {
++   *(T *)resp = *(T *)args[0];
++
++   printf("%ld: %ld %ld\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
++ }
++
++typedef T (*cls_ret_T)(T, ...);
++
++int main (void)
++{
++  ffi_cif cif;
++  void *code;
++  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
++  ffi_type * cl_arg_types[3];
++  T res;
++
++  cl_arg_types[0] = &ffi_type_ulong;
++  cl_arg_types[1] = &ffi_type_ulong;
++  cl_arg_types[2] = NULL;
++
++  /* Initialize the cif */
++  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
++                       &ffi_type_ulong, cl_arg_types) == FFI_OK);
++
++  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code)  == FFI_OK);
++  res = ((((cls_ret_T)code)(67, 4)));
++  /* { dg-output "67: 67 4" } */
++  printf("res: %ld\n", res);
++  /* { dg-output "\nres: 67" } */
++  exit(0);
++}
+Index: libffi/testsuite/libffi.call/cls_ushort_va.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/cls_ushort_va.c
+@@ -0,0 +1,44 @@
++/* Area:      closure_call
++   Purpose:   Test anonymous unsigned short argument.
++   Limitations:       none.
++   PR:                none.
++   Originator:        ARM Ltd. */
++
++/* { dg-do run } */
++#include "ffitest.h"
++
++typedef unsigned short T;
++
++static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
++                       void* userdata __UNUSED__)
++ {
++   *(T *)resp = *(T *)args[0];
++
++   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
++ }
++
++typedef T (*cls_ret_T)(T, ...);
++
++int main (void)
++{
++  ffi_cif cif;
++  void *code;
++  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
++  ffi_type * cl_arg_types[3];
++  T res;
++
++  cl_arg_types[0] = &ffi_type_ushort;
++  cl_arg_types[1] = &ffi_type_ushort;
++  cl_arg_types[2] = NULL;
++
++  /* Initialize the cif */
++  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
++                       &ffi_type_ushort, cl_arg_types) == FFI_OK);
++
++  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code)  == FFI_OK);
++  res = ((((cls_ret_T)code)(67, 4)));
++  /* { dg-output "67: 67 4" } */
++  printf("res: %d\n", res);
++  /* { dg-output "\nres: 67" } */
++  exit(0);
++}
+Index: libffi/testsuite/libffi.call/nested_struct11.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/nested_struct11.c
+@@ -0,0 +1,121 @@
++/* Area:      ffi_call, closure_call
++   Purpose:   Check parameter passing with nested structs
++              of a single type.  This tests the special cases
++              for homogenous floating-point aggregates in the
++              AArch64 PCS.
++   Limitations:       none.
++   PR:                none.
++   Originator:  ARM Ltd.  */
++
++/* { dg-do run } */
++#include "ffitest.h"
++
++typedef struct A {
++  float a_x;
++  float a_y;
++} A;
++
++typedef struct B {
++  float b_x;
++  float b_y;
++} B;
++
++typedef struct C {
++  A a;
++  B b;
++} C;
++
++static C C_fn (int x, int y, int z, C source, int i, int j, int k)
++{
++  C result;
++  result.a.a_x = source.a.a_x;
++  result.a.a_y = source.a.a_y;
++  result.b.b_x = source.b.b_x;
++  result.b.b_y = source.b.b_y;
++
++  printf ("%d, %d, %d, %d, %d, %d\n", x, y, z, i, j, k);
++
++  printf ("%.1f, %.1f, %.1f, %.1f, "
++        "%.1f, %.1f, %.1f, %.1f\n",
++        source.a.a_x, source.a.a_y,
++        source.b.b_x, source.b.b_y,
++        result.a.a_x, result.a.a_y,
++        result.b.b_x, result.b.b_y);
++
++  return result;
++}
++
++int main (void)
++{
++  ffi_cif cif;
++
++  ffi_type* struct_fields_source_a[3];
++  ffi_type* struct_fields_source_b[3];
++  ffi_type* struct_fields_source_c[3];
++  ffi_type* arg_types[8];
++
++  ffi_type struct_type_a, struct_type_b, struct_type_c;
++
++  struct A source_fld_a = {1.0, 2.0};
++  struct B source_fld_b = {4.0, 8.0};
++  int k = 1;
++
++  struct C result;
++  struct C source = {source_fld_a, source_fld_b};
++
++  struct_type_a.size = 0;
++  struct_type_a.alignment = 0;
++  struct_type_a.type = FFI_TYPE_STRUCT;
++  struct_type_a.elements = struct_fields_source_a;
++
++  struct_type_b.size = 0;
++  struct_type_b.alignment = 0;
++  struct_type_b.type = FFI_TYPE_STRUCT;
++  struct_type_b.elements = struct_fields_source_b;
++
++  struct_type_c.size = 0;
++  struct_type_c.alignment = 0;
++  struct_type_c.type = FFI_TYPE_STRUCT;
++  struct_type_c.elements = struct_fields_source_c;
++
++  struct_fields_source_a[0] = &ffi_type_float;
++  struct_fields_source_a[1] = &ffi_type_float;
++  struct_fields_source_a[2] = NULL;
++
++  struct_fields_source_b[0] = &ffi_type_float;
++  struct_fields_source_b[1] = &ffi_type_float;
++  struct_fields_source_b[2] = NULL;
++
++  struct_fields_source_c[0] = &struct_type_a;
++  struct_fields_source_c[1] = &struct_type_b;
++  struct_fields_source_c[2] = NULL;
++
++  arg_types[0] = &ffi_type_sint32;
++  arg_types[1] = &ffi_type_sint32;
++  arg_types[2] = &ffi_type_sint32;
++  arg_types[3] = &struct_type_c;
++  arg_types[4] = &ffi_type_sint32;
++  arg_types[5] = &ffi_type_sint32;
++  arg_types[6] = &ffi_type_sint32;
++  arg_types[7] = NULL;
++
++  void *args[7];
++  args[0] = &k;
++  args[1] = &k;
++  args[2] = &k;
++  args[3] = &source;
++  args[4] = &k;
++  args[5] = &k;
++  args[6] = &k;
++  CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 7, &struct_type_c,
++                     arg_types) == FFI_OK);
++
++  ffi_call (&cif, FFI_FN (C_fn), &result, args);
++  /* { dg-output "1, 1, 1, 1, 1, 1\n" } */
++  /* { dg-output "1.0, 2.0, 4.0, 8.0, 1.0, 2.0, 4.0, 8.0" } */
++  CHECK (result.a.a_x == source.a.a_x);
++  CHECK (result.a.a_y == source.a.a_y);
++  CHECK (result.b.b_x == source.b.b_x);
++  CHECK (result.b.b_y == source.b.b_y);
++  exit (0);
++}
+Index: libffi/testsuite/libffi.call/uninitialized.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/uninitialized.c
+@@ -0,0 +1,61 @@
++/* { dg-do run } */
++#include "ffitest.h"
++
++typedef struct
++{
++  unsigned char uc;
++  double d;
++  unsigned int ui;
++} test_structure_1;
++
++static test_structure_1 struct1(test_structure_1 ts)
++{
++  ts.uc++;
++  ts.d--;
++  ts.ui++;
++
++  return ts;
++}
++
++int main (void)
++{
++  ffi_cif cif;
++  ffi_type *args[MAX_ARGS];
++  void *values[MAX_ARGS];
++  ffi_type ts1_type;
++  ffi_type *ts1_type_elements[4];
++
++  memset(&cif, 1, sizeof(cif));
++  ts1_type.size = 0;
++  ts1_type.alignment = 0;
++  ts1_type.type = FFI_TYPE_STRUCT;
++  ts1_type.elements = ts1_type_elements;
++  ts1_type_elements[0] = &ffi_type_uchar;
++  ts1_type_elements[1] = &ffi_type_double;
++  ts1_type_elements[2] = &ffi_type_uint;
++  ts1_type_elements[3] = NULL;
++
++  test_structure_1 ts1_arg;
++  /* This is a hack to get a properly aligned result buffer */
++  test_structure_1 *ts1_result =
++    (test_structure_1 *) malloc (sizeof(test_structure_1));
++
++  args[0] = &ts1_type;
++  values[0] = &ts1_arg;
++
++  /* Initialize the cif */
++  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
++                   &ts1_type, args) == FFI_OK);
++
++  ts1_arg.uc = '\x01';
++  ts1_arg.d = 3.14159;
++  ts1_arg.ui = 555;
++
++  ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
++
++  CHECK(ts1_result->ui == 556);
++  CHECK(ts1_result->d == 3.14159 - 1);
++
++  free (ts1_result);
++  exit(0);
++}
+Index: libffi/testsuite/libffi.call/va_1.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/va_1.c
+@@ -0,0 +1,196 @@
++/* Area:              ffi_call
++   Purpose:           Test passing struct in variable argument lists.
++   Limitations:       none.
++   PR:                        none.
++   Originator:                ARM Ltd. */
++
++/* { dg-do run } */
++/* { dg-output "" { xfail avr32*-*-* x86_64-*-*-* } } */
++
++#include "ffitest.h"
++#include <stdarg.h>
++
++struct small_tag
++{
++  unsigned char a;
++  unsigned char b;
++};
++
++struct large_tag
++{
++  unsigned a;
++  unsigned b;
++  unsigned c;
++  unsigned d;
++  unsigned e;
++};
++
++static int
++test_fn (int n, ...)
++{
++  va_list ap;
++  struct small_tag s1;
++  struct small_tag s2;
++  struct large_tag l;
++  unsigned char uc;
++  signed char sc;
++  unsigned short us;
++  signed short ss;
++  unsigned int ui;
++  signed int si;
++  unsigned long ul;
++  signed long sl;
++  float f;
++  double d;
++
++  va_start (ap, n);
++  s1 = va_arg (ap, struct small_tag);
++  l = va_arg (ap, struct large_tag);
++  s2 = va_arg (ap, struct small_tag);
++
++  uc = va_arg (ap, unsigned);
++  sc = va_arg (ap, signed);
++
++  us = va_arg (ap, unsigned);
++  ss = va_arg (ap, signed);
++
++  ui = va_arg (ap, unsigned int);
++  si = va_arg (ap, signed int);
++
++  ul = va_arg (ap, unsigned long);
++  sl = va_arg (ap, signed long);
++
++  f = va_arg (ap, double);    /* C standard promotes float->double
++                                 when anonymous */
++  d = va_arg (ap, double);
++
++  printf ("%u %u %u %u %u %u %u %u %u uc=%u sc=%d %u %d %u %d %lu %ld %f %f\n",
++        s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
++        s2.a, s2.b,
++        uc, sc,
++        us, ss,
++        ui, si,
++        ul, sl,
++        f, d);
++  va_end (ap);
++  return n + 1;
++}
++
++int
++main (void)
++{
++  ffi_cif cif;
++  void* args[15];
++  ffi_type* arg_types[15];
++
++  ffi_type s_type;
++  ffi_type *s_type_elements[3];
++
++  ffi_type l_type;
++  ffi_type *l_type_elements[6];
++
++  struct small_tag s1;
++  struct small_tag s2;
++  struct large_tag l1;
++
++  int n;
++  int res;
++
++  unsigned char uc;
++  signed char sc;
++  unsigned short us;
++  signed short ss;
++  unsigned int ui;
++  signed int si;
++  unsigned long ul;
++  signed long sl;
++  double d1;
++  double f1;
++
++  s_type.size = 0;
++  s_type.alignment = 0;
++  s_type.type = FFI_TYPE_STRUCT;
++  s_type.elements = s_type_elements;
++
++  s_type_elements[0] = &ffi_type_uchar;
++  s_type_elements[1] = &ffi_type_uchar;
++  s_type_elements[2] = NULL;
++
++  l_type.size = 0;
++  l_type.alignment = 0;
++  l_type.type = FFI_TYPE_STRUCT;
++  l_type.elements = l_type_elements;
++
++  l_type_elements[0] = &ffi_type_uint;
++  l_type_elements[1] = &ffi_type_uint;
++  l_type_elements[2] = &ffi_type_uint;
++  l_type_elements[3] = &ffi_type_uint;
++  l_type_elements[4] = &ffi_type_uint;
++  l_type_elements[5] = NULL;
++
++  arg_types[0] = &ffi_type_sint;
++  arg_types[1] = &s_type;
++  arg_types[2] = &l_type;
++  arg_types[3] = &s_type;
++  arg_types[4] = &ffi_type_uint;
++  arg_types[5] = &ffi_type_sint;
++  arg_types[6] = &ffi_type_uint;
++  arg_types[7] = &ffi_type_sint;
++  arg_types[8] = &ffi_type_uint;
++  arg_types[9] = &ffi_type_sint;
++  arg_types[10] = &ffi_type_ulong;
++  arg_types[11] = &ffi_type_slong;
++  arg_types[12] = &ffi_type_double;
++  arg_types[13] = &ffi_type_double;
++  arg_types[14] = NULL;
++
++  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 14, &ffi_type_sint, arg_types) == FFI_OK);
++
++  s1.a = 5;
++  s1.b = 6;
++
++  l1.a = 10;
++  l1.b = 11;
++  l1.c = 12;
++  l1.d = 13;
++  l1.e = 14;
++
++  s2.a = 7;
++  s2.b = 8;
++
++  n = 41;
++
++  uc = 9;
++  sc = 10;
++  us = 11;
++  ss = 12;
++  ui = 13;
++  si = 14;
++  ul = 15;
++  sl = 16;
++  f1 = 2.12;
++  d1 = 3.13;
++
++  args[0] = &n;
++  args[1] = &s1;
++  args[2] = &l1;
++  args[3] = &s2;
++  args[4] = &uc;
++  args[5] = &sc;
++  args[6] = &us;
++  args[7] = &ss;
++  args[8] = &ui;
++  args[9] = &si;
++  args[10] = &ul;
++  args[11] = &sl;
++  args[12] = &f1;
++  args[13] = &d1;
++  args[14] = NULL;
++
++  ffi_call(&cif, FFI_FN(test_fn), &res, args);
++  /* { dg-output "5 6 10 11 12 13 14 7 8 uc=9 sc=10 11 12 13 14 15 16 2.120000 3.130000" } */
++  printf("res: %d\n", (int) res);
++  /* { dg-output "\nres: 42" } */
++
++  return 0;
++}
+Index: libffi/testsuite/libffi.call/va_struct1.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/va_struct1.c
+@@ -0,0 +1,121 @@
++/* Area:              ffi_call
++   Purpose:           Test passing struct in variable argument lists.
++   Limitations:       none.
++   PR:                        none.
++   Originator: ARM Ltd. */
++
++/* { dg-do run } */
++/* { dg-output "" { xfail avr32*-*-* } } */
++
++#include "ffitest.h"
++#include <stdarg.h>
++
++struct small_tag
++{
++  unsigned char a;
++  unsigned char b;
++};
++
++struct large_tag
++{
++  unsigned a;
++  unsigned b;
++  unsigned c;
++  unsigned d;
++  unsigned e;
++};
++
++static int
++test_fn (int n, ...)
++{
++  va_list ap;
++  struct small_tag s1;
++  struct small_tag s2;
++  struct large_tag l;
++
++  va_start (ap, n);
++  s1 = va_arg (ap, struct small_tag);
++  l = va_arg (ap, struct large_tag);
++  s2 = va_arg (ap, struct small_tag);
++  printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
++        s2.a, s2.b);
++  va_end (ap);
++  return n + 1;
++}
++
++int
++main (void)
++{
++  ffi_cif cif;
++  void* args[5];
++  ffi_type* arg_types[5];
++
++  ffi_type s_type;
++  ffi_type *s_type_elements[3];
++
++  ffi_type l_type;
++  ffi_type *l_type_elements[6];
++
++  struct small_tag s1;
++  struct small_tag s2;
++  struct large_tag l1;
++
++  int n;
++  int res;
++
++  s_type.size = 0;
++  s_type.alignment = 0;
++  s_type.type = FFI_TYPE_STRUCT;
++  s_type.elements = s_type_elements;
++
++  s_type_elements[0] = &ffi_type_uchar;
++  s_type_elements[1] = &ffi_type_uchar;
++  s_type_elements[2] = NULL;
++
++  l_type.size = 0;
++  l_type.alignment = 0;
++  l_type.type = FFI_TYPE_STRUCT;
++  l_type.elements = l_type_elements;
++
++  l_type_elements[0] = &ffi_type_uint;
++  l_type_elements[1] = &ffi_type_uint;
++  l_type_elements[2] = &ffi_type_uint;
++  l_type_elements[3] = &ffi_type_uint;
++  l_type_elements[4] = &ffi_type_uint;
++  l_type_elements[5] = NULL;
++
++  arg_types[0] = &ffi_type_sint;
++  arg_types[1] = &s_type;
++  arg_types[2] = &l_type;
++  arg_types[3] = &s_type;
++  arg_types[4] = NULL;
++
++  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, arg_types) == FFI_OK);
++
++  s1.a = 5;
++  s1.b = 6;
++
++  l1.a = 10;
++  l1.b = 11;
++  l1.c = 12;
++  l1.d = 13;
++  l1.e = 14;
++
++  s2.a = 7;
++  s2.b = 8;
++
++  n = 41;
++
++  args[0] = &n;
++  args[1] = &s1;
++  args[2] = &l1;
++  args[3] = &s2;
++  args[4] = NULL;
++
++  ffi_call(&cif, FFI_FN(test_fn), &res, args);
++  /* { dg-output "5 6 10 11 12 13 14 7 8" } */
++  printf("res: %d\n", (int) res);
++  /* { dg-output "\nres: 42" } */
++
++  return 0;
++}
+Index: libffi/testsuite/libffi.call/va_struct2.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/va_struct2.c
+@@ -0,0 +1,123 @@
++/* Area:              ffi_call
++   Purpose:           Test passing struct in variable argument lists.
++   Limitations:       none.
++   PR:                        none.
++   Originator: ARM Ltd. */
++
++/* { dg-do run } */
++/* { dg-output "" { xfail avr32*-*-* } } */
++
++#include "ffitest.h"
++#include <stdarg.h>
++
++struct small_tag
++{
++  unsigned char a;
++  unsigned char b;
++};
++
++struct large_tag
++{
++  unsigned a;
++  unsigned b;
++  unsigned c;
++  unsigned d;
++  unsigned e;
++};
++
++static struct small_tag
++test_fn (int n, ...)
++{
++  va_list ap;
++  struct small_tag s1;
++  struct small_tag s2;
++  struct large_tag l;
++
++  va_start (ap, n);
++  s1 = va_arg (ap, struct small_tag);
++  l = va_arg (ap, struct large_tag);
++  s2 = va_arg (ap, struct small_tag);
++  printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
++        s2.a, s2.b);
++  va_end (ap);
++  s1.a += s2.a;
++  s1.b += s2.b;
++  return s1;
++}
++
++int
++main (void)
++{
++  ffi_cif cif;
++  void* args[5];
++  ffi_type* arg_types[5];
++
++  ffi_type s_type;
++  ffi_type *s_type_elements[3];
++
++  ffi_type l_type;
++  ffi_type *l_type_elements[6];
++
++  struct small_tag s1;
++  struct small_tag s2;
++  struct large_tag l1;
++
++  int n;
++  struct small_tag res;
++
++  s_type.size = 0;
++  s_type.alignment = 0;
++  s_type.type = FFI_TYPE_STRUCT;
++  s_type.elements = s_type_elements;
++
++  s_type_elements[0] = &ffi_type_uchar;
++  s_type_elements[1] = &ffi_type_uchar;
++  s_type_elements[2] = NULL;
++
++  l_type.size = 0;
++  l_type.alignment = 0;
++  l_type.type = FFI_TYPE_STRUCT;
++  l_type.elements = l_type_elements;
++
++  l_type_elements[0] = &ffi_type_uint;
++  l_type_elements[1] = &ffi_type_uint;
++  l_type_elements[2] = &ffi_type_uint;
++  l_type_elements[3] = &ffi_type_uint;
++  l_type_elements[4] = &ffi_type_uint;
++  l_type_elements[5] = NULL;
++
++  arg_types[0] = &ffi_type_sint;
++  arg_types[1] = &s_type;
++  arg_types[2] = &l_type;
++  arg_types[3] = &s_type;
++  arg_types[4] = NULL;
++
++  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &s_type, arg_types) == FFI_OK);
++
++  s1.a = 5;
++  s1.b = 6;
++
++  l1.a = 10;
++  l1.b = 11;
++  l1.c = 12;
++  l1.d = 13;
++  l1.e = 14;
++
++  s2.a = 7;
++  s2.b = 8;
++
++  n = 41;
++
++  args[0] = &n;
++  args[1] = &s1;
++  args[2] = &l1;
++  args[3] = &s2;
++  args[4] = NULL;
++
++  ffi_call(&cif, FFI_FN(test_fn), &res, args);
++  /* { dg-output "5 6 10 11 12 13 14 7 8" } */
++  printf("res: %d %d\n", res.a, res.b);
++  /* { dg-output "\nres: 12 14" } */
++
++  return 0;
++}
+Index: libffi/testsuite/libffi.call/va_struct3.c
+===================================================================
+--- /dev/null
++++ libffi/testsuite/libffi.call/va_struct3.c
+@@ -0,0 +1,125 @@
++/* Area:              ffi_call
++   Purpose:           Test passing struct in variable argument lists.
++   Limitations:       none.
++   PR:                        none.
++   Originator:        ARM Ltd. */
++
++/* { dg-do run } */
++/* { dg-output "" { xfail avr32*-*-* } } */
++
++#include "ffitest.h"
++#include <stdarg.h>
++
++struct small_tag
++{
++  unsigned char a;
++  unsigned char b;
++};
++
++struct large_tag
++{
++  unsigned a;
++  unsigned b;
++  unsigned c;
++  unsigned d;
++  unsigned e;
++};
++
++static struct large_tag
++test_fn (int n, ...)
++{
++  va_list ap;
++  struct small_tag s1;
++  struct small_tag s2;
++  struct large_tag l;
++
++  va_start (ap, n);
++  s1 = va_arg (ap, struct small_tag);
++  l = va_arg (ap, struct large_tag);
++  s2 = va_arg (ap, struct small_tag);
++  printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
++        s2.a, s2.b);
++  va_end (ap);
++  l.a += s1.a;
++  l.b += s1.b;
++  l.c += s2.a;
++  l.d += s2.b;
++  return l;
++}
++
++int
++main (void)
++{
++  ffi_cif cif;
++  void* args[5];
++  ffi_type* arg_types[5];
++
++  ffi_type s_type;
++  ffi_type *s_type_elements[3];
++
++  ffi_type l_type;
++  ffi_type *l_type_elements[6];
++
++  struct small_tag s1;
++  struct small_tag s2;
++  struct large_tag l1;
++
++  int n;
++  struct large_tag res;
++
++  s_type.size = 0;
++  s_type.alignment = 0;
++  s_type.type = FFI_TYPE_STRUCT;
++  s_type.elements = s_type_elements;
++
++  s_type_elements[0] = &ffi_type_uchar;
++  s_type_elements[1] = &ffi_type_uchar;
++  s_type_elements[2] = NULL;
++
++  l_type.size = 0;
++  l_type.alignment = 0;
++  l_type.type = FFI_TYPE_STRUCT;
++  l_type.elements = l_type_elements;
++
++  l_type_elements[0] = &ffi_type_uint;
++  l_type_elements[1] = &ffi_type_uint;
++  l_type_elements[2] = &ffi_type_uint;
++  l_type_elements[3] = &ffi_type_uint;
++  l_type_elements[4] = &ffi_type_uint;
++  l_type_elements[5] = NULL;
++
++  arg_types[0] = &ffi_type_sint;
++  arg_types[1] = &s_type;
++  arg_types[2] = &l_type;
++  arg_types[3] = &s_type;
++  arg_types[4] = NULL;
++
++  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &l_type, arg_types) == FFI_OK);
++
++  s1.a = 5;
++  s1.b = 6;
++
++  l1.a = 10;
++  l1.b = 11;
++  l1.c = 12;
++  l1.d = 13;
++  l1.e = 14;
++
++  s2.a = 7;
++  s2.b = 8;
++
++  n = 41;
++
++  args[0] = &n;
++  args[1] = &s1;
++  args[2] = &l1;
++  args[3] = &s2;
++  args[4] = NULL;
++
++  ffi_call(&cif, FFI_FN(test_fn), &res, args);
++  /* { dg-output "5 6 10 11 12 13 14 7 8" } */
++  printf("res: %d %d %d %d %d\n", res.a, res.b, res.c, res.d, res.e);
++  /* { dg-output "\nres: 15 17 19 21 14" } */
++
++  return 0;
++}
+Index: libffi/ChangeLog
+===================================================================
+--- libffi.orig/ChangeLog
++++ libffi/ChangeLog
+@@ -1,3 +1,27 @@
++2012-10-30  James Greenhalgh  <james.greenhalgh at arm.com>
++            Marcus Shawcroft  <marcus.shawcroft at arm.com>
++
++        * README: Add details of aarch64 port.
++        * src/aarch64/ffi.c: New.
++        * src/aarch64/ffitarget.h: Likewise.
++        * src/aarch64/sysv.S: Likewise.
++
++2012-10-30  James Greenhalgh  <james.greenhalgh at arm.com>
++            Marcus Shawcroft  <marcus.shawcroft at arm.com>
++
++        * testsuite/lib/libffi.exp: Add support for aarch64.
++        * testsuite/libffi.call/cls_struct_va1.c: New.
++        * testsuite/libffi.call/cls_uchar_va.c: Likewise.
++        * testsuite/libffi.call/cls_uint_va.c: Likewise.
++        * testsuite/libffi.call/cls_ulong_va.c: Liekwise.
++        * testsuite/libffi.call/cls_ushort_va.c: Likewise.
++        * testsuite/libffi.call/nested_struct11.c: Likewise.
++        * testsuite/libffi.call/uninitialized.c: Likewise.
++        * testsuite/libffi.call/va_1.c: Likewise.
++        * testsuite/libffi.call/va_struct1.c: Likewise.
++        * testsuite/libffi.call/va_struct2.c: Likewise.
++        * testsuite/libffi.call/va_struct3.c: Likewise.
++
+ 2012-10-12  Walter Lee  <walt@tilera.com>
+         * Makefile.am: Add TILE-Gx/TILEPro support.
index 26e4d7885dc8786a2694e1de8a503eb0c396c32a..18aef73df808324a2cd6f5ce44bb56e8da4d6fa4 100644 (file)
@@ -23,3 +23,4 @@ ios-fix
 mingw-check-fix
 whitespace-fix
 tile
+aarch64
diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c
new file mode 100644 (file)
index 0000000..1405665
--- /dev/null
@@ -0,0 +1,1076 @@
+/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+``Software''), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
+
+#include <stdio.h>
+
+#include <ffi.h>
+#include <ffi_common.h>
+
+#include <stdlib.h>
+
+/* Stack alignment requirement in bytes */
+#define AARCH64_STACK_ALIGN 16
+
+#define N_X_ARG_REG 8
+#define N_V_ARG_REG 8
+
+#define AARCH64_FFI_WITH_V (1 << AARCH64_FFI_WITH_V_BIT)
+
+union _d
+{
+  UINT64 d;
+  UINT32 s[2];
+};
+
+struct call_context
+{
+  UINT64 x [AARCH64_N_XREG];
+  struct
+  {
+    union _d d[2];
+  } v [AARCH64_N_VREG];
+};
+
+static void *
+get_x_addr (struct call_context *context, unsigned n)
+{
+  return &context->x[n];
+}
+
+static void *
+get_s_addr (struct call_context *context, unsigned n)
+{
+#if defined __AARCH64EB__
+  return &context->v[n].d[1].s[1];
+#else
+  return &context->v[n].d[0].s[0];
+#endif
+}
+
+static void *
+get_d_addr (struct call_context *context, unsigned n)
+{
+#if defined __AARCH64EB__
+  return &context->v[n].d[1];
+#else
+  return &context->v[n].d[0];
+#endif
+}
+
+static void *
+get_v_addr (struct call_context *context, unsigned n)
+{
+  return &context->v[n];
+}
+
+/* Return the memory location at which a basic type would reside
+   were it to have been stored in register n.  */
+
+static void *
+get_basic_type_addr (unsigned short type, struct call_context *context,
+                    unsigned n)
+{
+  switch (type)
+    {
+    case FFI_TYPE_FLOAT:
+      return get_s_addr (context, n);
+    case FFI_TYPE_DOUBLE:
+      return get_d_addr (context, n);
+    case FFI_TYPE_LONGDOUBLE:
+      return get_v_addr (context, n);
+    case FFI_TYPE_UINT8:
+    case FFI_TYPE_SINT8:
+    case FFI_TYPE_UINT16:
+    case FFI_TYPE_SINT16:
+    case FFI_TYPE_UINT32:
+    case FFI_TYPE_SINT32:
+    case FFI_TYPE_INT:
+    case FFI_TYPE_POINTER:
+    case FFI_TYPE_UINT64:
+    case FFI_TYPE_SINT64:
+      return get_x_addr (context, n);
+    default:
+      FFI_ASSERT (0);
+      return NULL;
+    }
+}
+
+/* Return the alignment width for each of the basic types.  */
+
+static size_t
+get_basic_type_alignment (unsigned short type)
+{
+  switch (type)
+    {
+    case FFI_TYPE_FLOAT:
+    case FFI_TYPE_DOUBLE:
+      return sizeof (UINT64);
+    case FFI_TYPE_LONGDOUBLE:
+      return sizeof (long double);
+    case FFI_TYPE_UINT8:
+    case FFI_TYPE_SINT8:
+    case FFI_TYPE_UINT16:
+    case FFI_TYPE_SINT16:
+    case FFI_TYPE_UINT32:
+    case FFI_TYPE_INT:
+    case FFI_TYPE_SINT32:
+    case FFI_TYPE_POINTER:
+    case FFI_TYPE_UINT64:
+    case FFI_TYPE_SINT64:
+      return sizeof (UINT64);
+
+    default:
+      FFI_ASSERT (0);
+      return 0;
+    }
+}
+
+/* Return the size in bytes for each of the basic types.  */
+
+static size_t
+get_basic_type_size (unsigned short type)
+{
+  switch (type)
+    {
+    case FFI_TYPE_FLOAT:
+      return sizeof (UINT32);
+    case FFI_TYPE_DOUBLE:
+      return sizeof (UINT64);
+    case FFI_TYPE_LONGDOUBLE:
+      return sizeof (long double);
+    case FFI_TYPE_UINT8:
+      return sizeof (UINT8);
+    case FFI_TYPE_SINT8:
+      return sizeof (SINT8);
+    case FFI_TYPE_UINT16:
+      return sizeof (UINT16);
+    case FFI_TYPE_SINT16:
+      return sizeof (SINT16);
+    case FFI_TYPE_UINT32:
+      return sizeof (UINT32);
+    case FFI_TYPE_INT:
+    case FFI_TYPE_SINT32:
+      return sizeof (SINT32);
+    case FFI_TYPE_POINTER:
+    case FFI_TYPE_UINT64:
+      return sizeof (UINT64);
+    case FFI_TYPE_SINT64:
+      return sizeof (SINT64);
+
+    default:
+      FFI_ASSERT (0);
+      return 0;
+    }
+}
+
+extern void
+ffi_call_SYSV (unsigned (*)(struct call_context *context, unsigned char *,
+                           extended_cif *),
+               struct call_context *context,
+               extended_cif *,
+               unsigned,
+               void (*fn)(void));
+
+extern void
+ffi_closure_SYSV (ffi_closure *);
+
+/* Test for an FFI floating point representation.  */
+
+static unsigned
+is_floating_type (unsigned short type)
+{
+  return (type == FFI_TYPE_FLOAT || type == FFI_TYPE_DOUBLE
+         || type == FFI_TYPE_LONGDOUBLE);
+}
+
+/* Test for a homogeneous structure.  */
+
+static unsigned short
+get_homogeneous_type (ffi_type *ty)
+{
+  if (ty->type == FFI_TYPE_STRUCT && ty->elements)
+    {
+      unsigned i;
+      unsigned short candidate_type
+       = get_homogeneous_type (ty->elements[0]);
+      for (i =1; ty->elements[i]; i++)
+       {
+         unsigned short iteration_type = 0;
+         /* If we have a nested struct, we must find its homogeneous type.
+            If that fits with our candidate type, we are still
+            homogeneous.  */
+         if (ty->elements[i]->type == FFI_TYPE_STRUCT
+             && ty->elements[i]->elements)
+           {
+             iteration_type = get_homogeneous_type (ty->elements[i]);
+           }
+         else
+           {
+             iteration_type = ty->elements[i]->type;
+           }
+
+         /* If we are not homogeneous, return FFI_TYPE_STRUCT.  */
+         if (candidate_type != iteration_type)
+           return FFI_TYPE_STRUCT;
+       }
+      return candidate_type;
+    }
+
+  /* Base case, we have no more levels of nesting, so we
+     are a basic type, and so, trivially homogeneous in that type.  */
+  return ty->type;
+}
+
+/* Determine the number of elements within a STRUCT.
+
+   Note, we must handle nested structs.
+
+   If ty is not a STRUCT this function will return 0.  */
+
+static unsigned
+element_count (ffi_type *ty)
+{
+  if (ty->type == FFI_TYPE_STRUCT && ty->elements)
+    {
+      unsigned n;
+      unsigned elems = 0;
+      for (n = 0; ty->elements[n]; n++)
+       {
+         if (ty->elements[n]->type == FFI_TYPE_STRUCT
+             && ty->elements[n]->elements)
+           elems += element_count (ty->elements[n]);
+         else
+           elems++;
+       }
+      return elems;
+    }
+  return 0;
+}
+
+/* Test for a homogeneous floating point aggregate.
+
+   A homogeneous floating point aggregate is a homogeneous aggregate of
+   a half- single- or double- precision floating point type with one
+   to four elements.  Note that this includes nested structs of the
+   basic type.  */
+
+static int
+is_hfa (ffi_type *ty)
+{
+  if (ty->type == FFI_TYPE_STRUCT
+      && ty->elements[0]
+      && is_floating_type (get_homogeneous_type (ty)))
+    {
+      unsigned n = element_count (ty);
+      return n >= 1 && n <= 4;
+    }
+  return 0;
+}
+
+/* Test if an ffi_type is a candidate for passing in a register.
+
+   This test does not check that sufficient registers of the
+   appropriate class are actually available, merely that IFF
+   sufficient registers are available then the argument will be passed
+   in register(s).
+
+   Note that an ffi_type that is deemed to be a register candidate
+   will always be returned in registers.
+
+   Returns 1 if a register candidate else 0.  */
+
+static int
+is_register_candidate (ffi_type *ty)
+{
+  switch (ty->type)
+    {
+    case FFI_TYPE_VOID:
+    case FFI_TYPE_FLOAT:
+    case FFI_TYPE_DOUBLE:
+    case FFI_TYPE_LONGDOUBLE:
+    case FFI_TYPE_UINT8:
+    case FFI_TYPE_UINT16:
+    case FFI_TYPE_UINT32:
+    case FFI_TYPE_UINT64:
+    case FFI_TYPE_POINTER:
+    case FFI_TYPE_SINT8:
+    case FFI_TYPE_SINT16:
+    case FFI_TYPE_SINT32:
+    case FFI_TYPE_INT:
+    case FFI_TYPE_SINT64:
+      return 1;
+
+    case FFI_TYPE_STRUCT:
+      if (is_hfa (ty))
+        {
+          return 1;
+        }
+      else if (ty->size > 16)
+        {
+          /* Too large. Will be replaced with a pointer to memory. The
+             pointer MAY be passed in a register, but the value will
+             not. This test specifically fails since the argument will
+             never be passed by value in registers. */
+          return 0;
+        }
+      else
+        {
+          /* Might be passed in registers depending on the number of
+             registers required. */
+          return (ty->size + 7) / 8 < N_X_ARG_REG;
+        }
+      break;
+
+    default:
+      FFI_ASSERT (0);
+      break;
+    }
+
+  return 0;
+}
+
+/* Test if an ffi_type argument or result is a candidate for a vector
+   register.  */
+
+static int
+is_v_register_candidate (ffi_type *ty)
+{
+  return is_floating_type (ty->type)
+          || (ty->type == FFI_TYPE_STRUCT && is_hfa (ty));
+}
+
+/* Representation of the procedure call argument marshalling
+   state.
+
+   The terse state variable names match the names used in the AARCH64
+   PCS. */
+
+struct arg_state
+{
+  unsigned ngrn;                /* Next general-purpose register number. */
+  unsigned nsrn;                /* Next vector register number. */
+  unsigned nsaa;                /* Next stack offset. */
+};
+
+/* Initialize a procedure call argument marshalling state.  */
+static void
+arg_init (struct arg_state *state, unsigned call_frame_size)
+{
+  state->ngrn = 0;
+  state->nsrn = 0;
+  state->nsaa = 0;
+}
+
+/* Return the number of available consecutive core argument
+   registers.  */
+
+static unsigned
+available_x (struct arg_state *state)
+{
+  return N_X_ARG_REG - state->ngrn;
+}
+
+/* Return the number of available consecutive vector argument
+   registers.  */
+
+static unsigned
+available_v (struct arg_state *state)
+{
+  return N_V_ARG_REG - state->nsrn;
+}
+
+static void *
+allocate_to_x (struct call_context *context, struct arg_state *state)
+{
+  FFI_ASSERT (state->ngrn < N_X_ARG_REG)
+  return get_x_addr (context, (state->ngrn)++);
+}
+
+static void *
+allocate_to_s (struct call_context *context, struct arg_state *state)
+{
+  FFI_ASSERT (state->nsrn < N_V_ARG_REG)
+  return get_s_addr (context, (state->nsrn)++);
+}
+
+static void *
+allocate_to_d (struct call_context *context, struct arg_state *state)
+{
+  FFI_ASSERT (state->nsrn < N_V_ARG_REG)
+  return get_d_addr (context, (state->nsrn)++);
+}
+
+static void *
+allocate_to_v (struct call_context *context, struct arg_state *state)
+{
+  FFI_ASSERT (state->nsrn < N_V_ARG_REG)
+  return get_v_addr (context, (state->nsrn)++);
+}
+
+/* Allocate an aligned slot on the stack and return a pointer to it.  */
+static void *
+allocate_to_stack (struct arg_state *state, void *stack, unsigned alignment,
+                  unsigned size)
+{
+  void *allocation;
+
+  /* Round up the NSAA to the larger of 8 or the natural
+     alignment of the argument's type.  */
+  state->nsaa = ALIGN (state->nsaa, alignment);
+  state->nsaa = ALIGN (state->nsaa, alignment);
+  state->nsaa = ALIGN (state->nsaa, 8);
+
+  allocation = stack + state->nsaa;
+
+  state->nsaa += size;
+  return allocation;
+}
+
+static void
+copy_basic_type (void *dest, void *source, unsigned short type)
+{
+  /* This is neccessary to ensure that basic types are copied
+     sign extended to 64-bits as libffi expects.  */
+  switch (type)
+    {
+    case FFI_TYPE_FLOAT:
+      *(float *) dest = *(float *) source;
+      break;
+    case FFI_TYPE_DOUBLE:
+      *(double *) dest = *(double *) source;
+      break;
+    case FFI_TYPE_LONGDOUBLE:
+      *(long double *) dest = *(long double *) source;
+      break;
+    case FFI_TYPE_UINT8:
+      *(ffi_arg *) dest = *(UINT8 *) source;
+      break;
+    case FFI_TYPE_SINT8:
+      *(ffi_sarg *) dest = *(SINT8 *) source;
+      break;
+    case FFI_TYPE_UINT16:
+      *(ffi_arg *) dest = *(UINT16 *) source;
+      break;
+    case FFI_TYPE_SINT16:
+      *(ffi_sarg *) dest = *(SINT16 *) source;
+      break;
+    case FFI_TYPE_UINT32:
+      *(ffi_arg *) dest = *(UINT32 *) source;
+      break;
+    case FFI_TYPE_INT:
+    case FFI_TYPE_SINT32:
+      *(ffi_sarg *) dest = *(SINT32 *) source;
+      break;
+    case FFI_TYPE_POINTER:
+    case FFI_TYPE_UINT64:
+      *(ffi_arg *) dest = *(UINT64 *) source;
+      break;
+    case FFI_TYPE_SINT64:
+      *(ffi_sarg *) dest = *(SINT64 *) source;
+      break;
+
+    default:
+      FFI_ASSERT (0);
+    }
+}
+
+static void
+copy_hfa_to_reg_or_stack (void *memory,
+                         ffi_type *ty,
+                         struct call_context *context,
+                         unsigned char *stack,
+                         struct arg_state *state)
+{
+  unsigned elems = element_count (ty);
+  if (available_v (state) < elems)
+    {
+      /* There are insufficient V registers. Further V register allocations
+        are prevented, the NSAA is adjusted (by allocate_to_stack ())
+        and the argument is copied to memory at the adjusted NSAA.  */
+      state->nsrn = N_V_ARG_REG;
+      memcpy (allocate_to_stack (state, stack, ty->alignment, ty->size),
+             memory,
+             ty->size);
+    }
+  else
+    {
+      int i;
+      unsigned short type = get_homogeneous_type (ty);
+      unsigned elems = element_count (ty);
+      for (i = 0; i < elems; i++)
+       {
+         void *reg = allocate_to_v (context, state);
+         copy_basic_type (reg, memory, type);
+         memory += get_basic_type_size (type);
+       }
+    }
+}
+
+/* Either allocate an appropriate register for the argument type, or if
+   none are available, allocate a stack slot and return a pointer
+   to the allocated space.  */
+
+static void *
+allocate_to_register_or_stack (struct call_context *context,
+                              unsigned char *stack,
+                              struct arg_state *state,
+                              unsigned short type)
+{
+  size_t alignment = get_basic_type_alignment (type);
+  size_t size = alignment;
+  switch (type)
+    {
+    case FFI_TYPE_FLOAT:
+      /* This is the only case for which the allocated stack size
+        should not match the alignment of the type.  */
+      size = sizeof (UINT32);
+      /* Fall through.  */
+    case FFI_TYPE_DOUBLE:
+      if (state->nsrn < N_V_ARG_REG)
+       return allocate_to_d (context, state);
+      state->nsrn = N_V_ARG_REG;
+      break;
+    case FFI_TYPE_LONGDOUBLE:
+      if (state->nsrn < N_V_ARG_REG)
+       return allocate_to_v (context, state);
+      state->nsrn = N_V_ARG_REG;
+      break;
+    case FFI_TYPE_UINT8:
+    case FFI_TYPE_SINT8:
+    case FFI_TYPE_UINT16:
+    case FFI_TYPE_SINT16:
+    case FFI_TYPE_UINT32:
+    case FFI_TYPE_SINT32:
+    case FFI_TYPE_INT:
+    case FFI_TYPE_POINTER:
+    case FFI_TYPE_UINT64:
+    case FFI_TYPE_SINT64:
+      if (state->ngrn < N_X_ARG_REG)
+       return allocate_to_x (context, state);
+      state->ngrn = N_X_ARG_REG;
+      break;
+    default:
+      FFI_ASSERT (0);
+    }
+
+    return allocate_to_stack (state, stack, alignment, size);
+}
+
+/* Copy a value to an appropriate register, or if none are
+   available, to the stack.  */
+
+static void
+copy_to_register_or_stack (struct call_context *context,
+                          unsigned char *stack,
+                          struct arg_state *state,
+                          void *value,
+                          unsigned short type)
+{
+  copy_basic_type (
+         allocate_to_register_or_stack (context, stack, state, type),
+         value,
+         type);
+}
+
+/* Marshall the arguments from FFI representation to procedure call
+   context and stack.  */
+
+static unsigned
+aarch64_prep_args (struct call_context *context, unsigned char *stack,
+                  extended_cif *ecif)
+{
+  int i;
+  struct arg_state state;
+
+  arg_init (&state, ALIGN(ecif->cif->bytes, 16));
+
+  for (i = 0; i < ecif->cif->nargs; i++)
+    {
+      ffi_type *ty = ecif->cif->arg_types[i];
+      switch (ty->type)
+       {
+       case FFI_TYPE_VOID:
+         FFI_ASSERT (0);
+         break;
+
+       /* If the argument is a basic type the argument is allocated to an
+          appropriate register, or if none are available, to the stack.  */
+       case FFI_TYPE_FLOAT:
+       case FFI_TYPE_DOUBLE:
+       case FFI_TYPE_LONGDOUBLE:
+       case FFI_TYPE_UINT8:
+       case FFI_TYPE_SINT8:
+       case FFI_TYPE_UINT16:
+       case FFI_TYPE_SINT16:
+       case FFI_TYPE_UINT32:
+       case FFI_TYPE_INT:
+       case FFI_TYPE_SINT32:
+       case FFI_TYPE_POINTER:
+       case FFI_TYPE_UINT64:
+       case FFI_TYPE_SINT64:
+         copy_to_register_or_stack (context, stack, &state,
+                                    ecif->avalue[i], ty->type);
+         break;
+
+       case FFI_TYPE_STRUCT:
+         if (is_hfa (ty))
+           {
+             copy_hfa_to_reg_or_stack (ecif->avalue[i], ty, context,
+                                       stack, &state);
+           }
+         else if (ty->size > 16)
+           {
+             /* If the argument is a composite type that is larger than 16
+                bytes, then the argument has been copied to memory, and
+                the argument is replaced by a pointer to the copy.  */
+
+             copy_to_register_or_stack (context, stack, &state,
+                                        &(ecif->avalue[i]), FFI_TYPE_POINTER);
+           }
+         else if (available_x (&state) >= (ty->size + 7) / 8)
+           {
+             /* If the argument is a composite type and the size in
+                double-words is not more than the number of available
+                X registers, then the argument is copied into consecutive
+                X registers.  */
+             int j;
+             for (j = 0; j < (ty->size + 7) / 8; j++)
+               {
+                 memcpy (allocate_to_x (context, &state),
+                         &(((UINT64 *) ecif->avalue[i])[j]),
+                         sizeof (UINT64));
+               }
+           }
+         else
+           {
+             /* Otherwise, there are insufficient X registers. Further X
+                register allocations are prevented, the NSAA is adjusted
+                (by allocate_to_stack ()) and the argument is copied to
+                memory at the adjusted NSAA.  */
+             state.ngrn = N_X_ARG_REG;
+
+             memcpy (allocate_to_stack (&state, stack, ty->alignment,
+                                        ty->size), ecif->avalue + i, ty->size);
+           }
+         break;
+
+       default:
+         FFI_ASSERT (0);
+         break;
+       }
+    }
+
+  return ecif->cif->aarch64_flags;
+}
+
+ffi_status
+ffi_prep_cif_machdep (ffi_cif *cif)
+{
+  /* Round the stack up to a multiple of the stack alignment requirement. */
+  cif->bytes =
+    (cif->bytes + (AARCH64_STACK_ALIGN - 1)) & ~ (AARCH64_STACK_ALIGN - 1);
+
+  /* Initialize our flags. We are interested if this CIF will touch a
+     vector register, if so we will enable context save and load to
+     those registers, otherwise not. This is intended to be friendly
+     to lazy float context switching in the kernel.  */
+  cif->aarch64_flags = 0;
+
+  if (is_v_register_candidate (cif->rtype))
+    {
+      cif->aarch64_flags |= AARCH64_FFI_WITH_V;
+    }
+  else
+    {
+      int i;
+      for (i = 0; i < cif->nargs; i++)
+        if (is_v_register_candidate (cif->arg_types[i]))
+          {
+            cif->aarch64_flags |= AARCH64_FFI_WITH_V;
+            break;
+          }
+    }
+
+  return FFI_OK;
+}
+
+/* Call a function with the provided arguments and capture the return
+   value.  */
+void
+ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
+{
+  extended_cif ecif;
+
+  ecif.cif = cif;
+  ecif.avalue = avalue;
+  ecif.rvalue = rvalue;
+
+  switch (cif->abi)
+    {
+    case FFI_SYSV:
+      {
+        struct call_context context;
+       unsigned stack_bytes;
+
+       /* Figure out the total amount of stack space we need, the
+          above call frame space needs to be 16 bytes aligned to
+          ensure correct alignment of the first object inserted in
+          that space hence the ALIGN applied to cif->bytes.*/
+       stack_bytes = ALIGN(cif->bytes, 16);
+
+       memset (&context, 0, sizeof (context));
+        if (is_register_candidate (cif->rtype))
+          {
+            ffi_call_SYSV (aarch64_prep_args, &context, &ecif, stack_bytes, fn);
+            switch (cif->rtype->type)
+              {
+              case FFI_TYPE_VOID:
+              case FFI_TYPE_FLOAT:
+              case FFI_TYPE_DOUBLE:
+              case FFI_TYPE_LONGDOUBLE:
+              case FFI_TYPE_UINT8:
+              case FFI_TYPE_SINT8:
+              case FFI_TYPE_UINT16:
+              case FFI_TYPE_SINT16:
+              case FFI_TYPE_UINT32:
+              case FFI_TYPE_SINT32:
+              case FFI_TYPE_POINTER:
+              case FFI_TYPE_UINT64:
+              case FFI_TYPE_INT:
+              case FFI_TYPE_SINT64:
+               {
+                 void *addr = get_basic_type_addr (cif->rtype->type,
+                                                   &context, 0);
+                 copy_basic_type (rvalue, addr, cif->rtype->type);
+                 break;
+               }
+
+              case FFI_TYPE_STRUCT:
+                if (is_hfa (cif->rtype))
+                 {
+                   int j;
+                   unsigned short type = get_homogeneous_type (cif->rtype);
+                   unsigned elems = element_count (cif->rtype);
+                   for (j = 0; j < elems; j++)
+                     {
+                       void *reg = get_basic_type_addr (type, &context, j);
+                       copy_basic_type (rvalue, reg, type);
+                       rvalue += get_basic_type_size (type);
+                     }
+                 }
+                else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG)
+                  {
+                    unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64));
+                    memcpy (rvalue, get_x_addr (&context, 0), size);
+                  }
+                else
+                  {
+                    FFI_ASSERT (0);
+                  }
+                break;
+
+              default:
+                FFI_ASSERT (0);
+                break;
+              }
+          }
+        else
+          {
+            memcpy (get_x_addr (&context, 8), &rvalue, sizeof (UINT64));
+            ffi_call_SYSV (aarch64_prep_args, &context, &ecif,
+                          stack_bytes, fn);
+          }
+        break;
+      }
+
+    default:
+      FFI_ASSERT (0);
+      break;
+    }
+}
+
+static unsigned char trampoline [] =
+{ 0x70, 0x00, 0x00, 0x58,      /* ldr  x16, 1f */
+  0x91, 0x00, 0x00, 0x10,      /* adr  x17, 2f */
+  0x00, 0x02, 0x1f, 0xd6       /* br   x16     */
+};
+
+/* Build a trampoline.  */
+
+#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX,FLAGS)                       \
+  ({unsigned char *__tramp = (unsigned char*)(TRAMP);                  \
+    UINT64  __fun = (UINT64)(FUN);                                     \
+    UINT64  __ctx = (UINT64)(CTX);                                     \
+    UINT64  __flags = (UINT64)(FLAGS);                                 \
+    memcpy (__tramp, trampoline, sizeof (trampoline));                 \
+    memcpy (__tramp + 12, &__fun, sizeof (__fun));                     \
+    memcpy (__tramp + 20, &__ctx, sizeof (__ctx));                     \
+    memcpy (__tramp + 28, &__flags, sizeof (__flags));                 \
+    __clear_cache(__tramp, __tramp + FFI_TRAMPOLINE_SIZE);             \
+  })
+
+ffi_status
+ffi_prep_closure_loc (ffi_closure* closure,
+                      ffi_cif* cif,
+                      void (*fun)(ffi_cif*,void*,void**,void*),
+                      void *user_data,
+                      void *codeloc)
+{
+  if (cif->abi != FFI_SYSV)
+    return FFI_BAD_ABI;
+
+  FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV, codeloc,
+                      cif->aarch64_flags);
+
+  closure->cif  = cif;
+  closure->user_data = user_data;
+  closure->fun  = fun;
+
+  return FFI_OK;
+}
+
+/* Primary handler to setup and invoke a function within a closure.
+
+   A closure when invoked enters via the assembler wrapper
+   ffi_closure_SYSV(). The wrapper allocates a call context on the
+   stack, saves the interesting registers (from the perspective of
+   the calling convention) into the context then passes control to
+   ffi_closure_SYSV_inner() passing the saved context and a pointer to
+   the stack at the point ffi_closure_SYSV() was invoked.
+
+   On the return path the assembler wrapper will reload call context
+   regsiters.
+
+   ffi_closure_SYSV_inner() marshalls the call context into ffi value
+   desriptors, invokes the wrapped function, then marshalls the return
+   value back into the call context.  */
+
+void
+ffi_closure_SYSV_inner (ffi_closure *closure, struct call_context *context,
+                       void *stack)
+{
+  ffi_cif *cif = closure->cif;
+  void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
+  void *rvalue = NULL;
+  int i;
+  struct arg_state state;
+
+  arg_init (&state, ALIGN(cif->bytes, 16));
+
+  for (i = 0; i < cif->nargs; i++)
+    {
+      ffi_type *ty = cif->arg_types[i];
+
+      switch (ty->type)
+       {
+       case FFI_TYPE_VOID:
+         FFI_ASSERT (0);
+         break;
+
+       case FFI_TYPE_UINT8:
+       case FFI_TYPE_SINT8:
+       case FFI_TYPE_UINT16:
+       case FFI_TYPE_SINT16:
+       case FFI_TYPE_UINT32:
+       case FFI_TYPE_SINT32:
+       case FFI_TYPE_INT:
+       case FFI_TYPE_POINTER:
+       case FFI_TYPE_UINT64:
+       case FFI_TYPE_SINT64:
+       case  FFI_TYPE_FLOAT:
+       case  FFI_TYPE_DOUBLE:
+       case  FFI_TYPE_LONGDOUBLE:
+         avalue[i] = allocate_to_register_or_stack (context, stack,
+                                                    &state, ty->type);
+         break;
+
+       case FFI_TYPE_STRUCT:
+         if (is_hfa (ty))
+           {
+             unsigned n = element_count (ty);
+             if (available_v (&state) < n)
+               {
+                 state.nsrn = N_V_ARG_REG;
+                 avalue[i] = allocate_to_stack (&state, stack, ty->alignment,
+                                                ty->size);
+               }
+             else
+               {
+                 switch (get_homogeneous_type (ty))
+                   {
+                   case FFI_TYPE_FLOAT:
+                     {
+                       /* Eeek! We need a pointer to the structure,
+                          however the homogeneous float elements are
+                          being passed in individual S registers,
+                          therefore the structure is not represented as
+                          a contiguous sequence of bytes in our saved
+                          register context. We need to fake up a copy
+                          of the structure layed out in memory
+                          correctly. The fake can be tossed once the
+                          closure function has returned hence alloca()
+                          is sufficient. */
+                       int j;
+                       UINT32 *p = avalue[i] = alloca (ty->size);
+                       for (j = 0; j < element_count (ty); j++)
+                         memcpy (&p[j],
+                                 allocate_to_s (context, &state),
+                                 sizeof (*p));
+                       break;
+                     }
+
+                   case FFI_TYPE_DOUBLE:
+                     {
+                       /* Eeek! We need a pointer to the structure,
+                          however the homogeneous float elements are
+                          being passed in individual S registers,
+                          therefore the structure is not represented as
+                          a contiguous sequence of bytes in our saved
+                          register context. We need to fake up a copy
+                          of the structure layed out in memory
+                          correctly. The fake can be tossed once the
+                          closure function has returned hence alloca()
+                          is sufficient. */
+                       int j;
+                       UINT64 *p = avalue[i] = alloca (ty->size);
+                       for (j = 0; j < element_count (ty); j++)
+                         memcpy (&p[j],
+                                 allocate_to_d (context, &state),
+                                 sizeof (*p));
+                       break;
+                     }
+
+                   case FFI_TYPE_LONGDOUBLE:
+                         memcpy (&avalue[i],
+                                 allocate_to_v (context, &state),
+                                 sizeof (*avalue));
+                     break;
+
+                   default:
+                     FFI_ASSERT (0);
+                     break;
+                   }
+               }
+           }
+         else if (ty->size > 16)
+           {
+             /* Replace Composite type of size greater than 16 with a
+                pointer.  */
+             memcpy (&avalue[i],
+                     allocate_to_register_or_stack (context, stack,
+                                                    &state, FFI_TYPE_POINTER),
+                     sizeof (avalue[i]));
+           }
+         else if (available_x (&state) >= (ty->size + 7) / 8)
+           {
+             avalue[i] = get_x_addr (context, state.ngrn);
+             state.ngrn += (ty->size + 7) / 8;
+           }
+         else
+           {
+             state.ngrn = N_X_ARG_REG;
+
+             avalue[i] = allocate_to_stack (&state, stack, ty->alignment,
+                                            ty->size);
+           }
+         break;
+
+       default:
+         FFI_ASSERT (0);
+         break;
+       }
+    }
+
+  /* Figure out where the return value will be passed, either in
+     registers or in a memory block allocated by the caller and passed
+     in x8.  */
+
+  if (is_register_candidate (cif->rtype))
+    {
+      /* Register candidates are *always* returned in registers. */
+
+      /* Allocate a scratchpad for the return value, we will let the
+         callee scrible the result into the scratch pad then move the
+         contents into the appropriate return value location for the
+         call convention.  */
+      rvalue = alloca (cif->rtype->size);
+      (closure->fun) (cif, rvalue, avalue, closure->user_data);
+
+      /* Copy the return value into the call context so that it is returned
+         as expected to our caller.  */
+      switch (cif->rtype->type)
+        {
+        case FFI_TYPE_VOID:
+          break;
+
+        case FFI_TYPE_UINT8:
+        case FFI_TYPE_UINT16:
+        case FFI_TYPE_UINT32:
+        case FFI_TYPE_POINTER:
+        case FFI_TYPE_UINT64:
+        case FFI_TYPE_SINT8:
+        case FFI_TYPE_SINT16:
+        case FFI_TYPE_INT:
+        case FFI_TYPE_SINT32:
+        case FFI_TYPE_SINT64:
+        case FFI_TYPE_FLOAT:
+        case FFI_TYPE_DOUBLE:
+        case FFI_TYPE_LONGDOUBLE:
+         {
+           void *addr = get_basic_type_addr (cif->rtype->type, context, 0);
+           copy_basic_type (addr, rvalue, cif->rtype->type);
+            break;
+         }
+        case FFI_TYPE_STRUCT:
+          if (is_hfa (cif->rtype))
+           {
+             int i;
+             unsigned short type = get_homogeneous_type (cif->rtype);
+             unsigned elems = element_count (cif->rtype);
+             for (i = 0; i < elems; i++)
+               {
+                 void *reg = get_basic_type_addr (type, context, i);
+                 copy_basic_type (reg, rvalue, type);
+                 rvalue += get_basic_type_size (type);
+               }
+           }
+          else if ((cif->rtype->size + 7) / 8 < N_X_ARG_REG)
+            {
+              unsigned size = ALIGN (cif->rtype->size, sizeof (UINT64)) ;
+              memcpy (get_x_addr (context, 0), rvalue, size);
+            }
+          else
+            {
+              FFI_ASSERT (0);
+            }
+          break;
+        default:
+          FFI_ASSERT (0);
+          break;
+        }
+    }
+  else
+    {
+      memcpy (&rvalue, get_x_addr (context, 8), sizeof (UINT64));
+      (closure->fun) (cif, rvalue, avalue, closure->user_data);
+    }
+}
+
diff --git a/src/aarch64/ffitarget.h b/src/aarch64/ffitarget.h
new file mode 100644 (file)
index 0000000..6f1a348
--- /dev/null
@@ -0,0 +1,59 @@
+/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+``Software''), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
+
+#ifndef LIBFFI_TARGET_H
+#define LIBFFI_TARGET_H
+
+#ifndef LIBFFI_H
+#error "Please do not include ffitarget.h directly into your source.  Use ffi.h instead."
+#endif
+
+#ifndef LIBFFI_ASM
+typedef unsigned long ffi_arg;
+typedef signed long ffi_sarg;
+
+typedef enum ffi_abi
+  {
+    FFI_FIRST_ABI = 0,
+    FFI_SYSV,
+    FFI_LAST_ABI,
+    FFI_DEFAULT_ABI = FFI_SYSV
+  } ffi_abi;
+#endif
+
+/* ---- Definitions for closures ----------------------------------------- */
+
+#define FFI_CLOSURES 1
+#define FFI_TRAMPOLINE_SIZE 36
+#define FFI_NATIVE_RAW_API 0
+
+/* ---- Internal ---- */
+
+
+#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_flags
+
+#define AARCH64_FFI_WITH_V_BIT 0
+
+#define AARCH64_N_XREG 32
+#define AARCH64_N_VREG 32
+#define AARCH64_CALL_CONTEXT_SIZE (AARCH64_N_XREG * 8 + AARCH64_N_VREG * 16)
+
+#endif
diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S
new file mode 100644 (file)
index 0000000..b8cd421
--- /dev/null
@@ -0,0 +1,307 @@
+/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+``Software''), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
+
+#define LIBFFI_ASM
+#include <fficonfig.h>
+#include <ffi.h>
+
+#define cfi_adjust_cfa_offset(off)     .cfi_adjust_cfa_offset off
+#define cfi_rel_offset(reg, off)       .cfi_rel_offset reg, off
+#define cfi_restore(reg)               .cfi_restore reg
+#define cfi_def_cfa_register(reg)      .cfi_def_cfa_register reg
+
+        .text
+        .globl ffi_call_SYSV
+        .type ffi_call_SYSV, #function
+
+/* ffi_call_SYSV()
+
+   Create a stack frame, setup an argument context, call the callee
+   and extract the result.
+
+   The maximum required argument stack size is provided,
+   ffi_call_SYSV() allocates that stack space then calls the
+   prepare_fn to populate register context and stack.  The
+   argument passing registers are loaded from the register
+   context and the callee called, on return the register passing
+   register are saved back to the context.  Our caller will
+   extract the return value from the final state of the saved
+   register context.
+
+   Prototype:
+
+   extern unsigned
+   ffi_call_SYSV (void (*)(struct call_context *context, unsigned char *,
+                          extended_cif *),
+                  struct call_context *context,
+                  extended_cif *,
+                  unsigned required_stack_size,
+                  void (*fn)(void));
+
+   Therefore on entry we have:
+
+   x0 prepare_fn
+   x1 &context
+   x2 &ecif
+   x3 bytes
+   x4 fn
+
+   This function uses the following stack frame layout:
+
+   ==
+                saved x30(lr)
+   x29(fp)->    saved x29(fp)
+                saved x24
+                saved x23
+                saved x22
+   sp'    ->    saved x21
+                ...
+   sp     ->    (constructed callee stack arguments)
+   ==
+
+   Voila! */
+
+#define ffi_call_SYSV_FS (8 * 4)
+
+        .cfi_startproc
+ffi_call_SYSV:
+        stp     x29, x30, [sp, #-16]!
+       cfi_adjust_cfa_offset (16)
+        cfi_rel_offset (x29, 0)
+        cfi_rel_offset (x30, 8)
+
+        mov     x29, sp
+       cfi_def_cfa_register (x29)
+        sub     sp, sp, #ffi_call_SYSV_FS
+
+        stp     x21, x22, [sp, 0]
+        cfi_rel_offset (x21, 0 - ffi_call_SYSV_FS)
+        cfi_rel_offset (x22, 8 - ffi_call_SYSV_FS)
+
+        stp     x23, x24, [sp, 16]
+        cfi_rel_offset (x23, 16 - ffi_call_SYSV_FS)
+        cfi_rel_offset (x24, 24 - ffi_call_SYSV_FS)
+
+        mov     x21, x1
+        mov     x22, x2
+        mov     x24, x4
+
+        /* Allocate the stack space for the actual arguments, many
+           arguments will be passed in registers, but we assume
+           worst case and allocate sufficient stack for ALL of
+           the arguments.  */
+        sub     sp, sp, x3
+
+        /* unsigned (*prepare_fn) (struct call_context *context,
+                                  unsigned char *stack, extended_cif *ecif);
+        */
+        mov     x23, x0
+        mov     x0, x1
+        mov     x1, sp
+        /* x2 already in place */
+        blr     x23
+
+        /* Preserve the flags returned.  */
+        mov     x23, x0
+
+        /* Figure out if we should touch the vector registers.  */
+        tbz     x23, #AARCH64_FFI_WITH_V_BIT, 1f
+
+        /* Load the vector argument passing registers.  */
+        ldp     q0, q1, [x21, #8*32 +  0]
+        ldp     q2, q3, [x21, #8*32 + 32]
+        ldp     q4, q5, [x21, #8*32 + 64]
+        ldp     q6, q7, [x21, #8*32 + 96]
+1:
+        /* Load the core argument passing registers.  */
+        ldp     x0, x1, [x21,  #0]
+        ldp     x2, x3, [x21, #16]
+        ldp     x4, x5, [x21, #32]
+        ldp     x6, x7, [x21, #48]
+
+        /* Don't forget x8 which may be holding the address of a return buffer.
+        */
+        ldr     x8,     [x21, #8*8]
+
+        blr     x24
+
+        /* Save the core argument passing registers.  */
+        stp     x0, x1, [x21,  #0]
+        stp     x2, x3, [x21, #16]
+        stp     x4, x5, [x21, #32]
+        stp     x6, x7, [x21, #48]
+
+        /* Note nothing useful ever comes back in x8!  */
+
+        /* Figure out if we should touch the vector registers.  */
+        tbz     x23, #AARCH64_FFI_WITH_V_BIT, 1f
+
+        /* Save the vector argument passing registers.  */
+        stp     q0, q1, [x21, #8*32 + 0]
+        stp     q2, q3, [x21, #8*32 + 32]
+        stp     q4, q5, [x21, #8*32 + 64]
+        stp     q6, q7, [x21, #8*32 + 96]
+1:
+        /* All done, unwind our stack frame.  */
+        ldp     x21, x22, [x29,  # - ffi_call_SYSV_FS]
+        cfi_restore (x21)
+        cfi_restore (x22)
+
+        ldp     x23, x24, [x29,  # - ffi_call_SYSV_FS + 16]
+        cfi_restore (x23)
+        cfi_restore (x24)
+
+        mov     sp, x29
+       cfi_def_cfa_register (sp)
+
+        ldp     x29, x30, [sp], #16
+       cfi_adjust_cfa_offset (-16)
+        cfi_restore (x29)
+        cfi_restore (x30)
+
+        ret
+
+        .cfi_endproc
+        .size ffi_call_SYSV, .-ffi_call_SYSV
+
+#define ffi_closure_SYSV_FS (8 * 2 + AARCH64_CALL_CONTEXT_SIZE)
+
+/* ffi_closure_SYSV
+
+   Closure invocation glue. This is the low level code invoked directly by
+   the closure trampoline to setup and call a closure.
+
+   On entry x17 points to a struct trampoline_data, x16 has been clobbered
+   all other registers are preserved.
+
+   We allocate a call context and save the argument passing registers,
+   then invoked the generic C ffi_closure_SYSV_inner() function to do all
+   the real work, on return we load the result passing registers back from
+   the call context.
+
+   On entry
+
+   extern void
+   ffi_closure_SYSV (struct trampoline_data *);
+
+   struct trampoline_data
+   {
+        UINT64 *ffi_closure;
+        UINT64 flags;
+   };
+
+   This function uses the following stack frame layout:
+
+   ==
+                saved x30(lr)
+   x29(fp)->    saved x29(fp)
+                saved x22
+                saved x21
+                ...
+   sp     ->    call_context
+   ==
+
+   Voila!  */
+
+        .text
+        .globl ffi_closure_SYSV
+        .cfi_startproc
+ffi_closure_SYSV:
+        stp     x29, x30, [sp, #-16]!
+       cfi_adjust_cfa_offset (16)
+        cfi_rel_offset (x29, 0)
+        cfi_rel_offset (x30, 8)
+
+        mov     x29, sp
+
+        sub     sp, sp, #ffi_closure_SYSV_FS
+       cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
+
+        stp     x21, x22, [x29, #-16]
+        cfi_rel_offset (x21, 0)
+        cfi_rel_offset (x22, 8)
+
+        /* Load x21 with &call_context.  */
+        mov     x21, sp
+        /* Preserve our struct trampoline_data *  */
+        mov     x22, x17
+
+        /* Save the rest of the argument passing registers.  */
+        stp     x0, x1, [x21, #0]
+        stp     x2, x3, [x21, #16]
+        stp     x4, x5, [x21, #32]
+        stp     x6, x7, [x21, #48]
+        /* Don't forget we may have been given a result scratch pad address.
+        */
+        str     x8,     [x21, #64]
+
+        /* Figure out if we should touch the vector registers.  */
+        ldr     x0, [x22, #8]
+        tbz     x0, #AARCH64_FFI_WITH_V_BIT, 1f
+
+        /* Save the argument passing vector registers.  */
+        stp     q0, q1, [x21, #8*32 + 0]
+        stp     q2, q3, [x21, #8*32 + 32]
+        stp     q4, q5, [x21, #8*32 + 64]
+        stp     q6, q7, [x21, #8*32 + 96]
+1:
+        /* Load &ffi_closure..  */
+        ldr     x0, [x22, #0]
+        mov     x1, x21
+        /* Compute the location of the stack at the point that the
+           trampoline was called.  */
+        add     x2, x29, #16
+
+        bl      ffi_closure_SYSV_inner
+
+        /* Figure out if we should touch the vector registers.  */
+        ldr     x0, [x22, #8]
+        tbz     x0, #AARCH64_FFI_WITH_V_BIT, 1f
+
+        /* Load the result passing vector registers.  */
+        ldp     q0, q1, [x21, #8*32 + 0]
+        ldp     q2, q3, [x21, #8*32 + 32]
+        ldp     q4, q5, [x21, #8*32 + 64]
+        ldp     q6, q7, [x21, #8*32 + 96]
+1:
+        /* Load the result passing core registers.  */
+        ldp     x0, x1, [x21,  #0]
+        ldp     x2, x3, [x21, #16]
+        ldp     x4, x5, [x21, #32]
+        ldp     x6, x7, [x21, #48]
+        /* Note nothing usefull is returned in x8.  */
+
+        /* We are done, unwind our frame.  */
+        ldp     x21, x22, [x29,  #-16]
+        cfi_restore (x21)
+        cfi_restore (x22)
+
+        mov     sp, x29
+       cfi_adjust_cfa_offset (-ffi_closure_SYSV_FS)
+
+        ldp     x29, x30, [sp], #16
+       cfi_adjust_cfa_offset (-16)
+        cfi_restore (x29)
+        cfi_restore (x30)
+
+        ret
+        .cfi_endproc
+        .size ffi_closure_SYSV, .-ffi_closure_SYSV
index 4a65ed195b34d782ca1210bda568b523aab25f10..8ee3f1509fcb80e1ef97bd4e82e950fc9bacf10f 100644 (file)
@@ -203,6 +203,10 @@ proc libffi_target_compile { source dest type options } {
 
     lappend options "libs= -lffi"
 
+    if { [string match "aarch64*-*-linux*" $target_triplet] } {
+       lappend options "libs= -lpthread"
+    }
+
     verbose "options: $options"
     return [target_compile $source $dest $type $options]
 }
diff --git a/testsuite/libffi.call/cls_struct_va1.c b/testsuite/libffi.call/cls_struct_va1.c
new file mode 100644 (file)
index 0000000..91772bd
--- /dev/null
@@ -0,0 +1,114 @@
+/* Area:               ffi_call, closure_call
+   Purpose:            Test doubles passed in variable argument lists.
+   Limitations:        none.
+   PR:                 none.
+   Originator: Blake Chaffin 6/6/2007   */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+#include "ffitest.h"
+
+struct small_tag
+{
+  unsigned char a;
+  unsigned char b;
+};
+
+struct large_tag
+{
+  unsigned a;
+  unsigned b;
+  unsigned c;
+  unsigned d;
+  unsigned e;
+};
+
+static void
+test_fn (ffi_cif* cif __UNUSED__, void* resp,
+        void** args, void* userdata __UNUSED__)
+{
+  int n = *(int*)args[0];
+  struct small_tag s1 = * (struct small_tag *) args[1];
+  struct large_tag l1 = * (struct large_tag *) args[2];
+  struct small_tag s2 = * (struct small_tag *) args[3];
+
+  printf ("%d %d %d %d %d %d %d %d %d %d\n", n, s1.a, s1.b,
+         l1.a, l1.b, l1.c, l1.d, l1.e,
+         s2.a, s2.b);
+  * (int*) resp = 42;
+}
+
+int
+main (void)
+{
+  ffi_cif cif;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc (sizeof (ffi_closure), &code);
+  ffi_type* arg_types[5];
+
+  ffi_arg res = 0;
+
+  ffi_type s_type;
+  ffi_type *s_type_elements[3];
+
+  ffi_type l_type;
+  ffi_type *l_type_elements[6];
+
+  struct small_tag s1;
+  struct small_tag s2;
+  struct large_tag l1;
+
+  int si;
+
+  s_type.size = 0;
+  s_type.alignment = 0;
+  s_type.type = FFI_TYPE_STRUCT;
+  s_type.elements = s_type_elements;
+
+  s_type_elements[0] = &ffi_type_uchar;
+  s_type_elements[1] = &ffi_type_uchar;
+  s_type_elements[2] = NULL;
+
+  l_type.size = 0;
+  l_type.alignment = 0;
+  l_type.type = FFI_TYPE_STRUCT;
+  l_type.elements = l_type_elements;
+
+  l_type_elements[0] = &ffi_type_uint;
+  l_type_elements[1] = &ffi_type_uint;
+  l_type_elements[2] = &ffi_type_uint;
+  l_type_elements[3] = &ffi_type_uint;
+  l_type_elements[4] = &ffi_type_uint;
+  l_type_elements[5] = NULL;
+
+  arg_types[0] = &ffi_type_sint;
+  arg_types[1] = &s_type;
+  arg_types[2] = &l_type;
+  arg_types[3] = &s_type;
+  arg_types[4] = NULL;
+
+  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint,
+                        arg_types) == FFI_OK);
+
+  si = 4;
+  s1.a = 5;
+  s1.b = 6;
+
+  s2.a = 20;
+  s2.b = 21;
+
+  l1.a = 10;
+  l1.b = 11;
+  l1.c = 12;
+  l1.d = 13;
+  l1.e = 14;
+
+  CHECK(ffi_prep_closure_loc(pcl, &cif, test_fn, NULL, code) == FFI_OK);
+
+  res = ((int (*)(int, ...))(code))(si, s1, l1, s2);
+  // { dg-output "4 5 6 10 11 12 13 14 20 21" }
+  printf("res: %d\n", (int) res);
+  // { dg-output "\nres: 42" }
+
+  exit(0);
+}
diff --git a/testsuite/libffi.call/cls_uchar_va.c b/testsuite/libffi.call/cls_uchar_va.c
new file mode 100644 (file)
index 0000000..19cd4f3
--- /dev/null
@@ -0,0 +1,44 @@
+/* Area:       closure_call
+   Purpose:    Test anonymous unsigned char argument.
+   Limitations:        none.
+   PR:         none.
+   Originator: ARM Ltd. */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef unsigned char T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+                        void* userdata __UNUSED__)
+ {
+   *(T *)resp = *(T *)args[0];
+
+   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+  ffi_cif cif;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+  ffi_type * cl_arg_types[3];
+  T res;
+
+  cl_arg_types[0] = &ffi_type_uchar;
+  cl_arg_types[1] = &ffi_type_uchar;
+  cl_arg_types[2] = NULL;
+
+  /* Initialize the cif */
+  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+                        &ffi_type_uchar, cl_arg_types) == FFI_OK);
+
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code)  == FFI_OK);
+  res = ((((cls_ret_T)code)(67, 4)));
+  /* { dg-output "67: 67 4" } */
+  printf("res: %d\n", res);
+  /* { dg-output "\nres: 67" } */
+  exit(0);
+}
diff --git a/testsuite/libffi.call/cls_uint_va.c b/testsuite/libffi.call/cls_uint_va.c
new file mode 100644 (file)
index 0000000..150fddd
--- /dev/null
@@ -0,0 +1,45 @@
+/* Area:       closure_call
+   Purpose:    Test anonymous unsigned int argument.
+   Limitations:        none.
+   PR:         none.
+   Originator: ARM Ltd. */
+
+/* { dg-do run } */
+
+#include "ffitest.h"
+
+typedef unsigned int T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+                        void* userdata __UNUSED__)
+ {
+   *(T *)resp = *(T *)args[0];
+
+   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+  ffi_cif cif;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+  ffi_type * cl_arg_types[3];
+  T res;
+
+  cl_arg_types[0] = &ffi_type_uint;
+  cl_arg_types[1] = &ffi_type_uint;
+  cl_arg_types[2] = NULL;
+
+  /* Initialize the cif */
+  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+                        &ffi_type_uint, cl_arg_types) == FFI_OK);
+
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code)  == FFI_OK);
+  res = ((((cls_ret_T)code)(67, 4)));
+  /* { dg-output "67: 67 4" } */
+  printf("res: %d\n", res);
+  /* { dg-output "\nres: 67" } */
+  exit(0);
+}
diff --git a/testsuite/libffi.call/cls_ulong_va.c b/testsuite/libffi.call/cls_ulong_va.c
new file mode 100644 (file)
index 0000000..0315082
--- /dev/null
@@ -0,0 +1,45 @@
+/* Area:       closure_call
+   Purpose:    Test anonymous unsigned long argument.
+   Limitations:        none.
+   PR:         none.
+   Originator: ARM Ltd. */
+
+/* { dg-do run } */
+
+#include "ffitest.h"
+
+typedef unsigned long T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+                        void* userdata __UNUSED__)
+ {
+   *(T *)resp = *(T *)args[0];
+
+   printf("%ld: %ld %ld\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+  ffi_cif cif;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+  ffi_type * cl_arg_types[3];
+  T res;
+
+  cl_arg_types[0] = &ffi_type_ulong;
+  cl_arg_types[1] = &ffi_type_ulong;
+  cl_arg_types[2] = NULL;
+
+  /* Initialize the cif */
+  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+                        &ffi_type_ulong, cl_arg_types) == FFI_OK);
+
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code)  == FFI_OK);
+  res = ((((cls_ret_T)code)(67, 4)));
+  /* { dg-output "67: 67 4" } */
+  printf("res: %ld\n", res);
+  /* { dg-output "\nres: 67" } */
+  exit(0);
+}
diff --git a/testsuite/libffi.call/cls_ushort_va.c b/testsuite/libffi.call/cls_ushort_va.c
new file mode 100644 (file)
index 0000000..b2b5a3b
--- /dev/null
@@ -0,0 +1,44 @@
+/* Area:       closure_call
+   Purpose:    Test anonymous unsigned short argument.
+   Limitations:        none.
+   PR:         none.
+   Originator: ARM Ltd. */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef unsigned short T;
+
+static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
+                        void* userdata __UNUSED__)
+ {
+   *(T *)resp = *(T *)args[0];
+
+   printf("%d: %d %d\n", *(T *)resp, *(T *)args[0], *(T *)args[1]);
+ }
+
+typedef T (*cls_ret_T)(T, ...);
+
+int main (void)
+{
+  ffi_cif cif;
+  void *code;
+  ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
+  ffi_type * cl_arg_types[3];
+  T res;
+
+  cl_arg_types[0] = &ffi_type_ushort;
+  cl_arg_types[1] = &ffi_type_ushort;
+  cl_arg_types[2] = NULL;
+
+  /* Initialize the cif */
+  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2,
+                        &ffi_type_ushort, cl_arg_types) == FFI_OK);
+
+  CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code)  == FFI_OK);
+  res = ((((cls_ret_T)code)(67, 4)));
+  /* { dg-output "67: 67 4" } */
+  printf("res: %d\n", res);
+  /* { dg-output "\nres: 67" } */
+  exit(0);
+}
diff --git a/testsuite/libffi.call/nested_struct11.c b/testsuite/libffi.call/nested_struct11.c
new file mode 100644 (file)
index 0000000..fce6948
--- /dev/null
@@ -0,0 +1,121 @@
+/* Area:       ffi_call, closure_call
+   Purpose:    Check parameter passing with nested structs
+               of a single type.  This tests the special cases
+               for homogenous floating-point aggregates in the
+               AArch64 PCS.
+   Limitations:        none.
+   PR:         none.
+   Originator:  ARM Ltd.  */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef struct A {
+  float a_x;
+  float a_y;
+} A;
+
+typedef struct B {
+  float b_x;
+  float b_y;
+} B;
+
+typedef struct C {
+  A a;
+  B b;
+} C;
+
+static C C_fn (int x, int y, int z, C source, int i, int j, int k)
+{
+  C result;
+  result.a.a_x = source.a.a_x;
+  result.a.a_y = source.a.a_y;
+  result.b.b_x = source.b.b_x;
+  result.b.b_y = source.b.b_y;
+
+  printf ("%d, %d, %d, %d, %d, %d\n", x, y, z, i, j, k);
+
+  printf ("%.1f, %.1f, %.1f, %.1f, "
+         "%.1f, %.1f, %.1f, %.1f\n",
+         source.a.a_x, source.a.a_y,
+         source.b.b_x, source.b.b_y,
+         result.a.a_x, result.a.a_y,
+         result.b.b_x, result.b.b_y);
+
+  return result;
+}
+
+int main (void)
+{
+  ffi_cif cif;
+
+  ffi_type* struct_fields_source_a[3];
+  ffi_type* struct_fields_source_b[3];
+  ffi_type* struct_fields_source_c[3];
+  ffi_type* arg_types[8];
+
+  ffi_type struct_type_a, struct_type_b, struct_type_c;
+
+  struct A source_fld_a = {1.0, 2.0};
+  struct B source_fld_b = {4.0, 8.0};
+  int k = 1;
+
+  struct C result;
+  struct C source = {source_fld_a, source_fld_b};
+
+  struct_type_a.size = 0;
+  struct_type_a.alignment = 0;
+  struct_type_a.type = FFI_TYPE_STRUCT;
+  struct_type_a.elements = struct_fields_source_a;
+
+  struct_type_b.size = 0;
+  struct_type_b.alignment = 0;
+  struct_type_b.type = FFI_TYPE_STRUCT;
+  struct_type_b.elements = struct_fields_source_b;
+
+  struct_type_c.size = 0;
+  struct_type_c.alignment = 0;
+  struct_type_c.type = FFI_TYPE_STRUCT;
+  struct_type_c.elements = struct_fields_source_c;
+
+  struct_fields_source_a[0] = &ffi_type_float;
+  struct_fields_source_a[1] = &ffi_type_float;
+  struct_fields_source_a[2] = NULL;
+
+  struct_fields_source_b[0] = &ffi_type_float;
+  struct_fields_source_b[1] = &ffi_type_float;
+  struct_fields_source_b[2] = NULL;
+
+  struct_fields_source_c[0] = &struct_type_a;
+  struct_fields_source_c[1] = &struct_type_b;
+  struct_fields_source_c[2] = NULL;
+
+  arg_types[0] = &ffi_type_sint32;
+  arg_types[1] = &ffi_type_sint32;
+  arg_types[2] = &ffi_type_sint32;
+  arg_types[3] = &struct_type_c;
+  arg_types[4] = &ffi_type_sint32;
+  arg_types[5] = &ffi_type_sint32;
+  arg_types[6] = &ffi_type_sint32;
+  arg_types[7] = NULL;
+
+  void *args[7];
+  args[0] = &k;
+  args[1] = &k;
+  args[2] = &k;
+  args[3] = &source;
+  args[4] = &k;
+  args[5] = &k;
+  args[6] = &k;
+  CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 7, &struct_type_c,
+                      arg_types) == FFI_OK);
+
+  ffi_call (&cif, FFI_FN (C_fn), &result, args);
+  /* { dg-output "1, 1, 1, 1, 1, 1\n" } */
+  /* { dg-output "1.0, 2.0, 4.0, 8.0, 1.0, 2.0, 4.0, 8.0" } */
+  CHECK (result.a.a_x == source.a.a_x);
+  CHECK (result.a.a_y == source.a.a_y);
+  CHECK (result.b.b_x == source.b.b_x);
+  CHECK (result.b.b_y == source.b.b_y);
+  exit (0);
+}
diff --git a/testsuite/libffi.call/uninitialized.c b/testsuite/libffi.call/uninitialized.c
new file mode 100644 (file)
index 0000000..f00d830
--- /dev/null
@@ -0,0 +1,61 @@
+/* { dg-do run } */
+#include "ffitest.h"
+
+typedef struct
+{
+  unsigned char uc;
+  double d;
+  unsigned int ui;
+} test_structure_1;
+
+static test_structure_1 struct1(test_structure_1 ts)
+{
+  ts.uc++;
+  ts.d--;
+  ts.ui++;
+
+  return ts;
+}
+
+int main (void)
+{
+  ffi_cif cif;
+  ffi_type *args[MAX_ARGS];
+  void *values[MAX_ARGS];
+  ffi_type ts1_type;
+  ffi_type *ts1_type_elements[4];
+
+  memset(&cif, 1, sizeof(cif));
+  ts1_type.size = 0;
+  ts1_type.alignment = 0;
+  ts1_type.type = FFI_TYPE_STRUCT;
+  ts1_type.elements = ts1_type_elements;
+  ts1_type_elements[0] = &ffi_type_uchar;
+  ts1_type_elements[1] = &ffi_type_double;
+  ts1_type_elements[2] = &ffi_type_uint;
+  ts1_type_elements[3] = NULL;
+
+  test_structure_1 ts1_arg;
+  /* This is a hack to get a properly aligned result buffer */
+  test_structure_1 *ts1_result =
+    (test_structure_1 *) malloc (sizeof(test_structure_1));
+
+  args[0] = &ts1_type;
+  values[0] = &ts1_arg;
+
+  /* Initialize the cif */
+  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
+                    &ts1_type, args) == FFI_OK);
+
+  ts1_arg.uc = '\x01';
+  ts1_arg.d = 3.14159;
+  ts1_arg.ui = 555;
+
+  ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
+
+  CHECK(ts1_result->ui == 556);
+  CHECK(ts1_result->d == 3.14159 - 1);
+
+  free (ts1_result);
+  exit(0);
+}
diff --git a/testsuite/libffi.call/va_1.c b/testsuite/libffi.call/va_1.c
new file mode 100644 (file)
index 0000000..5c7cce9
--- /dev/null
@@ -0,0 +1,196 @@
+/* Area:               ffi_call
+   Purpose:            Test passing struct in variable argument lists.
+   Limitations:        none.
+   PR:                 none.
+   Originator:         ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* x86_64-*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+  unsigned char a;
+  unsigned char b;
+};
+
+struct large_tag
+{
+  unsigned a;
+  unsigned b;
+  unsigned c;
+  unsigned d;
+  unsigned e;
+};
+
+static int
+test_fn (int n, ...)
+{
+  va_list ap;
+  struct small_tag s1;
+  struct small_tag s2;
+  struct large_tag l;
+  unsigned char uc;
+  signed char sc;
+  unsigned short us;
+  signed short ss;
+  unsigned int ui;
+  signed int si;
+  unsigned long ul;
+  signed long sl;
+  float f;
+  double d;
+
+  va_start (ap, n);
+  s1 = va_arg (ap, struct small_tag);
+  l = va_arg (ap, struct large_tag);
+  s2 = va_arg (ap, struct small_tag);
+
+  uc = va_arg (ap, unsigned);
+  sc = va_arg (ap, signed);
+
+  us = va_arg (ap, unsigned);
+  ss = va_arg (ap, signed);
+
+  ui = va_arg (ap, unsigned int);
+  si = va_arg (ap, signed int);
+
+  ul = va_arg (ap, unsigned long);
+  sl = va_arg (ap, signed long);
+
+  f = va_arg (ap, double);     /* C standard promotes float->double
+                                  when anonymous */
+  d = va_arg (ap, double);
+
+  printf ("%u %u %u %u %u %u %u %u %u uc=%u sc=%d %u %d %u %d %lu %ld %f %f\n",
+         s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+         s2.a, s2.b,
+         uc, sc,
+         us, ss,
+         ui, si,
+         ul, sl,
+         f, d);
+  va_end (ap);
+  return n + 1;
+}
+
+int
+main (void)
+{
+  ffi_cif cif;
+  void* args[15];
+  ffi_type* arg_types[15];
+
+  ffi_type s_type;
+  ffi_type *s_type_elements[3];
+
+  ffi_type l_type;
+  ffi_type *l_type_elements[6];
+
+  struct small_tag s1;
+  struct small_tag s2;
+  struct large_tag l1;
+
+  int n;
+  int res;
+
+  unsigned char uc;
+  signed char sc;
+  unsigned short us;
+  signed short ss;
+  unsigned int ui;
+  signed int si;
+  unsigned long ul;
+  signed long sl;
+  double d1;
+  double f1;
+
+  s_type.size = 0;
+  s_type.alignment = 0;
+  s_type.type = FFI_TYPE_STRUCT;
+  s_type.elements = s_type_elements;
+
+  s_type_elements[0] = &ffi_type_uchar;
+  s_type_elements[1] = &ffi_type_uchar;
+  s_type_elements[2] = NULL;
+
+  l_type.size = 0;
+  l_type.alignment = 0;
+  l_type.type = FFI_TYPE_STRUCT;
+  l_type.elements = l_type_elements;
+
+  l_type_elements[0] = &ffi_type_uint;
+  l_type_elements[1] = &ffi_type_uint;
+  l_type_elements[2] = &ffi_type_uint;
+  l_type_elements[3] = &ffi_type_uint;
+  l_type_elements[4] = &ffi_type_uint;
+  l_type_elements[5] = NULL;
+
+  arg_types[0] = &ffi_type_sint;
+  arg_types[1] = &s_type;
+  arg_types[2] = &l_type;
+  arg_types[3] = &s_type;
+  arg_types[4] = &ffi_type_uint;
+  arg_types[5] = &ffi_type_sint;
+  arg_types[6] = &ffi_type_uint;
+  arg_types[7] = &ffi_type_sint;
+  arg_types[8] = &ffi_type_uint;
+  arg_types[9] = &ffi_type_sint;
+  arg_types[10] = &ffi_type_ulong;
+  arg_types[11] = &ffi_type_slong;
+  arg_types[12] = &ffi_type_double;
+  arg_types[13] = &ffi_type_double;
+  arg_types[14] = NULL;
+
+  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 14, &ffi_type_sint, arg_types) == FFI_OK);
+
+  s1.a = 5;
+  s1.b = 6;
+
+  l1.a = 10;
+  l1.b = 11;
+  l1.c = 12;
+  l1.d = 13;
+  l1.e = 14;
+
+  s2.a = 7;
+  s2.b = 8;
+
+  n = 41;
+
+  uc = 9;
+  sc = 10;
+  us = 11;
+  ss = 12;
+  ui = 13;
+  si = 14;
+  ul = 15;
+  sl = 16;
+  f1 = 2.12;
+  d1 = 3.13;
+
+  args[0] = &n;
+  args[1] = &s1;
+  args[2] = &l1;
+  args[3] = &s2;
+  args[4] = &uc;
+  args[5] = &sc;
+  args[6] = &us;
+  args[7] = &ss;
+  args[8] = &ui;
+  args[9] = &si;
+  args[10] = &ul;
+  args[11] = &sl;
+  args[12] = &f1;
+  args[13] = &d1;
+  args[14] = NULL;
+
+  ffi_call(&cif, FFI_FN(test_fn), &res, args);
+  /* { dg-output "5 6 10 11 12 13 14 7 8 uc=9 sc=10 11 12 13 14 15 16 2.120000 3.130000" } */
+  printf("res: %d\n", (int) res);
+  /* { dg-output "\nres: 42" } */
+
+  return 0;
+}
diff --git a/testsuite/libffi.call/va_struct1.c b/testsuite/libffi.call/va_struct1.c
new file mode 100644 (file)
index 0000000..11d1f10
--- /dev/null
@@ -0,0 +1,121 @@
+/* Area:               ffi_call
+   Purpose:            Test passing struct in variable argument lists.
+   Limitations:        none.
+   PR:                 none.
+   Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+  unsigned char a;
+  unsigned char b;
+};
+
+struct large_tag
+{
+  unsigned a;
+  unsigned b;
+  unsigned c;
+  unsigned d;
+  unsigned e;
+};
+
+static int
+test_fn (int n, ...)
+{
+  va_list ap;
+  struct small_tag s1;
+  struct small_tag s2;
+  struct large_tag l;
+
+  va_start (ap, n);
+  s1 = va_arg (ap, struct small_tag);
+  l = va_arg (ap, struct large_tag);
+  s2 = va_arg (ap, struct small_tag);
+  printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+         s2.a, s2.b);
+  va_end (ap);
+  return n + 1;
+}
+
+int
+main (void)
+{
+  ffi_cif cif;
+  void* args[5];
+  ffi_type* arg_types[5];
+
+  ffi_type s_type;
+  ffi_type *s_type_elements[3];
+
+  ffi_type l_type;
+  ffi_type *l_type_elements[6];
+
+  struct small_tag s1;
+  struct small_tag s2;
+  struct large_tag l1;
+
+  int n;
+  int res;
+
+  s_type.size = 0;
+  s_type.alignment = 0;
+  s_type.type = FFI_TYPE_STRUCT;
+  s_type.elements = s_type_elements;
+
+  s_type_elements[0] = &ffi_type_uchar;
+  s_type_elements[1] = &ffi_type_uchar;
+  s_type_elements[2] = NULL;
+
+  l_type.size = 0;
+  l_type.alignment = 0;
+  l_type.type = FFI_TYPE_STRUCT;
+  l_type.elements = l_type_elements;
+
+  l_type_elements[0] = &ffi_type_uint;
+  l_type_elements[1] = &ffi_type_uint;
+  l_type_elements[2] = &ffi_type_uint;
+  l_type_elements[3] = &ffi_type_uint;
+  l_type_elements[4] = &ffi_type_uint;
+  l_type_elements[5] = NULL;
+
+  arg_types[0] = &ffi_type_sint;
+  arg_types[1] = &s_type;
+  arg_types[2] = &l_type;
+  arg_types[3] = &s_type;
+  arg_types[4] = NULL;
+
+  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, arg_types) == FFI_OK);
+
+  s1.a = 5;
+  s1.b = 6;
+
+  l1.a = 10;
+  l1.b = 11;
+  l1.c = 12;
+  l1.d = 13;
+  l1.e = 14;
+
+  s2.a = 7;
+  s2.b = 8;
+
+  n = 41;
+
+  args[0] = &n;
+  args[1] = &s1;
+  args[2] = &l1;
+  args[3] = &s2;
+  args[4] = NULL;
+
+  ffi_call(&cif, FFI_FN(test_fn), &res, args);
+  /* { dg-output "5 6 10 11 12 13 14 7 8" } */
+  printf("res: %d\n", (int) res);
+  /* { dg-output "\nres: 42" } */
+
+  return 0;
+}
diff --git a/testsuite/libffi.call/va_struct2.c b/testsuite/libffi.call/va_struct2.c
new file mode 100644 (file)
index 0000000..56f5b9c
--- /dev/null
@@ -0,0 +1,123 @@
+/* Area:               ffi_call
+   Purpose:            Test passing struct in variable argument lists.
+   Limitations:        none.
+   PR:                 none.
+   Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+  unsigned char a;
+  unsigned char b;
+};
+
+struct large_tag
+{
+  unsigned a;
+  unsigned b;
+  unsigned c;
+  unsigned d;
+  unsigned e;
+};
+
+static struct small_tag
+test_fn (int n, ...)
+{
+  va_list ap;
+  struct small_tag s1;
+  struct small_tag s2;
+  struct large_tag l;
+
+  va_start (ap, n);
+  s1 = va_arg (ap, struct small_tag);
+  l = va_arg (ap, struct large_tag);
+  s2 = va_arg (ap, struct small_tag);
+  printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+         s2.a, s2.b);
+  va_end (ap);
+  s1.a += s2.a;
+  s1.b += s2.b;
+  return s1;
+}
+
+int
+main (void)
+{
+  ffi_cif cif;
+  void* args[5];
+  ffi_type* arg_types[5];
+
+  ffi_type s_type;
+  ffi_type *s_type_elements[3];
+
+  ffi_type l_type;
+  ffi_type *l_type_elements[6];
+
+  struct small_tag s1;
+  struct small_tag s2;
+  struct large_tag l1;
+
+  int n;
+  struct small_tag res;
+
+  s_type.size = 0;
+  s_type.alignment = 0;
+  s_type.type = FFI_TYPE_STRUCT;
+  s_type.elements = s_type_elements;
+
+  s_type_elements[0] = &ffi_type_uchar;
+  s_type_elements[1] = &ffi_type_uchar;
+  s_type_elements[2] = NULL;
+
+  l_type.size = 0;
+  l_type.alignment = 0;
+  l_type.type = FFI_TYPE_STRUCT;
+  l_type.elements = l_type_elements;
+
+  l_type_elements[0] = &ffi_type_uint;
+  l_type_elements[1] = &ffi_type_uint;
+  l_type_elements[2] = &ffi_type_uint;
+  l_type_elements[3] = &ffi_type_uint;
+  l_type_elements[4] = &ffi_type_uint;
+  l_type_elements[5] = NULL;
+
+  arg_types[0] = &ffi_type_sint;
+  arg_types[1] = &s_type;
+  arg_types[2] = &l_type;
+  arg_types[3] = &s_type;
+  arg_types[4] = NULL;
+
+  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &s_type, arg_types) == FFI_OK);
+
+  s1.a = 5;
+  s1.b = 6;
+
+  l1.a = 10;
+  l1.b = 11;
+  l1.c = 12;
+  l1.d = 13;
+  l1.e = 14;
+
+  s2.a = 7;
+  s2.b = 8;
+
+  n = 41;
+
+  args[0] = &n;
+  args[1] = &s1;
+  args[2] = &l1;
+  args[3] = &s2;
+  args[4] = NULL;
+
+  ffi_call(&cif, FFI_FN(test_fn), &res, args);
+  /* { dg-output "5 6 10 11 12 13 14 7 8" } */
+  printf("res: %d %d\n", res.a, res.b);
+  /* { dg-output "\nres: 12 14" } */
+
+  return 0;
+}
diff --git a/testsuite/libffi.call/va_struct3.c b/testsuite/libffi.call/va_struct3.c
new file mode 100644 (file)
index 0000000..9a27e7f
--- /dev/null
@@ -0,0 +1,125 @@
+/* Area:               ffi_call
+   Purpose:            Test passing struct in variable argument lists.
+   Limitations:        none.
+   PR:                 none.
+   Originator: ARM Ltd. */
+
+/* { dg-do run } */
+/* { dg-output "" { xfail avr32*-*-* } } */
+
+#include "ffitest.h"
+#include <stdarg.h>
+
+struct small_tag
+{
+  unsigned char a;
+  unsigned char b;
+};
+
+struct large_tag
+{
+  unsigned a;
+  unsigned b;
+  unsigned c;
+  unsigned d;
+  unsigned e;
+};
+
+static struct large_tag
+test_fn (int n, ...)
+{
+  va_list ap;
+  struct small_tag s1;
+  struct small_tag s2;
+  struct large_tag l;
+
+  va_start (ap, n);
+  s1 = va_arg (ap, struct small_tag);
+  l = va_arg (ap, struct large_tag);
+  s2 = va_arg (ap, struct small_tag);
+  printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e,
+         s2.a, s2.b);
+  va_end (ap);
+  l.a += s1.a;
+  l.b += s1.b;
+  l.c += s2.a;
+  l.d += s2.b;
+  return l;
+}
+
+int
+main (void)
+{
+  ffi_cif cif;
+  void* args[5];
+  ffi_type* arg_types[5];
+
+  ffi_type s_type;
+  ffi_type *s_type_elements[3];
+
+  ffi_type l_type;
+  ffi_type *l_type_elements[6];
+
+  struct small_tag s1;
+  struct small_tag s2;
+  struct large_tag l1;
+
+  int n;
+  struct large_tag res;
+
+  s_type.size = 0;
+  s_type.alignment = 0;
+  s_type.type = FFI_TYPE_STRUCT;
+  s_type.elements = s_type_elements;
+
+  s_type_elements[0] = &ffi_type_uchar;
+  s_type_elements[1] = &ffi_type_uchar;
+  s_type_elements[2] = NULL;
+
+  l_type.size = 0;
+  l_type.alignment = 0;
+  l_type.type = FFI_TYPE_STRUCT;
+  l_type.elements = l_type_elements;
+
+  l_type_elements[0] = &ffi_type_uint;
+  l_type_elements[1] = &ffi_type_uint;
+  l_type_elements[2] = &ffi_type_uint;
+  l_type_elements[3] = &ffi_type_uint;
+  l_type_elements[4] = &ffi_type_uint;
+  l_type_elements[5] = NULL;
+
+  arg_types[0] = &ffi_type_sint;
+  arg_types[1] = &s_type;
+  arg_types[2] = &l_type;
+  arg_types[3] = &s_type;
+  arg_types[4] = NULL;
+
+  CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &l_type, arg_types) == FFI_OK);
+
+  s1.a = 5;
+  s1.b = 6;
+
+  l1.a = 10;
+  l1.b = 11;
+  l1.c = 12;
+  l1.d = 13;
+  l1.e = 14;
+
+  s2.a = 7;
+  s2.b = 8;
+
+  n = 41;
+
+  args[0] = &n;
+  args[1] = &s1;
+  args[2] = &l1;
+  args[3] = &s2;
+  args[4] = NULL;
+
+  ffi_call(&cif, FFI_FN(test_fn), &res, args);
+  /* { dg-output "5 6 10 11 12 13 14 7 8" } */
+  printf("res: %d %d %d %d %d\n", res.a, res.b, res.c, res.d, res.e);
+  /* { dg-output "\nres: 15 17 19 21 14" } */
+
+  return 0;
+}