- Issue #17192: Import libffi-3.0.12.

This commit is contained in:
doko@ubuntu.com 2013-02-12 15:33:16 +01:00
parent 58cf4539b2
commit 38e2a2afbd
106 changed files with 12205 additions and 3010 deletions

View File

@ -806,6 +806,8 @@ Library
Extension Modules Extension Modules
----------------- -----------------
- Issue #17192: Import libffi-3.0.12.
- Issue #12268: The io module file object write methods no longer abort early - Issue #12268: The io module file object write methods no longer abort early
when one of its write system calls is interrupted (EINTR). when one of its write system calls is interrupted (EINTR).

View File

@ -1,5 +1,6 @@
--- libffi.orig/configure.ac 2012-04-12 05:10:51.000000000 +0200 diff -urN libffi.orig/configure.ac libffi/configure.ac
+++ libffi/configure.ac 2012-06-26 15:42:42.477498938 +0200 --- libffi.orig/configure.ac 2013-02-11 20:24:24.000000000 +0100
+++ libffi/configure.ac 2013-02-12 15:05:46.209844321 +0100
@@ -1,4 +1,7 @@ @@ -1,4 +1,7 @@
dnl Process this with autoconf to create configure dnl Process this with autoconf to create configure
+# +#
@ -8,17 +9,18 @@
AC_PREREQ(2.68) AC_PREREQ(2.68)
@@ -114,6 +117,9 @@ @@ -146,6 +149,10 @@
i?86-*-solaris2.1[[0-9]]*) fi
TARGET=X86_64; TARGETDIR=x86
;; ;;
+ i*86-*-nto-qnx*) + i*86-*-nto-qnx*)
+ TARGET=X86; TARGETDIR=x86 + TARGET=X86; TARGETDIR=x86
+ ;; + ;;
i?86-*-*) +
TARGET=X86_64; TARGETDIR=x86 x86_64-*-darwin*)
TARGET=X86_DARWIN; TARGETDIR=x86
;; ;;
@@ -131,12 +137,12 @@ @@ -200,12 +207,12 @@
;; ;;
mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
@ -32,17 +34,17 @@
+ TARGET=MIPS_IRIX; TARGETDIR=mips + TARGET=MIPS_IRIX; TARGETDIR=mips
;; ;;
moxie-*-*) powerpc*-*-linux* | powerpc-*-sysv*)
@@ -212,7 +218,7 @@ @@ -265,7 +272,7 @@
AC_MSG_ERROR(["libffi has not been ported to $host."]) AC_MSG_ERROR(["libffi has not been ported to $host."])
fi fi
-AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) -AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
+AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null]) +AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null])
AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN)
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86, test x$TARGET = xX86)
AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) @@ -562,4 +569,8 @@
@@ -499,4 +505,8 @@
AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc)
@ -51,9 +53,70 @@
+AC_CONFIG_FILES(fficonfig.py) +AC_CONFIG_FILES(fficonfig.py)
+ +
AC_OUTPUT AC_OUTPUT
--- libffi-3.0.11/fficonfig.py.in 1970-01-01 01:00:00.000000000 +0100 diff -urN libffi.orig/configure libffi/configure
+++ libffi/fficonfig.py.in 2012-03-15 01:04:27.000000000 +0100 --- libffi.orig/configure 2013-02-11 20:24:24.000000000 +0100
@@ -0,0 +1,35 @@ +++ libffi/configure 2013-02-12 15:11:42.353853081 +0100
@@ -13366,6 +13366,10 @@
fi
;;
+ i*86-*-nto-qnx*)
+ TARGET=X86; TARGETDIR=x86
+ ;;
+
x86_64-*-darwin*)
TARGET=X86_DARWIN; TARGETDIR=x86
;;
@@ -13420,12 +13424,12 @@
;;
mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
- TARGET=MIPS; TARGETDIR=mips
+ TARGET=MIPS_IRIX; TARGETDIR=mips
;;
mips*-*-linux* | mips*-*-openbsd*)
# Support 128-bit long double for NewABI.
HAVE_LONG_DOUBLE='defined(__mips64)'
- TARGET=MIPS; TARGETDIR=mips
+ TARGET=MIPS_IRIX; TARGETDIR=mips
;;
powerpc*-*-linux* | powerpc-*-sysv*)
@@ -13485,7 +13489,7 @@
as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5
fi
- if test x$TARGET = xMIPS; then
+ if expr x$TARGET : 'xMIPS' > /dev/null; then
MIPS_TRUE=
MIPS_FALSE='#'
else
@@ -14848,6 +14852,12 @@
ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc"
+ac_config_links="$ac_config_links include/ffi_common.h:include/ffi_common.h"
+
+
+ac_config_files="$ac_config_files fficonfig.py"
+
+
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -16029,6 +16039,8 @@
"testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
"man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
"libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;;
+ "include/ffi_common.h") CONFIG_LINKS="$CONFIG_LINKS include/ffi_common.h:include/ffi_common.h" ;;
+ "fficonfig.py") CONFIG_FILES="$CONFIG_FILES fficonfig.py" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
diff -urN libffi.orig/fficonfig.py.in libffi/fficonfig.py.in
--- libffi.orig/fficonfig.py.in 1970-01-01 01:00:00.000000000 +0100
+++ libffi/fficonfig.py.in 2013-02-12 15:11:24.589852644 +0100
@@ -0,0 +1,36 @@
+ffi_sources = """ +ffi_sources = """
+src/prep_cif.c +src/prep_cif.c
+src/closures.c +src/closures.c
@ -67,6 +130,7 @@
+ 'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'], + 'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'],
+ 'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'], + 'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'],
+ 'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'], + 'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'],
+ 'AARCH64': ['src/aarch64/ffi.c', 'src/aarch64/sysv.S'],
+ 'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'], + 'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'],
+ 'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'], + 'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'],
+ 'M32R': ['src/m32r/sysv.S', 'src/m32r/ffi.c'], + 'M32R': ['src/m32r/sysv.S', 'src/m32r/ffi.c'],
@ -89,9 +153,9 @@
+ffi_sources += ffi_platforms['@TARGET@'] +ffi_sources += ffi_platforms['@TARGET@']
+ +
+ffi_cflags = '@CFLAGS@' +ffi_cflags = '@CFLAGS@'
diff -urN libffi-3.0.11/src/dlmalloc.c libffi/src/dlmalloc.c diff -urN libffi.orig/src/dlmalloc.c libffi/src/dlmalloc.c
--- libffi-3.0.11/src/dlmalloc.c 2012-04-12 04:46:06.000000000 +0200 --- libffi.orig/src/dlmalloc.c 2013-02-11 20:24:18.000000000 +0100
+++ libffi/src/dlmalloc.c 2012-06-26 15:15:58.949547461 +0200 +++ libffi/src/dlmalloc.c 2013-02-12 15:15:12.113858241 +0100
@@ -457,6 +457,11 @@ @@ -457,6 +457,11 @@
#define LACKS_ERRNO_H #define LACKS_ERRNO_H
#define MALLOC_FAILURE_ACTION #define MALLOC_FAILURE_ACTION
@ -104,17 +168,3 @@ diff -urN libffi-3.0.11/src/dlmalloc.c libffi/src/dlmalloc.c
#endif /* WIN32 */ #endif /* WIN32 */
#ifdef __OS2__ #ifdef __OS2__
diff -urN libffi-3.0.11/src/sparc/v8.S libffi/src/sparc/v8.S
--- libffi-3.0.11/src/sparc/v8.S 2012-04-12 04:46:06.000000000 +0200
+++ libffi/src/sparc/v8.S 2011-03-13 05:15:04.000000000 +0100
@@ -213,6 +213,10 @@
be,a done1
ldd [%fp-8], %i0
+ cmp %o0, FFI_TYPE_UINT64
+ be,a done1
+ ldd [%fp-8], %i0
+
ld [%fp-8], %i0
done1:
jmp %i7+8

View File

@ -1,3 +1,393 @@
2013-02-11 Anthony Green <green@moxielogic.com>
* configure.ac: Update release number to 3.0.12.
* configure: Rebuilt.
* README: Update release info.
2013-02-10 Anthony Green <green@moxielogic.com>
* README: Add Moxie.
* src/moxie/ffi.c: Created.
* src/moxie/eabi.S: Created.
* src/moxie/ffitarget.h: Created.
* Makefile.am (nodist_libffi_la_SOURCES): Add Moxie.
* Makefile.in: Rebuilt.
* configure.ac: Add Moxie.
* configure: Rebuilt.
* testsuite/libffi.call/huge_struct.c: Disable format string
warnings for moxie*-*-elf tests.
2013-02-10 Anthony Green <green@moxielogic.com>
* Makefile.am (LTLDFLAGS): Fix reference.
* Makefile.in: Rebuilt.
2013-02-10 Anthony Green <green@moxielogic.com>
* README: Update supported platforms. Update test results link.
2013-02-09 Anthony Green <green@moxielogic.com>
* testsuite/libffi.call/negint.c: Remove forced -O2.
* testsuite/libffi.call/many2.c (foo): Remove GCCism.
* testsuite/libffi.call/ffitest.h: Add default PRIuPTR definition.
* src/sparc/v8.S (ffi_closure_v8): Import ancient ulonglong
closure return type fix developed by Martin v. Löwis for cpython
fork.
2013-02-08 Andreas Tobler <andreast@fgznet.ch>
* src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix small struct
support.
* src/powerpc/sysv.S: Ditto.
2013-02-08 Anthony Green <green@moxielogic.com>
* testsuite/libffi.call/cls_longdouble.c: Remove xfail for
arm*-*-*.
2013-02-08 Anthony Green <green@moxielogic.com>
* src/sparc/ffi.c (ffi_prep_closure_loc): Fix cache flushing for GCC.
2013-02-08 Matthias Klose <doko@ubuntu.com>
* man/ffi_prep_cif.3: Clean up for debian linter.
2013-02-08 Peter Bergner <bergner@vnet.ibm.com>
* src/powerpc/ffi.c (ffi_prep_args_SYSV): Account for FP args pushed
on the stack.
2013-02-08 Anthony Green <green@moxielogic.com>
* Makefile.am (EXTRA_DIST): Add missing files.
* testsuite/Makefile.am (EXTRA_DIST): Ditto.
* Makefile.in: Rebuilt.
2013-02-08 Anthony Green <green@moxielogic.com>
* configure.ac: Move sparc asm config checks to within functions
for compatibility with sun tools.
* configure: Rebuilt.
* src/sparc/ffi.c (ffi_prep_closure_loc): Flush cache on v9
systems.
* src/sparc/v8.S (ffi_flush_icache): Implement a sparc v9 cache
flusher.
2013-02-08 Nathan Rossi <nathan.rossi@xilinx.com>
* src/microblaze/ffi.c (ffi_closure_call_SYSV): Fix handling of
small big-endian structures.
(ffi_prep_args): Ditto.
2013-02-07 Anthony Green <green@moxielogic.com>
* src/sparc/v8.S (ffi_call_v8): Fix typo from last patch
(effectively hiding ffi_call_v8).
2013-02-07 Anthony Green <green@moxielogic.com>
* configure.ac: Update bug reporting address.
* configure.in: Rebuild.
* src/sparc/v8.S (ffi_flush_icache): Out-of-line cache flusher for
Sun compiler.
* src/sparc/ffi.c (ffi_call): Remove warning.
Call ffi_flush_icache for non-GCC builds.
(ffi_prep_closure_loc): Use ffi_flush_icache.
* Makefile.am (EXTRA_DIST): Add libtool-ldflags.
* Makefile.in: Rebuilt.
* libtool-ldflags: New file.
2013-02-07 Daniel Schepler <dschepler@gmail.com>
* configure.ac: Correctly identify x32 systems as 64-bit.
* m4/libtool.m4: Remove libtool expr error.
* aclocal.m4, configure: Rebuilt.
2013-02-07 Anthony Green <green@moxielogic.com>
* configure.ac: Fix GCC usage test.
* configure: Rebuilt.
* README: Mention LLVM/GCC x86_64 issue.
* testsuite/Makefile.in: Rebuilt.
2013-02-07 Anthony Green <green@moxielogic.com>
* testsuite/libffi.call/cls_double_va.c (main): Replace // style
comments with /* */ for xlc compiler.
* testsuite/libffi.call/stret_large.c (main): Ditto.
* testsuite/libffi.call/stret_large2.c (main): Ditto.
* testsuite/libffi.call/nested_struct1.c (main): Ditto.
* testsuite/libffi.call/huge_struct.c (main): Ditto.
* testsuite/libffi.call/float_va.c (main): Ditto.
* testsuite/libffi.call/cls_struct_va1.c (main): Ditto.
* testsuite/libffi.call/cls_pointer_stack.c (main): Ditto.
* testsuite/libffi.call/cls_pointer.c (main): Ditto.
* testsuite/libffi.call/cls_longdouble_va.c (main): Ditto.
2013-02-06 Anthony Green <green@moxielogic.com>
* man/ffi_prep_cif.3: Clean up for debian lintian checker.
2013-02-06 Anthony Green <green@moxielogic.com>
* Makefile.am (pkgconfigdir): Add missing pkgconfig install bits.
* Makefile.in: Rebuild.
2013-02-02 Mark H Weaver <mhw@netris.org>
* src/x86/ffi64.c (ffi_call): Sign-extend integer arguments passed
via general purpose registers.
2013-01-21 Nathan Rossi <nathan.rossi@xilinx.com>
* README: Add MicroBlaze details.
* Makefile.am: Add MicroBlaze support.
* configure.ac: Likewise.
* src/microblaze/ffi.c: New.
* src/microblaze/ffitarget.h: Likewise.
* src/microblaze/sysv.S: Likewise.
2013-01-21 Nathan Rossi <nathan.rossi@xilinx.com>
* testsuite/libffi.call/return_uc.c: Fixed issue.
2013-01-21 Chris Zankel <chris@zankel.net>
* README: Add Xtensa support.
* Makefile.am: Likewise.
* configure.ac: Likewise.
* Makefile.in Regenerate.
* configure: Likewise.
* src/prep_cif.c: Handle Xtensa.
* src/xtensa: New directory.
* src/xtensa/ffi.c: New file.
* src/xtensa/ffitarget.h: Ditto.
* src/xtensa/sysv.S: Ditto.
2013-01-11 Anthony Green <green@moxielogic.com>
* src/powerpc/ffi_darwin.c (ffi_prep_args): Replace // style
comments with /* */ for xlc compiler.
* src/powerpc/aix.S (ffi_call_AIX): Ditto.
* testsuite/libffi.call/ffitest.h (allocate_mmap): Delete
deprecated inline function.
* testsuite/libffi.special/ffitestcxx.h: Ditto.
* README: Add update for AIX support.
2013-01-11 Anthony Green <green@moxielogic.com>
* configure.ac: Robustify pc relative reloc check.
* m4/ax_cc_maxopt.m4: Don't -malign-double. This is an ABI
changing option for 32-bit x86.
* aclocal.m4, configure: Rebuilt.
* README: Update supported target list.
2013-01-10 Anthony Green <green@moxielogic.com>
* README (tested): Add Compiler column to table.
2013-01-10 Anthony Green <green@moxielogic.com>
* src/x86/ffi64.c (struct register_args): Make sse array and array
of unions for sunpro compiler compatibility.
2013-01-10 Anthony Green <green@moxielogic.com>
* configure.ac: Test target platform size_t size. Handle both 32
and 64-bit builds for x86_64-* and i?86-* targets (allowing for
CFLAG option to change default settings).
* configure, aclocal.m4: Rebuilt.
2013-01-10 Anthony Green <green@moxielogic.com>
* testsuite/libffi.special/special.exp: Only run exception
handling tests when using GNU compiler.
* m4/ax_compiler_vendor.m4: New file.
* configure.ac: Test for compiler vendor and don't use
AX_CFLAGS_WARN_ALL with the sun compiler.
* aclocal.m4, configure: Rebuilt.
2013-01-10 Anthony Green <green@moxielogic.com>
* include/ffi_common.h: Don't use GCCisms to define types when
building with the SUNPRO compiler.
2013-01-10 Anthony Green <green@moxielogic.com>
* configure.ac: Put local.exp in the right place.
* configure: Rebuilt.
* src/x86/ffi.c: Update comment about regparm function attributes.
* src/x86/sysv.S (ffi_closure_SYSV): The SUNPRO compiler requires
that all function arguments be passed on the stack (no regparm
support).
2013-01-08 Anthony Green <green@moxielogic.com>
* configure.ac: Generate local.exp. This sets CC_FOR_TARGET
when we are using the vendor compiler.
* testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): Point to
../local.exp.
* configure, testsuite/Makefile.in: Rebuilt.
* testsuite/libffi.call/call.exp: Run tests with different
options, depending on whether or not we are using gcc or the
vendor compiler.
* testsuite/lib/libffi.exp (libffi-init): Set using_gcc based on
whether or not we are building/testing with gcc.
2013-01-08 Anthony Green <green@moxielogic.com>
* configure.ac: Switch x86 solaris target to X86 by default.
* configure: Rebuilt.
2013-01-08 Anthony Green <green@moxielogic.com>
* configure.ac: Fix test for read-only eh_frame.
* configure: Rebuilt.
2013-01-08 Anthony Green <green@moxielogic.com>
* src/x86/sysv.S, src/x86/unix64.S: Only emit DWARF unwind info
when building with the GNU toolchain.
* testsuite/libffi.call/ffitest.h (CHECK): Fix for Solaris vendor
compiler.
2013-01-07 Thorsten Glaser <tg@mirbsd.org>
* testsuite/libffi.call/cls_uchar_va.c,
testsuite/libffi.call/cls_ushort_va.c,
testsuite/libffi.call/va_1.c: Testsuite fixes.
2013-01-07 Thorsten Glaser <tg@mirbsd.org>
* src/m68k/ffi.c (CIF_FLAGS_SINT8, CIF_FLAGS_SINT16): Define.
(ffi_prep_cif_machdep): Fix 8-bit and 16-bit signed calls.
* src/m68k/sysv.S (ffi_call_SYSV, ffi_closure_SYSV): Ditto.
2013-01-04 Anthony Green <green@moxielogic.com>
* Makefile.am (AM_CFLAGS): Don't automatically add -fexceptions
and -Wall. This is set in the configure script after testing for
GCC.
* Makefile.in: Rebuilt.
2013-01-02 rofl0r <https://github.com/rofl0r>
* src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix build error on ppc
when long double == double.
2013-01-02 Reini Urban <rurban@x-ray.at>
* Makefile.am (libffi_la_LDFLAGS): Add -no-undefined to LDFLAGS
(required for shared libs on cygwin/mingw).
* Makefile.in: Rebuilt.
2012-10-31 Alan Modra <amodra@gmail.com>
* src/powerpc/linux64_closure.S: Add new ABI support.
* src/powerpc/linux64.S: Likewise.
2012-10-30 Magnus Granberg <zorry@gentoo.org>
Pavel Labushev <pavel.labushev@runbox.ru>
* configure.ac: New options pax_emutramp
* configure, fficonfig.h.in: Regenerated
* src/closures.c: New function emutramp_enabled_check() and
checks.
2012-10-30 Frederick Cheung <frederick.cheung@gmail.com>
* configure.ac: Enable FFI_MAP_EXEC_WRIT for Darwin 12 (mountain
lion) and future version.
* configure: Rebuild.
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.
* Makefile.am: Support aarch64.
* configure.ac: Support aarch64.
* Makefile.in, configure: Rebuilt.
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: Likewise.
* 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.
* 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> 2012-04-11 Anthony Green <green@moxielogic.com>
* Makefile.am (EXTRA_DIST): Add new script. * Makefile.am (EXTRA_DIST): Add new script.
@ -27,15 +417,15 @@
* README: Update instructions on building iOS binary. * README: Update instructions on building iOS binary.
* build-ios.sh: Delete. * build-ios.sh: Delete.
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> 2012-04-06 Anthony Green <green@moxielogic.com>
* src/x86/ffi64.c (UINT128): Define differently for Intel and GNU * src/x86/ffi64.c (UINT128): Define differently for Intel and GNU
compilers, then use it. 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> 2012-04-06 Anthony Green <green@moxielogic.com>
* testsuite/Makefile.am (EXTRA_DIST): Add missing test cases. * testsuite/Makefile.am (EXTRA_DIST): Add missing test cases.
@ -48,6 +438,14 @@
in CNAME. in CNAME.
* src/x86/ffi.c: Wrap Windows specific code in ifdefs. * src/x86/ffi.c: Wrap Windows specific code in ifdefs.
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> 2012-04-02 Peter Rosin <peda@lysator.liu.se>
* src/x86/win32.S (ffi_call_win32): Sign/zero extend the return * src/x86/win32.S (ffi_call_win32): Sign/zero extend the return
@ -193,14 +591,6 @@
* testsuite/libffi.call/struct9.c: Likewise. * testsuite/libffi.call/struct9.c: Likewise.
* testsuite/libffi.call/testclosure.c: Likewise. * testsuite/libffi.call/testclosure.c: Likewise.
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-03-21 Peter Rosin <peda@lysator.liu.se> 2012-03-21 Peter Rosin <peda@lysator.liu.se>
* testsuite/libffi.call/float_va.c (float_va_fn): Use %f when * testsuite/libffi.call/float_va.c (float_va_fn): Use %f when
@ -214,6 +604,19 @@
(and save PATH for later). (and save PATH for later).
(restore_ld_library_path_env_vars): Restore PATH. (restore_ld_library_path_env_vars): Restore PATH.
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> 2012-03-20 Peter Rosin <peda@lysator.liu.se>
* testsuite/libffi.call/strlen2_win32.c (main): Remove bug. * testsuite/libffi.call/strlen2_win32.c (main): Remove bug.
@ -225,19 +628,19 @@
* src/m68k/ffi.c: Add MINT support. * src/m68k/ffi.c: Add MINT support.
* src/m68k/sysv.S: Ditto. * src/m68k/sysv.S: Ditto.
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-03-19 chennam <csit@axway.com> 2012-03-19 chennam <csit@axway.com>
* src/powerpc/ffi_darwin.c (ffi_prep_closure_loc): Fix AIX closure * src/powerpc/ffi_darwin.c (ffi_prep_closure_loc): Fix AIX closure
support. support.
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-03-13 Kaz Kojima <kkojima@gcc.gnu.org> 2012-03-13 Kaz Kojima <kkojima@gcc.gnu.org>
* src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, * src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,

View File

@ -2,40 +2,49 @@
AUTOMAKE_OPTIONS = foreign subdir-objects AUTOMAKE_OPTIONS = foreign subdir-objects
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = include testsuite man SUBDIRS = include testsuite man
EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ src/aarch64/ffi.c src/aarch64/ffitarget.h \
src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \ src/aarch64/sysv.S build-ios.sh \
src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \ src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \ src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \
src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \ src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \
src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \ src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \
src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \ src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \
src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \ src/ia64/unix.S src/mips/ffi.c src/mips/n32.S src/mips/o32.S \
src/m68k/ffitarget.h src/powerpc/ffi.c src/powerpc/sysv.S \ src/mips/ffitarget.h src/m32r/ffi.c src/m32r/sysv.S \
src/powerpc/linux64.S src/powerpc/linux64_closure.S \ src/m32r/ffitarget.h src/m68k/ffi.c src/m68k/sysv.S \
src/powerpc/ppc_closure.S src/powerpc/asm.h src/powerpc/aix.S \ src/m68k/ffitarget.h src/microblaze/ffi.c \
src/powerpc/darwin.S src/powerpc/aix_closure.S \ src/microblaze/sysv.S src/microblaze/ffitarget.h \
src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \ src/powerpc/ffi.c src/powerpc/sysv.S \
src/powerpc/ffitarget.h src/s390/ffi.c src/s390/sysv.S \ src/powerpc/linux64.S src/powerpc/linux64_closure.S \
src/s390/ffitarget.h src/sh/ffi.c src/sh/sysv.S \ src/powerpc/ppc_closure.S src/powerpc/asm.h \
src/sh/ffitarget.h src/sh64/ffi.c src/sh64/sysv.S \ src/powerpc/aix.S src/powerpc/darwin.S \
src/sh64/ffitarget.h src/sparc/v8.S src/sparc/v9.S \ src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \
src/sparc/ffitarget.h src/sparc/ffi.c src/x86/darwin64.S \ src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \
src/x86/ffi.c src/x86/sysv.S src/x86/win32.S src/x86/darwin.S \ src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \
src/x86/win64.S src/x86/freebsd.S src/x86/ffi64.c \ src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \
src/x86/unix64.S src/x86/ffitarget.h src/pa/ffitarget.h \ src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \
src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c \ src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \
src/frv/eabi.S src/frv/ffitarget.h src/dlmalloc.c \ src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \
src/moxie/ffi.c src/moxie/eabi.S libtool-version \ src/x86/win32.S src/x86/darwin.S src/x86/win64.S \
ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \ src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \
m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \
m4/ltversion.m4 src/arm/gentramp.sh src/debug.c \ src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/bfin/ffi.c \
msvcc.sh generate-ios-source-and-headers.py \ src/bfin/ffitarget.h src/bfin/sysv.S src/frv/eabi.S \
generate-osx-source-and-headers.py \ src/frv/ffitarget.h src/dlmalloc.c src/tile/ffi.c \
libffi.xcodeproj/project.pbxproj \ src/tile/ffitarget.h src/tile/tile.S libtool-version \
src/arm/trampoline.S src/xtensa/ffitarget.h src/xtensa/ffi.c src/xtensa/sysv.S \
ChangeLog.libffi m4/libtool.m4 m4/lt~obsolete.m4 \
m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \
m4/ltversion.m4 src/arm/gentramp.sh src/debug.c msvcc.sh \
generate-ios-source-and-headers.py \
generate-osx-source-and-headers.py \
libffi.xcodeproj/project.pbxproj src/arm/trampoline.S \
libtool-ldflags
info_TEXINFOS = doc/libffi.texi info_TEXINFOS = doc/libffi.texi
@ -83,11 +92,12 @@ AM_MAKEFLAGS = \
"RANLIB=$(RANLIB)" \ "RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)" "DESTDIR=$(DESTDIR)"
# Subdir rules rely on $(FLAGS_TO_PASS)
FLAGS_TO_PASS = $(AM_MAKEFLAGS)
MAKEOVERRIDES= MAKEOVERRIDES=
ACLOCAL_AMFLAGS=$(ACLOCAL_AMFLAGS) -I m4 toolexeclib_LTLIBRARIES = libffi.la
lib_LTLIBRARIES = libffi.la
noinst_LTLIBRARIES = libffi_convenience.la noinst_LTLIBRARIES = libffi_convenience.la
libffi_la_SOURCES = src/prep_cif.c src/types.c \ libffi_la_SOURCES = src/prep_cif.c src/types.c \
@ -105,6 +115,9 @@ endif
if MIPS if MIPS
nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S
endif endif
if BFIN
nodist_libffi_la_SOURCES += src/bfin/ffi.c src/bfin/sysv.S
endif
if X86 if X86
nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S
endif endif
@ -135,6 +148,12 @@ endif
if M68K if M68K
nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S
endif endif
if MOXIE
nodist_libffi_la_SOURCES += src/moxie/ffi.c src/moxie/eabi.S
endif
if MICROBLAZE
nodist_libffi_la_SOURCES += src/microblaze/ffi.c src/microblaze/sysv.S
endif
if POWERPC if POWERPC
nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
endif endif
@ -147,6 +166,9 @@ endif
if POWERPC_FREEBSD if POWERPC_FREEBSD
nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
endif endif
if AARCH64
nodist_libffi_la_SOURCES += src/aarch64/sysv.S src/aarch64/ffi.c
endif
if ARM if ARM
nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c
if FFI_EXEC_TRAMPOLINE_TABLE if FFI_EXEC_TRAMPOLINE_TABLE
@ -162,9 +184,6 @@ endif
if FRV if FRV
nodist_libffi_la_SOURCES += src/frv/eabi.S src/frv/ffi.c nodist_libffi_la_SOURCES += src/frv/eabi.S src/frv/ffi.c
endif endif
if MOXIE
nodist_libffi_la_SOURCES += src/moxie/eabi.S src/moxie/ffi.c
endif
if S390 if S390
nodist_libffi_la_SOURCES += src/s390/sysv.S src/s390/ffi.c nodist_libffi_la_SOURCES += src/s390/sysv.S src/s390/ffi.c
endif endif
@ -183,23 +202,20 @@ endif
if PA_HPUX if PA_HPUX
nodist_libffi_la_SOURCES += src/pa/hpux32.S src/pa/ffi.c nodist_libffi_la_SOURCES += src/pa/hpux32.S src/pa/ffi.c
endif endif
if TILE
nodist_libffi_la_SOURCES += src/tile/tile.S src/tile/ffi.c
endif
if XTENSA
nodist_libffi_la_SOURCES += src/xtensa/sysv.S src/xtensa/ffi.c
endif
libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
AM_CFLAGS = -g LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS))
if FFI_DEBUG
# Build debug. Define FFI_DEBUG on the commandline so that, when building with
# MSVC, it can link against the debug CRT.
AM_CFLAGS += -DFFI_DEBUG
endif
libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS)
AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src -DFFI_BUILDING AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
AM_CCASFLAGS = $(AM_CPPFLAGS) -g AM_CCASFLAGS = $(AM_CPPFLAGS)
# No install-html or install-pdf support in automake yet
.PHONY: install-html install-pdf
install-html:
install-pdf:

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
Status Status
====== ======
libffi-3.0.11 was released on April 11, 2012. Check the libffi web libffi-3.0.12 was released on February 11, 2013. Check the libffi web
page for updates: <URL:http://sourceware.org/libffi/>. page for updates: <URL:http://sourceware.org/libffi/>.
@ -43,54 +43,69 @@ Libffi has been ported to many different platforms.
For specific configuration details and testing status, please For specific configuration details and testing status, please
refer to the wiki page here: refer to the wiki page here:
http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.11 http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.12
At the time of release, the following basic configurations have been At the time of release, the following basic configurations have been
tested: tested:
|--------------+------------------| |-----------------+------------------+-------------------------|
| Architecture | Operating System | | Architecture | Operating System | Compiler |
|--------------+------------------| |-----------------+------------------+-------------------------|
| Alpha | Linux | | AArch64 | Linux | GCC |
| Alpha | Tru64 | | Alpha | Linux | GCC |
| ARM | Linux | | Alpha | Tru64 | GCC |
| ARM | iOS | | ARM | Linux | GCC |
| AVR32 | Linux | | ARM | iOS | GCC |
| HPPA | HPUX | | AVR32 | Linux | GCC |
| IA-64 | Linux | | Blackfin | uClinux | GCC |
| M68K | FreeMiNT | | HPPA | HPUX | GCC |
| M68K | RTEMS | | IA-64 | Linux | GCC |
| MIPS | IRIX | | M68K | FreeMiNT | GCC |
| MIPS | Linux | | M68K | Linux | GCC |
| MIPS | RTEMS | | M68K | RTEMS | GCC |
| MIPS64 | Linux | | MicroBlaze | Linux | GCC |
| PowerPC | AMIGA | | MIPS | IRIX | GCC |
| PowerPC | Linux | | MIPS | Linux | GCC |
| PowerPC | Mac OSX | | MIPS | RTEMS | GCC |
| PowerPC | FreeBSD | | MIPS64 | Linux | GCC |
| PowerPC64 | Linux | | Moxie | Bare metal | GCC
| S390 | Linux | | PowerPC 32-bit | AIX | IBM XL C |
| S390X | Linux | | PowerPC 64-bit | AIX | IBM XL C |
| SPARC | Linux | | PowerPC | AMIGA | GCC |
| SPARC | Solaris | | PowerPC | Linux | GCC |
| SPARC64 | Linux | | PowerPC | Mac OSX | GCC |
| SPARC64 | FreeBSD | | PowerPC | FreeBSD | GCC |
| X86 | FreeBSD | | PowerPC 64-bit | FreeBSD | GCC |
| X86 | Interix | | PowerPC 64-bit | Linux | GCC |
| X86 | kFreeBSD | | S390 | Linux | GCC |
| X86 | Linux | | S390X | Linux | GCC |
| X86 | Mac OSX | | SPARC | Linux | GCC |
| X86 | OpenBSD | | SPARC | Solaris | GCC |
| X86 | OS/2 | | SPARC | Solaris | Oracle Solaris Studio C |
| X86 | Solaris | | SPARC64 | Linux | GCC |
| X86 | Windows/Cygwin | | SPARC64 | FreeBSD | GCC |
| X86 | Windows/MingW | | SPARC64 | Solaris | Oracle Solaris Studio C |
| X86-64 | FreeBSD | | TILE-Gx/TILEPro | Linux | GCC |
| X86-64 | Linux | | X86 | FreeBSD | GCC |
| X86-64 | Linux/x32 | | X86 | GNU HURD | GCC |
| X86-64 | OpenBSD | | X86 | Interix | GCC |
| X86-64 | Windows/MingW | | X86 | kFreeBSD | GCC |
|--------------+------------------| | X86 | Linux | GCC |
| X86 | Mac OSX | GCC |
| X86 | OpenBSD | GCC |
| X86 | OS/2 | GCC |
| X86 | Solaris | GCC |
| X86 | Solaris | Oracle Solaris Studio C |
| X86 | Windows/Cygwin | GCC |
| X86 | Windows/MingW | GCC |
| X86-64 | FreeBSD | GCC |
| X86-64 | Linux | GCC |
| X86-64 | Linux/x32 | GCC |
| X86-64 | OpenBSD | GCC |
| X86-64 | Solaris | Oracle Solaris Studio C |
| X86-64 | Windows/MingW | GCC |
| Xtensa | Linux | GCC |
|-----------------+------------------+-------------------------|
Please send additional platform test results to Please send additional platform test results to
libffi-discuss@sourceware.org and feel free to update the wiki page libffi-discuss@sourceware.org and feel free to update the wiki page
@ -129,13 +144,12 @@ 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 that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not
present in MingW, and is not required when using MingW-style paths.) present in MingW, and is not required when using MingW-style paths.)
For iOS builds, run generate-ios-source-and-headers.py and then For iOS builds, the 'libffi.xcodeproj' Xcode project is available.
libffi.xcodeproj should work.
Configure has many other options. Use "configure --help" to see them all. Configure has many other options. Use "configure --help" to see them all.
Once configure has finished, type "make". Note that you must be using 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. GNU make. You can ftp GNU make from ftp.gnu.org:/pub/gnu/make .
To ensure that libffi is working as advertised, type "make check". To ensure that libffi is working as advertised, type "make check".
This will require that you have DejaGNU installed. This will require that you have DejaGNU installed.
@ -148,16 +162,29 @@ History
See the ChangeLog files for details. See the ChangeLog files for details.
3.0.12 Feb-11-13
Add Moxie support.
Add AArch64 support.
Add Blackfin support.
Add TILE-Gx/TILEPro support.
Add MicroBlaze support.
Add Xtensa support.
Add support for PaX enabled kernels with MPROTECT.
Add support for native vendor compilers on
Solaris and AIX.
Work around LLVM/GCC interoperability issue on x86_64.
3.0.11 Apr-11-12 3.0.11 Apr-11-12
Add support for variadic functions (ffi_prep_cif_var). Lots of build fixes.
Add Amiga newer MacOS support.
Add support for variadic functions (ffi_prep_cif_var).
Add Linux/x32 support. Add Linux/x32 support.
Add thiscall, fastcall and MSVC cdecl support on Windows. Add thiscall, fastcall and MSVC cdecl support on Windows.
Add Amiga and newer MacOS support. Add Amiga and newer MacOS support.
Add m68k FreeMiNT support. Add m68k FreeMiNT support.
Integration with iOS' xcode build tools. Integration with iOS' xcode build tools.
Fix Octeon and MC68881 support. Fix Octeon and MC68881 support.
Fix code pessimizations. Fix code pessimizations.
Lots of build fixes.
3.0.10 Aug-23-11 3.0.10 Aug-23-11
Add support for Apple's iOS. Add support for Apple's iOS.
@ -301,7 +328,7 @@ See the ChangeLog files for details.
Authors & Credits Authors & Credits
================= =================
libffi was originally written by Anthony Green <green@moxielogic.com>. libffi was originally written by Anthony Green <green@redhat.com>.
The developers of the GNU Compiler Collection project have made The developers of the GNU Compiler Collection project have made
innumerable valuable contributions. See the ChangeLog file for innumerable valuable contributions. See the ChangeLog file for
@ -316,15 +343,19 @@ Thorup.
Major processor architecture ports were contributed by the following Major processor architecture ports were contributed by the following
developers: developers:
aarch64 Marcus Shawcroft, James Greenhalgh
alpha Richard Henderson alpha Richard Henderson
arm Raffaele Sena arm Raffaele Sena
blackfin Alexandre Keunecke I. de Mendonca
cris Simon Posnjak, Hans-Peter Nilsson cris Simon Posnjak, Hans-Peter Nilsson
frv Anthony Green frv Anthony Green
ia64 Hans Boehm ia64 Hans Boehm
m32r Kazuhiro Inaoka m32r Kazuhiro Inaoka
m68k Andreas Schwab m68k Andreas Schwab
microblaze Nathan Rossi
mips Anthony Green, Casey Marshall mips Anthony Green, Casey Marshall
mips64 David Daney mips64 David Daney
moxie Anthony Green
pa Randolph Chung, Dave Anglin, Andreas Tobler pa Randolph Chung, Dave Anglin, Andreas Tobler
powerpc Geoffrey Keating, Andreas Tobler, powerpc Geoffrey Keating, Andreas Tobler,
David Edelsohn, John Hornkvist David Edelsohn, John Hornkvist
@ -333,8 +364,10 @@ s390 Gerhard Tonn, Ulrich Weigand
sh Kaz Kojima sh Kaz Kojima
sh64 Kaz Kojima sh64 Kaz Kojima
sparc Anthony Green, Gordon Irlam sparc Anthony Green, Gordon Irlam
tile-gx/tilepro Walter Lee
x86 Anthony Green, Jon Beniston x86 Anthony Green, Jon Beniston
x86-64 Bo Thorsen x86-64 Bo Thorsen
xtensa Chris Zankel
Jesper Skov and Andrew Haley both did more than their fair share of Jesper Skov and Andrew Haley both did more than their fair share of
stepping through the code and tracking down bugs. stepping through the code and tracking down bugs.

View File

@ -1,8 +1,7 @@
# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # generated automatically by aclocal 1.12.2 -*- Autoconf -*-
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
# Inc.
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -14,11 +13,11 @@
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.68. [m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to. You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely. If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])]) To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- # ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
# #
@ -515,7 +514,7 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen],
# at 6.2 and later dlopen does load deplibs. # at 6.2 and later dlopen does load deplibs.
lt_cv_sys_dlopen_deplibs=yes lt_cv_sys_dlopen_deplibs=yes
;; ;;
netbsd* | netbsdelf*-gnu) netbsd*)
lt_cv_sys_dlopen_deplibs=yes lt_cv_sys_dlopen_deplibs=yes
;; ;;
openbsd*) openbsd*)
@ -838,14 +837,13 @@ AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE])
dnl aclocal-1.4 backwards compatibility: dnl aclocal-1.4 backwards compatibility:
dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], [])
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Copyright (C) 2002-2012 Free Software Foundation, Inc.
# Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 1 # serial 8
# AM_AUTOMAKE_VERSION(VERSION) # AM_AUTOMAKE_VERSION(VERSION)
# ---------------------------- # ----------------------------
@ -853,10 +851,10 @@ dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], [])
# generated from the m4 files accompanying Automake X.Y. # generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.) # (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION], AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11' [am__api_version='1.12'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro. dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.11.3], [], m4_if([$1], [1.12.2], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
]) ])
@ -872,14 +870,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.11.3])dnl [AM_AUTOMAKE_VERSION([1.12.2])dnl
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# Figure out how to run the assembler. -*- Autoconf -*- # Figure out how to run the assembler. -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -901,17 +899,17 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
# AM_AUX_DIR_EXPAND -*- Autoconf -*- # AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 1 # serial 2
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'. # '$srcdir', '$srcdir/..', or '$srcdir/../..'.
# #
# Of course, Automake must honor this variable whenever it calls a # Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and # tool from the auxiliary directory. The problem is that $srcdir (and
@ -930,7 +928,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl
# #
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually # are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you # harmless because $srcdir is '.', but things will broke when you
# start a VPATH build or use an absolute $srcdir. # start a VPATH build or use an absolute $srcdir.
# #
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
@ -956,22 +954,21 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
# AM_CONDITIONAL -*- Autoconf -*- # AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Copyright (C) 1997-2012 Free Software Foundation, Inc.
# Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 9 # serial 10
# AM_CONDITIONAL(NAME, SHELL-CONDITION) # AM_CONDITIONAL(NAME, SHELL-CONDITION)
# ------------------------------------- # -------------------------------------
# Define a conditional. # Define a conditional.
AC_DEFUN([AM_CONDITIONAL], AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl [AC_PREREQ([2.52])dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl
@ -990,16 +987,15 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]]) Usually this means the macro was only invoked conditionally.]])
fi])]) fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # Copyright (C) 1999-2012 Free Software Foundation, Inc.
# 2010, 2011 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 12 # serial 17
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4, # written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's # will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing # C support machinery. Also note that it means that autoscan, seeing
@ -1009,7 +1005,7 @@ fi])])
# _AM_DEPENDENCIES(NAME) # _AM_DEPENDENCIES(NAME)
# ---------------------- # ----------------------
# See how the compiler implements dependency checking. # See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC". # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
# We try a few techniques and use that to set a single cache variable. # We try a few techniques and use that to set a single cache variable.
# #
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@ -1022,12 +1018,13 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=], m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=],
[depcc="$$1" am_compiler_list=]) [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc], AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type], [am_cv_$1_dependencies_compiler_type],
@ -1035,8 +1032,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
# We make a subdir and do the tests there. Otherwise we can end up # We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For # making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up # instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output # making a dummy file named 'D' -- because '-MD' means "put the output
# in D'. # in D".
rm -rf conftest.dir rm -rf conftest.dir
mkdir conftest.dir mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're # Copy depcomp to subdir because otherwise we won't find it if we're
@ -1076,16 +1073,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
: > sub/conftest.c : > sub/conftest.c
for i in 1 2 3 4 5 6; do for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh. # Solaris 10 /bin/sh.
touch sub/conftst$i.h echo '/* dummy */' > sub/conftst$i.h
done done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with `-c' and `-o' for the sake of the "dashmstdout" # We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly # mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this. Also, some Intel # handle '-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs # versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o} am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj" am__minus_obj="-o $am__obj"
case $depmode in case $depmode in
@ -1094,8 +1091,8 @@ AC_CACHE_CHECK([dependency style of $depcc],
test "$am__universal" = false || continue test "$am__universal" = false || continue
;; ;;
nosideeffect) nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll # After this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested # only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then if test "x$enable_dependency_tracking" = xyes; then
continue continue
else else
@ -1103,7 +1100,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
fi fi
;; ;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys) msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has # This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and # not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted. # so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o} am__obj=conftest.${OBJEXT-o}
@ -1151,7 +1148,7 @@ AM_CONDITIONAL([am__fastdep$1], [
# AM_SET_DEPDIR # AM_SET_DEPDIR
# ------------- # -------------
# Choose a directory name for dependency files. # Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES # This macro is AC_REQUIREd in _AM_DEPENDENCIES.
AC_DEFUN([AM_SET_DEPDIR], AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
@ -1161,9 +1158,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
# AM_DEP_TRACK # AM_DEP_TRACK
# ------------ # ------------
AC_DEFUN([AM_DEP_TRACK], AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking, [AC_ARG_ENABLE([dependency-tracking], [dnl
[ --disable-dependency-tracking speeds up one-time build AS_HELP_STRING(
--enable-dependency-tracking do not reject slow dependency extractors]) [--enable-dependency-tracking],
[do not reject slow dependency extractors])
AS_HELP_STRING(
[--disable-dependency-tracking],
[speeds up one-time build])])
if test "x$enable_dependency_tracking" != xno; then if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp" am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\' AMDEPBACKSLASH='\'
@ -1178,14 +1179,13 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*- # Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Copyright (C) 1999-2012 Free Software Foundation, Inc.
# Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
#serial 5 # serial 6
# _AM_OUTPUT_DEPENDENCY_COMMANDS # _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------ # ------------------------------
@ -1204,7 +1204,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# Strip MF so we end up with the name of the file. # Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'` mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not. # Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but # We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content. # some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process # Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so. # each Makefile.in and add a new line on top of each file to say so.
@ -1216,21 +1216,19 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
continue continue
fi fi
# Extract the definition of DEPDIR, am__include, and am__quote # Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'. # from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"` am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"` am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with # Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the # $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the # simplest approach to changing $(DEPDIR) to its actual value in the
# expansion. # expansion.
for file in `sed -n " for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists. # Make sure the directory exists.
test -f "$dirpart/$file" && continue test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])` fdir=`AS_DIRNAME(["$file"])`
@ -1248,7 +1246,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# This macro should only be invoked once -- use via AC_REQUIRE. # This macro should only be invoked once -- use via AC_REQUIRE.
# #
# This code is only required when automatic dependency tracking # This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will # is enabled. FIXME. This creates each '.P' file that we will
# need in order to bootstrap the dependency handling code. # need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles], [AC_CONFIG_COMMANDS([depfiles],
@ -1258,14 +1256,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*- # Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # Copyright (C) 1996-2012 Free Software Foundation, Inc.
# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 16 # serial 19
# This macro actually does too much. Some checks are only needed if # This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal. # your package does certain things. But this isn't really a big deal.
@ -1311,31 +1308,41 @@ AC_SUBST([CYGPATH_W])
# Define the identity of the package. # Define the identity of the package.
dnl Distinguish between old-style and new-style calls. dnl Distinguish between old-style and new-style calls.
m4_ifval([$2], m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl [AC_DIAGNOSE([obsolete],
[$0: two- and three-arguments forms are deprecated. For more info, see:
http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])], AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl [_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, m4_if(
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
[ok:ok],,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],, _AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
# Some tools Automake needs. # Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG([AUTOCONF], [autoconf])
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG([AUTOHEADER], [autoheader])
AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG([MAKEINFO], [makeinfo])
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AM_PROG_MKDIR_P])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target. The system "awk" is bad on # We need awk for the "check" target. The system "awk" is bad on
# some platforms. # some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_AWK])dnl
@ -1346,28 +1353,35 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_PROG_TAR([v7])])]) [_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],, _AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC], [AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)], [_AM_DEPENDENCIES([CC])],
[define([AC_PROG_CC], [m4_define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX], AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)], [_AM_DEPENDENCIES([CXX])],
[define([AC_PROG_CXX], [m4_define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC], AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)], [_AM_DEPENDENCIES([OBJC])],
[define([AC_PROG_OBJC], [m4_define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
dnl Support for Objective C++ was only introduced in Autoconf 2.65,
dnl but we still cater to Autoconf 2.62.
m4_ifdef([AC_PROG_OBJCXX],
[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[_AM_DEPENDENCIES([OBJCXX])],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
]) ])
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT], [m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
]) ])
dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
dnl mangled by Autoconf and run in a shell conditional statement. dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT], m4_define([_AC_COMPILER_EXEEXT],
@ -1395,14 +1409,13 @@ for _am_header in $config_headers :; do
done done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Copyright (C) 2001-2012 Free Software Foundation, Inc.
# Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 1 # serial 8
# AM_PROG_INSTALL_SH # AM_PROG_INSTALL_SH
# ------------------ # ------------------
@ -1417,9 +1430,9 @@ if test x"${install_sh}" != xset; then
install_sh="\${SHELL} $am_aux_dir/install-sh" install_sh="\${SHELL} $am_aux_dir/install-sh"
esac esac
fi fi
AC_SUBST(install_sh)]) AC_SUBST([install_sh])])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc. # Copyright (C) 2003-2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1443,20 +1456,19 @@ AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering # From Jim Meyering
# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, # Copyright (C) 1996-2012 Free Software Foundation, Inc.
# 2011 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 5 # serial 7
# AM_MAINTAINER_MODE([DEFAULT-MODE]) # AM_MAINTAINER_MODE([DEFAULT-MODE])
# ---------------------------------- # ----------------------------------
# Control maintainer-specific portions of Makefiles. # Control maintainer-specific portions of Makefiles.
# Default is to disable them, unless `enable' is passed literally. # Default is to disable them, unless 'enable' is passed literally.
# For symmetry, `disable' may be passed as well. Anyway, the user # For symmetry, 'disable' may be passed as well. Anyway, the user
# can override the default with the --enable/--disable switch. # can override the default with the --enable/--disable switch.
AC_DEFUN([AM_MAINTAINER_MODE], AC_DEFUN([AM_MAINTAINER_MODE],
[m4_case(m4_default([$1], [disable]), [m4_case(m4_default([$1], [disable]),
@ -1467,10 +1479,11 @@ AC_DEFUN([AM_MAINTAINER_MODE],
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode's default is 'disable' unless 'enable' is passed dnl maintainer-mode's default is 'disable' unless 'enable' is passed
AC_ARG_ENABLE([maintainer-mode], AC_ARG_ENABLE([maintainer-mode],
[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
(and sometimes confusing) to the casual installer], am_maintainer_other[ make rules and dependencies not useful
[USE_MAINTAINER_MODE=$enableval], (and sometimes confusing) to the casual installer])],
[USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) [USE_MAINTAINER_MODE=$enableval],
[USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE MAINT=$MAINTAINER_MODE_TRUE
@ -1482,13 +1495,13 @@ AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
# Check to see how 'make' treats includes. -*- Autoconf -*- # Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 4 # serial 5
# AM_MAKE_INCLUDE() # AM_MAKE_INCLUDE()
# ----------------- # -----------------
@ -1507,7 +1520,7 @@ am__quote=
_am_result=none _am_result=none
# First try GNU make style include. # First try GNU make style include.
echo "include confinc" > confmf echo "include confinc" > confmf
# Ignore all kinds of additional output from `make'. # Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #( case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*) *the\ am__doit\ target*)
am__include=include am__include=include
@ -1532,8 +1545,7 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf rm -f confinc confmf
]) ])
# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Copyright (C) 1999-2012 Free Software Foundation, Inc.
# Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1569,14 +1581,13 @@ m4_define([AC_PROG_CC],
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Copyright (C) 1997-2012 Free Software Foundation, Inc.
# Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 6 # serial 7
# AM_MISSING_PROG(NAME, PROGRAM) # AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------ # ------------------------------
@ -1606,49 +1617,19 @@ if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run " am_missing_run="$MISSING --run "
else else
am_missing_run= am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing]) AC_MSG_WARN(['missing' script is too old or missing])
fi fi
]) ])
# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
# Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_MKDIR_P
# ---------------
# Check for `mkdir -p'.
AC_DEFUN([AM_PROG_MKDIR_P],
[AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
# Helper functions for option handling. -*- Autoconf -*- # Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Copyright (C) 2001-2012 Free Software Foundation, Inc.
# Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 5 # serial 6
# _AM_MANGLE_OPTION(NAME) # _AM_MANGLE_OPTION(NAME)
# ----------------------- # -----------------------
@ -1659,7 +1640,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
# -------------------- # --------------------
# Set option NAME. Presently that only means defining a flag for this option. # Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION], AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) [m4_define(_AM_MANGLE_OPTION([$1]), [1])])
# _AM_SET_OPTIONS(OPTIONS) # _AM_SET_OPTIONS(OPTIONS)
# ------------------------ # ------------------------
@ -1675,22 +1656,18 @@ AC_DEFUN([_AM_IF_OPTION],
# Check to make sure that the build environment is sane. -*- Autoconf -*- # Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
# Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 5 # serial 9
# AM_SANITY_CHECK # AM_SANITY_CHECK
# --------------- # ---------------
AC_DEFUN([AM_SANITY_CHECK], AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane]) [AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory # Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter. # name. Accept space and tab only in the latter.
am_lf=' am_lf='
@ -1701,32 +1678,40 @@ case `pwd` in
esac esac
case $srcdir in case $srcdir in
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
esac esac
# Do `set' in a subshell so we don't clobber the current shell's # Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a # arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks # symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing # (eg FreeBSD returns the mod time of the symlink's containing
# directory). # directory).
if ( if (
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` am_has_slept=no
if test "$[*]" = "X"; then for am_try in 1 2; do
# -L didn't work. echo "timestamp, slept: $am_has_slept" > conftest.file
set X `ls -t "$srcdir/configure" conftest.file` set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
fi if test "$[*]" = "X"; then
rm -f conftest.file # -L didn't work.
if test "$[*]" != "X $srcdir/configure conftest.file" \ set X `ls -t "$srcdir/configure" conftest.file`
&& test "$[*]" != "X conftest.file $srcdir/configure"; then fi
if test "$[*]" != "X $srcdir/configure conftest.file" \
# If neither matched, then we have a broken ls. This can happen && test "$[*]" != "X conftest.file $srcdir/configure"; then
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
if test "$[2]" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$[2]" = conftest.file test "$[2]" = conftest.file
) )
then then
@ -1736,39 +1721,55 @@ else
AC_MSG_ERROR([newly created file is older than distributed files! AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock]) Check your system clock])
fi fi
AC_MSG_RESULT(yes)]) AC_MSG_RESULT([yes])
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
am_sleep_pid=$!
fi
AC_CONFIG_COMMANDS_PRE(
[AC_MSG_CHECKING([that generated files are newer than configure])
if test -n "$am_sleep_pid"; then
# Hide warnings about reused PIDs.
wait $am_sleep_pid 2>/dev/null
fi
AC_MSG_RESULT([done])])
rm -f conftest.file
])
# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 1 # serial 2
# AM_PROG_INSTALL_STRIP # AM_PROG_INSTALL_STRIP
# --------------------- # ---------------------
# One issue with vendor `install' (even GNU) is that you can't # One issue with vendor 'install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially # specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip # annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries. # is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we # Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize # always use install-sh in "make install-strip", and initialize
# STRIPPROG with the value of the STRIP variable (set by the user). # STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP], AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user # Installed binaries are usually stripped using 'strip' when the user
# run `make install-strip'. However `strip' might not be the right # run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake # tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program. # will honor the 'STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
if test "$cross_compiling" != no; then if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :) AC_CHECK_TOOL([STRIP], [strip], :)
fi fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])]) AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # Copyright (C) 2006-2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1789,18 +1790,18 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*- # Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # Copyright (C) 2004-2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 2 # serial 3
# _AM_PROG_TAR(FORMAT) # _AM_PROG_TAR(FORMAT)
# -------------------- # --------------------
# Check how to create a tarball in format FORMAT. # Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'. # FORMAT should be one of 'v7', 'ustar', or 'pax'.
# #
# Substitute a variable $(am__tar) that is a command # Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory # writing to stdout a FORMAT-tarball containing the directory
@ -1823,7 +1824,7 @@ AC_MSG_CHECKING([how to create a $1 tar archive])
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools} _am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and # Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'. # Solaris sh will not grok spaces in the rhs of '-'.
for _am_tool in $_am_tools for _am_tool in $_am_tools
do do
case $_am_tool in case $_am_tool in

View File

@ -0,0 +1,67 @@
#!/bin/sh
PLATFORM_IOS=/Developer/Platforms/iPhoneOS.platform/
PLATFORM_IOS_SIM=/Developer/Platforms/iPhoneSimulator.platform/
SDK_IOS_VERSION="4.2"
MIN_IOS_VERSION="3.0"
OUTPUT_DIR="universal-ios"
build_target () {
local platform=$1
local sdk=$2
local arch=$3
local triple=$4
local builddir=$5
mkdir -p "${builddir}"
pushd "${builddir}"
export CC="${platform}"/Developer/usr/bin/gcc-4.2
export CFLAGS="-arch ${arch} -isysroot ${sdk} -miphoneos-version-min=${MIN_IOS_VERSION}"
../configure --host=${triple} && make
popd
}
# Build all targets
build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv6 arm-apple-darwin10 armv6-ios
build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv7 arm-apple-darwin10 armv7-ios
build_target "${PLATFORM_IOS_SIM}" "${PLATFORM_IOS_SIM}/Developer/SDKs/iPhoneSimulator${SDK_IOS_VERSION}.sdk/" i386 i386-apple-darwin10 i386-ios-sim
# Create universal output directories
mkdir -p "${OUTPUT_DIR}"
mkdir -p "${OUTPUT_DIR}/include"
mkdir -p "${OUTPUT_DIR}/include/armv6"
mkdir -p "${OUTPUT_DIR}/include/armv7"
mkdir -p "${OUTPUT_DIR}/include/i386"
# Create the universal binary
lipo -create armv6-ios/.libs/libffi.a armv7-ios/.libs/libffi.a i386-ios-sim/.libs/libffi.a -output "${OUTPUT_DIR}/libffi.a"
# Copy in the headers
copy_headers () {
local src=$1
local dest=$2
# Fix non-relative header reference
sed 's/<ffitarget.h>/"ffitarget.h"/' < "${src}/include/ffi.h" > "${dest}/ffi.h"
cp "${src}/include/ffitarget.h" "${dest}"
}
copy_headers armv6-ios "${OUTPUT_DIR}/include/armv6"
copy_headers armv7-ios "${OUTPUT_DIR}/include/armv7"
copy_headers i386-ios-sim "${OUTPUT_DIR}/include/i386"
# Create top-level header
(
cat << EOF
#ifdef __arm__
#include <arm/arch.h>
#ifdef _ARM_ARCH_6
#include "include/armv6/ffi.h"
#elif _ARM_ARCH_7
#include "include/armv7/ffi.h"
#endif
#elif defined(__i386__)
#include "include/i386/ffi.h"
#endif
EOF
) > "${OUTPUT_DIR}/ffi.h"

View File

@ -2,13 +2,13 @@
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc. # 2011, 2012, 2013 Free Software Foundation, Inc.
timestamp='2011-06-03' timestamp='2012-12-29'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, but # This program is distributed in the hope that it will be useful, but
@ -17,26 +17,22 @@ timestamp='2011-06-03'
# General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# #
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Originally written by Per Bothner. Please send patches (context
# diff format) to <config-patches@gnu.org> and include a ChangeLog
# entry.
# #
# This script attempts to guess a canonical system name similar to # Originally written by Per Bothner.
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
# #
# You can get the latest version of this script from: # You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
me=`echo "$0" | sed -e 's,.*/,,'` me=`echo "$0" | sed -e 's,.*/,,'`
@ -57,8 +53,8 @@ GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
Software Foundation, Inc. 2012, 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -145,7 +141,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*) *:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or # NetBSD (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old # switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward # object file format. This provides both forward
@ -202,6 +198,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}" echo "${machine}-${os}${release}"
exit ;; exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
exit ;;
*:OpenBSD:*:*) *:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@ -304,7 +304,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE} echo arm-acorn-riscix${UNAME_RELEASE}
exit ;; exit ;;
arm:riscos:*:*|arm:RISCOS:*:*) arm*:riscos:*:*|arm*:RISCOS:*:*)
echo arm-unknown-riscos echo arm-unknown-riscos
exit ;; exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@ -792,21 +792,26 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;; exit ;;
*:FreeBSD:*:*) *:FreeBSD:*:*)
case ${UNAME_MACHINE} in UNAME_PROCESSOR=`/usr/bin/uname -p`
pc98) case ${UNAME_PROCESSOR} in
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
amd64) amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*) *)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac esac
exit ;; exit ;;
i*:CYGWIN*:*) i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin echo ${UNAME_MACHINE}-pc-cygwin
exit ;; exit ;;
*:MINGW64*:*)
echo ${UNAME_MACHINE}-pc-mingw64
exit ;;
*:MINGW*:*) *:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32 echo ${UNAME_MACHINE}-pc-mingw32
exit ;; exit ;;
i*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*) i*:windows32*:*)
# uname -m includes "-pc" on this system. # uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32 echo ${UNAME_MACHINE}-mingw32
@ -861,6 +866,13 @@ EOF
i*86:Minix:*:*) i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix echo ${UNAME_MACHINE}-pc-minix
exit ;; exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
alpha:Linux:*:*) alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;; EV5) UNAME_MACHINE=alphaev5 ;;
@ -895,13 +907,16 @@ EOF
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
cris:Linux:*:*) cris:Linux:*:*)
echo cris-axis-linux-gnu echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;; exit ;;
crisv32:Linux:*:*) crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu echo ${UNAME_MACHINE}-axis-linux-gnu
exit ;; exit ;;
frv:Linux:*:*) frv:Linux:*:*)
echo frv-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
i*86:Linux:*:*) i*86:Linux:*:*)
LIBC=gnu LIBC=gnu
@ -943,7 +958,7 @@ EOF
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;; ;;
or32:Linux:*:*) or32:Linux:*:*)
echo or32-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
padre:Linux:*:*) padre:Linux:*:*)
echo sparc-unknown-linux-gnu echo sparc-unknown-linux-gnu
@ -984,7 +999,7 @@ EOF
echo ${UNAME_MACHINE}-dec-linux-gnu echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;; exit ;;
x86_64:Linux:*:*) x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;; exit ;;
xtensa*:Linux:*:*) xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu echo ${UNAME_MACHINE}-unknown-linux-gnu
@ -1191,6 +1206,9 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible. BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku echo i586-pc-haiku
exit ;; exit ;;
x86_64:Haiku:*:*)
echo x86_64-unknown-haiku
exit ;;
SX-4:SUPER-UX:*:*) SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE} echo sx4-nec-superux${UNAME_RELEASE}
exit ;; exit ;;
@ -1246,7 +1264,7 @@ EOF
NEO-?:NONSTOP_KERNEL:*:*) NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE} echo neo-tandem-nsk${UNAME_RELEASE}
exit ;; exit ;;
NSE-?:NONSTOP_KERNEL:*:*) NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE} echo nse-tandem-nsk${UNAME_RELEASE}
exit ;; exit ;;
NSR-?:NONSTOP_KERNEL:*:*) NSR-?:NONSTOP_KERNEL:*:*)
@ -1315,11 +1333,11 @@ EOF
i*86:AROS:*:*) i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros echo ${UNAME_MACHINE}-pc-aros
exit ;; exit ;;
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
esac esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
eval $set_cc_for_build eval $set_cc_for_build
cat >$dummy.c <<EOF cat >$dummy.c <<EOF
#ifdef _SEQUENT_ #ifdef _SEQUENT_

View File

@ -2,37 +2,32 @@
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011 Free Software Foundation, Inc. # 2011, 2012, 2013 Free Software Foundation, Inc.
timestamp='2011-10-29' timestamp='2012-12-29'
# This file is (in principle) common to ALL GNU software. # This file is free software; you can redistribute it and/or modify it
# The presence of a machine in this file suggests that SOME GNU software # under the terms of the GNU General Public License as published by
# can handle that machine. It does not imply ALL GNU software can. # the Free Software Foundation; either version 3 of the License, or
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful, but
# but WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# GNU General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# #
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>. Submit a context # Please send patches with a ChangeLog entry to config-patches@gnu.org.
# diff and a properly formatted GNU ChangeLog entry.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
@ -76,8 +71,8 @@ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
Software Foundation, Inc. 2012, 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -125,13 +120,17 @@ esac
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \ kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*) storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;; ;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*) *)
basic_machine=`echo $1 | sed 's/-[^-]*$//'` basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ] if [ $basic_machine != $1 ]
@ -154,7 +153,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray | -microblaze) -apple | -axis | -knuth | -cray | -microblaze*)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
@ -223,6 +222,12 @@ case $os in
-isc*) -isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;; ;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*) -lynx*)
os=-lynxos os=-lynxos
;; ;;
@ -247,11 +252,14 @@ case $basic_machine in
# Some are omitted here because they have special meanings below. # Some are omitted here because they have special meanings below.
1750a | 580 \ 1750a | 580 \
| a29k \ | a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | arc \
| be32 | be64 \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| be32 | be64 \
| bfin \ | bfin \
| c4x | clipper \ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
@ -264,7 +272,7 @@ case $basic_machine in
| le32 | le64 \ | le32 | le64 \
| lm32 \ | lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \ | m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
@ -319,8 +327,7 @@ case $basic_machine in
c6x) c6x)
basic_machine=tic6x-unknown basic_machine=tic6x-unknown
;; ;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip) m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
;; ;;
@ -333,7 +340,10 @@ case $basic_machine in
strongarm | thumb | xscale) strongarm | thumb | xscale)
basic_machine=arm-unknown basic_machine=arm-unknown
;; ;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb) xscaleeb)
basic_machine=armeb-unknown basic_machine=armeb-unknown
;; ;;
@ -356,6 +366,7 @@ case $basic_machine in
# Recognize the basic CPU types with company name. # Recognize the basic CPU types with company name.
580-* \ 580-* \
| a29k-* \ | a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
@ -377,7 +388,8 @@ case $basic_machine in
| lm32-* \ | lm32-* \
| m32c-* | m32r-* | m32rle-* \ | m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \ | mips16-* \
| mips64-* | mips64el-* \ | mips64-* | mips64el-* \
@ -719,7 +731,6 @@ case $basic_machine in
i370-ibm* | ibm*) i370-ibm* | ibm*)
basic_machine=i370-ibm basic_machine=i370-ibm
;; ;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32) i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32 os=-sysv32
@ -777,9 +788,13 @@ case $basic_machine in
basic_machine=ns32k-utek basic_machine=ns32k-utek
os=-sysv os=-sysv
;; ;;
microblaze) microblaze*)
basic_machine=microblaze-xilinx basic_machine=microblaze-xilinx
;; ;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32) mingw32)
basic_machine=i386-pc basic_machine=i386-pc
os=-mingw32 os=-mingw32
@ -816,6 +831,10 @@ case $basic_machine in
ms1-*) ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;; ;;
msys)
basic_machine=i386-pc
os=-msys
;;
mvs) mvs)
basic_machine=i370-ibm basic_machine=i370-ibm
os=-mvs os=-mvs
@ -1004,7 +1023,11 @@ case $basic_machine in
basic_machine=i586-unknown basic_machine=i586-unknown
os=-pw32 os=-pw32
;; ;;
rdos) rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc basic_machine=i386-pc
os=-rdos os=-rdos
;; ;;
@ -1337,15 +1360,15 @@ case $os in
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \ | -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-android* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-uclibc* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \ | -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@ -1528,6 +1551,9 @@ case $basic_machine in
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=-coff
;; ;;
hexagon-*)
os=-elf
;;
tic54x-*) tic54x-*)
os=-coff os=-coff
;; ;;
@ -1555,9 +1581,6 @@ case $basic_machine in
;; ;;
m68000-sun) m68000-sun)
os=-sunos3 os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;; ;;
m68*-cisco) m68*-cisco)
os=-aout os=-aout

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ dnl Process this with autoconf to create configure
AC_PREREQ(2.68) AC_PREREQ(2.68)
AC_INIT([libffi], [3.0.11], [http://github.com/atgreen/libffi/issues]) AC_INIT([libffi], [3.0.12], [http://github.com/atgreen/libffi/issues])
AC_CONFIG_HEADERS([fficonfig.h]) AC_CONFIG_HEADERS([fficonfig.h])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
@ -30,7 +30,7 @@ save_CFLAGS=$CFLAGS
AC_PROG_CC AC_PROG_CC
CFLAGS=$save_CFLAGS CFLAGS=$save_CFLAGS
m4_undefine([_AC_ARG_VAR_PRECIOUS]) m4_undefine([_AC_ARG_VAR_PRECIOUS])
m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS) AC_SUBST(CFLAGS)
@ -39,10 +39,24 @@ AM_PROG_CC_C_O
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
# Test for 64-bit build.
AC_CHECK_SIZEOF([size_t])
AX_COMPILER_VENDOR
AX_CC_MAXOPT AX_CC_MAXOPT
AX_CFLAGS_WARN_ALL # The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro
# compiler.
if test "$ax_cv_c_compiler_vendor" != "sun"; then
AX_CFLAGS_WARN_ALL
fi
if test "x$GCC" = "xyes"; then if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -fexceptions" CFLAGS="$CFLAGS -fexceptions"
touch local.exp
else
cat > local.exp <<EOF
set CC_FOR_TARGET "$CC"
EOF
fi fi
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
@ -56,6 +70,10 @@ AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
TARGETDIR="unknown" TARGETDIR="unknown"
case "$host" in case "$host" in
aarch64*-*-*)
TARGET=AARCH64; TARGETDIR=aarch64
;;
alpha*-*-*) alpha*-*-*)
TARGET=ALPHA; TARGETDIR=alpha; TARGET=ALPHA; TARGETDIR=alpha;
# Support 128-bit long double, changeable via command-line switch. # Support 128-bit long double, changeable via command-line switch.
@ -70,6 +88,10 @@ case "$host" in
TARGET=X86_64; TARGETDIR=x86 TARGET=X86_64; TARGETDIR=x86
;; ;;
amd64-*-freebsd*)
TARGET=X86_64; TARGETDIR=x86
;;
amd64-*-freebsd*) amd64-*-freebsd*)
TARGET=X86_64; TARGETDIR=x86 TARGET=X86_64; TARGETDIR=x86
;; ;;
@ -78,6 +100,10 @@ case "$host" in
TARGET=AVR32; TARGETDIR=avr32 TARGET=AVR32; TARGETDIR=avr32
;; ;;
bfin*)
TARGET=BFIN; TARGETDIR=bfin
;;
cris-*-*) cris-*-*)
TARGET=LIBFFI_CRIS; TARGETDIR=cris TARGET=LIBFFI_CRIS; TARGETDIR=cris
;; ;;
@ -115,13 +141,49 @@ case "$host" in
TARGET=X86_DARWIN; TARGETDIR=x86 TARGET=X86_DARWIN; TARGETDIR=x86
;; ;;
i?86-*-solaris2.1[[0-9]]*) i?86-*-solaris2.1[[0-9]]*)
TARGET=X86_64; TARGETDIR=x86 TARGETDIR=x86
if test $ac_cv_sizeof_size_t = 4; then
TARGET=X86;
else
TARGET=X86_64;
fi
;; ;;
i*86-*-nto-qnx*) i*86-*-nto-qnx*)
TARGET=X86; TARGETDIR=x86 TARGET=X86; TARGETDIR=x86
;; ;;
i?86-*-*)
TARGET=X86_64; TARGETDIR=x86 x86_64-*-darwin*)
TARGET=X86_DARWIN; TARGETDIR=x86
;;
x86_64-*-cygwin* | x86_64-*-mingw*)
TARGET=X86_WIN64; TARGETDIR=x86
# All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
# We must also check with_cross_host to decide if this is a native
# or cross-build and select where to install dlls appropriately.
if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then
AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"';
else
AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"';
fi
;;
i?86-*-* | x86_64-*-*)
TARGETDIR=x86
if test $ac_cv_sizeof_size_t = 4; then
case "$host" in
*-gnux32)
TARGET=X86_64
;;
*)
TARGET=X86
;;
esac
else
TARGET=X86_64;
fi
;; ;;
ia64*-*-*) ia64*-*-*)
@ -136,6 +198,14 @@ case "$host" in
TARGET=M68K; TARGETDIR=m68k TARGET=M68K; TARGETDIR=m68k
;; ;;
microblaze*-*-*)
TARGET=MICROBLAZE; TARGETDIR=microblaze
;;
moxie-*-*)
TARGET=MOXIE; TARGETDIR=moxie
;;
mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
TARGET=MIPS_IRIX; TARGETDIR=mips TARGET=MIPS_IRIX; TARGETDIR=mips
;; ;;
@ -145,10 +215,6 @@ case "$host" in
TARGET=MIPS_IRIX; TARGETDIR=mips TARGET=MIPS_IRIX; TARGETDIR=mips
;; ;;
moxie-*-*)
TARGET=MOXIE; TARGETDIR=moxie
;;
powerpc*-*-linux* | powerpc-*-sysv*) powerpc*-*-linux* | powerpc-*-sysv*)
TARGET=POWERPC; TARGETDIR=powerpc TARGET=POWERPC; TARGETDIR=powerpc
;; ;;
@ -189,26 +255,14 @@ case "$host" in
TARGET=SPARC; TARGETDIR=sparc TARGET=SPARC; TARGETDIR=sparc
;; ;;
x86_64-*-darwin*) tile*-*)
TARGET=X86_DARWIN; TARGETDIR=x86 TARGET=TILE; TARGETDIR=tile
;;
xtensa*-*)
TARGET=XTENSA; TARGETDIR=xtensa
;; ;;
x86_64-*-cygwin* | x86_64-*-mingw*)
TARGET=X86_WIN64; TARGETDIR=x86
# All mingw/cygwin/win32 builds require -no-undefined for sharedlib.
# We must also check with_cross_host to decide if this is a native
# or cross-build and select where to install dlls appropriately.
if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then
AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"';
else
AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"';
fi
;;
x86_64-*-*)
TARGET=X86_64; TARGETDIR=x86
;;
esac esac
AC_SUBST(AM_RUNTESTFLAGS) AC_SUBST(AM_RUNTESTFLAGS)
@ -219,6 +273,7 @@ if test $TARGETDIR = unknown; then
fi fi
AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null]) AM_CONDITIONAL(MIPS,[expr x$TARGET : 'xMIPS' > /dev/null])
AM_CONDITIONAL(BFIN, test x$TARGET = xBFIN)
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(X86, test x$TARGET = xX86)
AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD)
@ -229,11 +284,13 @@ AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
AM_CONDITIONAL(IA64, test x$TARGET = xIA64) AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
AM_CONDITIONAL(M32R, test x$TARGET = xM32R) AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
AM_CONDITIONAL(M68K, test x$TARGET = xM68K) AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE)
AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE) AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE)
AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC) AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX) AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN) AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD) AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64)
AM_CONDITIONAL(ARM, test x$TARGET = xARM) AM_CONDITIONAL(ARM, test x$TARGET = xARM)
AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32) AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32)
AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS) AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS)
@ -245,6 +302,8 @@ AM_CONDITIONAL(SH64, test x$TARGET = xSH64)
AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX) AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX)
AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX) AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX)
AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX) AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX)
AM_CONDITIONAL(TILE, test x$TARGET = xTILE)
AM_CONDITIONAL(XTENSA, test x$TARGET = xXTENSA)
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_FUNCS(memcpy) AC_CHECK_FUNCS(memcpy)
@ -290,7 +349,7 @@ if test x$TARGET = xSPARC; then
libffi_cv_as_register_pseudo_op, [ libffi_cv_as_register_pseudo_op, [
libffi_cv_as_register_pseudo_op=unknown libffi_cv_as_register_pseudo_op=unknown
# Check if we have .register # Check if we have .register
AC_TRY_COMPILE([asm (".register %g2, #scratch");],, AC_TRY_COMPILE(,[asm (".register %g2, #scratch");],
[libffi_cv_as_register_pseudo_op=yes], [libffi_cv_as_register_pseudo_op=yes],
[libffi_cv_as_register_pseudo_op=no]) [libffi_cv_as_register_pseudo_op=no])
]) ])
@ -318,7 +377,7 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
libffi_cv_as_ascii_pseudo_op, [ libffi_cv_as_ascii_pseudo_op, [
libffi_cv_as_ascii_pseudo_op=unknown libffi_cv_as_ascii_pseudo_op=unknown
# Check if we have .ascii # Check if we have .ascii
AC_TRY_COMPILE([asm (".ascii \\"string\\"");],, AC_TRY_COMPILE(,[asm (".ascii \\"string\\"");],
[libffi_cv_as_ascii_pseudo_op=yes], [libffi_cv_as_ascii_pseudo_op=yes],
[libffi_cv_as_ascii_pseudo_op=no]) [libffi_cv_as_ascii_pseudo_op=no])
]) ])
@ -331,7 +390,7 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
libffi_cv_as_string_pseudo_op, [ libffi_cv_as_string_pseudo_op, [
libffi_cv_as_string_pseudo_op=unknown libffi_cv_as_string_pseudo_op=unknown
# Check if we have .string # Check if we have .string
AC_TRY_COMPILE([asm (".string \\"string\\"");],, AC_TRY_COMPILE(,[asm (".string \\"string\\"");],
[libffi_cv_as_string_pseudo_op=yes], [libffi_cv_as_string_pseudo_op=yes],
[libffi_cv_as_string_pseudo_op=no]) [libffi_cv_as_string_pseudo_op=no])
]) ])
@ -341,6 +400,14 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
fi fi
fi fi
# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC.
AC_ARG_ENABLE(pax_emutramp,
[ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC],
if test "$enable_pax_emutramp" = "yes"; then
AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1,
[Define this if you want to enable pax emulated trampolines])
fi)
if test x$TARGET = xX86_WIN64; then if test x$TARGET = xX86_WIN64; then
LT_SYS_SYMBOL_USCORE LT_SYS_SYMBOL_USCORE
if test "x$sys_symbol_underscore" = xyes; then if test "x$sys_symbol_underscore" = xyes; then
@ -348,7 +415,6 @@ if test x$TARGET = xX86_WIN64; then
fi fi
fi fi
FFI_EXEC_TRAMPOLINE_TABLE=0 FFI_EXEC_TRAMPOLINE_TABLE=0
case "$target" in case "$target" in
*arm*-apple-darwin*) *arm*-apple-darwin*)
@ -357,7 +423,7 @@ case "$target" in
[Cannot use PROT_EXEC on this target, so, we revert to [Cannot use PROT_EXEC on this target, so, we revert to
alternative means]) alternative means])
;; ;;
*-apple-darwin1[[10]]* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
[Cannot use malloc on this target, so, we revert to [Cannot use malloc on this target, so, we revert to
alternative means]) alternative means])
@ -386,11 +452,12 @@ if test "x$GCC" = "xyes"; then
libffi_cv_ro_eh_frame, [ libffi_cv_ro_eh_frame, [
libffi_cv_ro_eh_frame=no libffi_cv_ro_eh_frame=no
echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then
if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then objdump -h conftest.o > conftest.dump 2>&1
libffi_cv_ro_eh_frame=yes libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1`
elif grep '.section.*eh_frame.*#alloc' conftest.c \ libffi_test_line=`expr $libffi_eh_frame_line + 1`p
| grep -v '#write' > /dev/null; then sed -n $libffi_test_line conftest.dump > conftest.line
if grep READONLY conftest.line > /dev/null; then
libffi_cv_ro_eh_frame=yes libffi_cv_ro_eh_frame=yes
fi fi
fi fi
@ -456,6 +523,7 @@ AC_ARG_ENABLE(structs,
if test "$enable_structs" = "no"; then if test "$enable_structs" = "no"; then
AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.]) AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.])
fi) fi)
AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes")
AC_ARG_ENABLE(raw-api, AC_ARG_ENABLE(raw-api,
[ --disable-raw-api make the raw api unavailable], [ --disable-raw-api make the raw api unavailable],
@ -471,7 +539,7 @@ AC_ARG_ENABLE(purify-safety,
# These variables are only ever used when we cross-build to X86_WIN32. # These variables are only ever used when we cross-build to X86_WIN32.
# And we only support this with GCC, so... # And we only support this with GCC, so...
if test x"$GCC" != x"no"; then if test "x$GCC" = "xyes"; then
if test -n "$with_cross_host" && if test -n "$with_cross_host" &&
test x"$with_cross_host" != x"no"; then test x"$with_cross_host" != x"no"; then
toolexecdir='$(exec_prefix)/$(target_alias)' toolexecdir='$(exec_prefix)/$(target_alias)'
@ -486,14 +554,10 @@ if test x"$GCC" != x"no"; then
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
esac esac
AC_SUBST(toolexecdir) AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir)
fi
if test "${multilib}" = "yes"; then
multilib_arg="--enable-multilib"
else else
multilib_arg= toolexeclibdir='$(libdir)'
fi fi
AC_SUBST(toolexeclibdir)
AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) AC_CONFIG_COMMANDS(include, [test -d include || mkdir include])
AC_CONFIG_COMMANDS(src, [ AC_CONFIG_COMMANDS(src, [

View File

@ -1,5 +1,5 @@
This is ../libffi/doc/libffi.info, produced by makeinfo version 4.13 This is ../doc/libffi.info, produced by makeinfo version 4.13 from
from ../libffi/doc/libffi.texi. ../doc/libffi.texi.
This manual is for Libffi, a portable foreign-function interface This manual is for Libffi, a portable foreign-function interface
library. library.
@ -599,19 +599,19 @@ Index
 
Tag Table: Tag Table:
Node: Top712 Node: Top698
Node: Introduction1460 Node: Introduction1446
Node: Using libffi3096 Node: Using libffi3082
Node: The Basics3582 Node: The Basics3568
Node: Simple Example7224 Node: Simple Example7210
Node: Types8251 Node: Types8237
Node: Primitive Types8534 Node: Primitive Types8520
Node: Structures10354 Node: Structures10340
Node: Type Example11214 Node: Type Example11200
Node: Multiple ABIs12437 Node: Multiple ABIs12423
Node: The Closure API12808 Node: The Closure API12794
Node: Closure Example15752 Node: Closure Example15738
Node: Missing Features17311 Node: Missing Features17297
Node: Index17764 Node: Index17750
 
End Tag Table End Tag Table

View File

@ -1,4 +1,4 @@
@set UPDATED 11 April 2012 @set UPDATED 6 February 2013
@set UPDATED-MONTH April 2012 @set UPDATED-MONTH February 2013
@set EDITION 3.0.11 @set EDITION 3.0.12
@set VERSION 3.0.11 @set VERSION 3.0.12

View File

@ -1,4 +1,4 @@
@set UPDATED 11 April 2012 @set UPDATED 6 February 2013
@set UPDATED-MONTH April 2012 @set UPDATED-MONTH February 2013
@set EDITION 3.0.11 @set EDITION 3.0.12
@set VERSION 3.0.11 @set VERSION 3.0.12

View File

@ -20,6 +20,9 @@
/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ /* Cannot use PROT_EXEC on this target, so, we revert to alternative means */
#undef FFI_EXEC_TRAMPOLINE_TABLE #undef FFI_EXEC_TRAMPOLINE_TABLE
/* Define this if you want to enable pax emulated trampolines */
#undef FFI_MMAP_EXEC_EMUTRAMP_PAX
/* Cannot use malloc on this target, so, we revert to alternative means */ /* Cannot use malloc on this target, so, we revert to alternative means */
#undef FFI_MMAP_EXEC_WRIT #undef FFI_MMAP_EXEC_WRIT

View File

@ -11,6 +11,7 @@ ffi_platforms = {
'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'], 'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'],
'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'], 'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'],
'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'], 'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'],
'AARCH64': ['src/aarch64/ffi.c', 'src/aarch64/sysv.S'],
'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'], 'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'],
'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'], 'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'],
'M32R': ['src/m32r/sysv.S', 'src/m32r/ffi.c'], 'M32R': ['src/m32r/sysv.S', 'src/m32r/ffi.c'],

View File

@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am. # Makefile.in generated by automake 1.12.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994-2012 Free Software Foundation, Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -16,6 +15,23 @@
@SET_MAKE@ @SET_MAKE@
VPATH = @srcdir@ VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@
@ -37,18 +53,35 @@ host_triplet = @host@
target_triplet = @target@ target_triplet = @target@
subdir = include subdir = include
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/ffi.h.in $(srcdir)/ffi_common.h $(srcdir)/ffi.h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \
$(top_srcdir)/m4/ax_append_flag.m4 \
$(top_srcdir)/m4/ax_cc_maxopt.m4 \
$(top_srcdir)/m4/ax_cflags_warn_all.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_configure_args.m4 \
$(top_srcdir)/m4/ax_enable_builddir.m4 \
$(top_srcdir)/m4/ax_gcc_archflag.m4 \
$(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/fficonfig.h CONFIG_HEADER = $(top_builddir)/fficonfig.h
CONFIG_CLEAN_FILES = ffi.h ffitarget.h CONFIG_CLEAN_FILES = ffi.h ffitarget.h
CONFIG_CLEAN_VPATH_FILES = ffi_common.h CONFIG_CLEAN_VPATH_FILES =
SOURCES = SOURCES =
DIST_SOURCES = DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \ am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -145,6 +178,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PRTDIAG = @PRTDIAG@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
SED = @SED@ SED = @SED@
SET_MAKE = @SET_MAKE@ SET_MAKE = @SET_MAKE@
@ -165,6 +199,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@ am__quote = @am__quote@
am__tar = @am__tar@ am__tar = @am__tar@
am__untar = @am__untar@ am__untar = @am__untar@
ax_enable_builddir_sed = @ax_enable_builddir_sed@
bindir = @bindir@ bindir = @bindir@
build = @build@ build = @build@
build_alias = @build_alias@ build_alias = @build_alias@
@ -200,6 +235,7 @@ psdir = @psdir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
target = @target@ target = @target@
target_alias = @target_alias@ target_alias = @target_alias@
@ -259,8 +295,11 @@ clean-libtool:
-rm -rf .libs _libs -rm -rf .libs _libs
install-nodist_includesHEADERS: $(nodist_includes_HEADERS) install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)"
@list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(includesdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(includesdir)" || exit 1; \
fi; \
for p in $$list; do \ for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \ echo "$$d$$p"; \
@ -325,6 +364,20 @@ GTAGS:
&& $(am__cd) $(top_srcdir) \ && $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here" && gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags: distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@ -465,7 +518,7 @@ uninstall-am: uninstall-nodist_includesHEADERS
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \ clean-libtool cscopelist ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \ html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \ install-data-am install-dvi install-dvi-am install-exec \

View File

@ -87,7 +87,7 @@ typedef struct
} extended_cif; } extended_cif;
/* Terse sized type definitions. */ /* Terse sized type definitions. */
#if defined(_MSC_VER) || defined(__sgi) #if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C)
typedef unsigned char UINT8; typedef unsigned char UINT8;
typedef signed char SINT8; typedef signed char SINT8;
typedef unsigned short UINT16; typedef unsigned short UINT16;

View File

@ -12,17 +12,12 @@
6C43CBDE1534F76F00162364 /* trampoline.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC01534F76F00162364 /* trampoline.S */; }; 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC01534F76F00162364 /* trampoline.S */; };
6C43CBE61534F76F00162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC91534F76F00162364 /* darwin.S */; }; 6C43CBE61534F76F00162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBC91534F76F00162364 /* darwin.S */; };
6C43CBE81534F76F00162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBCB1534F76F00162364 /* ffi.c */; }; 6C43CBE81534F76F00162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBCB1534F76F00162364 /* ffi.c */; };
6C43CBE91534F76F00162364 /* ffi64.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CBCC1534F76F00162364 /* ffi64.c */; };
6C43CC1F1534F77800162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC051534F77800162364 /* darwin.S */; }; 6C43CC1F1534F77800162364 /* darwin.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC051534F77800162364 /* darwin.S */; };
6C43CC201534F77800162364 /* darwin64.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC061534F77800162364 /* darwin64.S */; }; 6C43CC201534F77800162364 /* darwin64.S in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC061534F77800162364 /* darwin64.S */; };
6C43CC211534F77800162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC071534F77800162364 /* ffi.c */; }; 6C43CC211534F77800162364 /* ffi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC071534F77800162364 /* ffi.c */; };
6C43CC221534F77800162364 /* ffi64.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC081534F77800162364 /* ffi64.c */; }; 6C43CC221534F77800162364 /* ffi64.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC081534F77800162364 /* ffi64.c */; };
6C43CC2F1534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; }; 6C43CC2F1534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; };
6C43CC301534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; }; 6C43CC301534F7BE00162364 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC281534F7BE00162364 /* closures.c */; };
6C43CC311534F7BE00162364 /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC291534F7BE00162364 /* debug.c */; };
6C43CC321534F7BE00162364 /* debug.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC291534F7BE00162364 /* debug.c */; };
6C43CC331534F7BE00162364 /* dlmalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2A1534F7BE00162364 /* dlmalloc.c */; };
6C43CC341534F7BE00162364 /* dlmalloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2A1534F7BE00162364 /* dlmalloc.c */; };
6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; }; 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; };
6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; }; 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2B1534F7BE00162364 /* java_raw_api.c */; };
6C43CC371534F7BE00162364 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2C1534F7BE00162364 /* prep_cif.c */; }; 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = 6C43CC2C1534F7BE00162364 /* prep_cif.c */; };
@ -61,14 +56,11 @@
6C43CBC01534F76F00162364 /* trampoline.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = trampoline.S; sourceTree = "<group>"; }; 6C43CBC01534F76F00162364 /* trampoline.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = trampoline.S; sourceTree = "<group>"; };
6C43CBC91534F76F00162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = "<group>"; }; 6C43CBC91534F76F00162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = "<group>"; };
6C43CBCB1534F76F00162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = "<group>"; }; 6C43CBCB1534F76F00162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = "<group>"; };
6C43CBCC1534F76F00162364 /* ffi64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64.c; sourceTree = "<group>"; };
6C43CC051534F77800162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = "<group>"; }; 6C43CC051534F77800162364 /* darwin.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin.S; sourceTree = "<group>"; };
6C43CC061534F77800162364 /* darwin64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin64.S; sourceTree = "<group>"; }; 6C43CC061534F77800162364 /* darwin64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin64.S; sourceTree = "<group>"; };
6C43CC071534F77800162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = "<group>"; }; 6C43CC071534F77800162364 /* ffi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi.c; sourceTree = "<group>"; };
6C43CC081534F77800162364 /* ffi64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64.c; sourceTree = "<group>"; }; 6C43CC081534F77800162364 /* ffi64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64.c; sourceTree = "<group>"; };
6C43CC281534F7BE00162364 /* closures.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = closures.c; path = src/closures.c; sourceTree = SOURCE_ROOT; }; 6C43CC281534F7BE00162364 /* closures.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = closures.c; path = src/closures.c; sourceTree = SOURCE_ROOT; };
6C43CC291534F7BE00162364 /* debug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = debug.c; path = src/debug.c; sourceTree = SOURCE_ROOT; };
6C43CC2A1534F7BE00162364 /* dlmalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = dlmalloc.c; path = src/dlmalloc.c; sourceTree = SOURCE_ROOT; };
6C43CC2B1534F7BE00162364 /* java_raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = java_raw_api.c; path = src/java_raw_api.c; sourceTree = SOURCE_ROOT; }; 6C43CC2B1534F7BE00162364 /* java_raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = java_raw_api.c; path = src/java_raw_api.c; sourceTree = SOURCE_ROOT; };
6C43CC2C1534F7BE00162364 /* prep_cif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prep_cif.c; path = src/prep_cif.c; sourceTree = SOURCE_ROOT; }; 6C43CC2C1534F7BE00162364 /* prep_cif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prep_cif.c; path = src/prep_cif.c; sourceTree = SOURCE_ROOT; };
6C43CC2D1534F7BE00162364 /* raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = raw_api.c; path = src/raw_api.c; sourceTree = SOURCE_ROOT; }; 6C43CC2D1534F7BE00162364 /* raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = raw_api.c; path = src/raw_api.c; sourceTree = SOURCE_ROOT; };
@ -149,7 +141,6 @@
children = ( children = (
6C43CBC91534F76F00162364 /* darwin.S */, 6C43CBC91534F76F00162364 /* darwin.S */,
6C43CBCB1534F76F00162364 /* ffi.c */, 6C43CBCB1534F76F00162364 /* ffi.c */,
6C43CBCC1534F76F00162364 /* ffi64.c */,
); );
path = x86; path = x86;
sourceTree = "<group>"; sourceTree = "<group>";
@ -187,8 +178,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
6C43CC281534F7BE00162364 /* closures.c */, 6C43CC281534F7BE00162364 /* closures.c */,
6C43CC291534F7BE00162364 /* debug.c */,
6C43CC2A1534F7BE00162364 /* dlmalloc.c */,
6C43CC2B1534F7BE00162364 /* java_raw_api.c */, 6C43CC2B1534F7BE00162364 /* java_raw_api.c */,
6C43CC2C1534F7BE00162364 /* prep_cif.c */, 6C43CC2C1534F7BE00162364 /* prep_cif.c */,
6C43CC2D1534F7BE00162364 /* raw_api.c */, 6C43CC2D1534F7BE00162364 /* raw_api.c */,
@ -412,8 +401,6 @@
6C43CC211534F77800162364 /* ffi.c in Sources */, 6C43CC211534F77800162364 /* ffi.c in Sources */,
6C43CC221534F77800162364 /* ffi64.c in Sources */, 6C43CC221534F77800162364 /* ffi64.c in Sources */,
6C43CC301534F7BE00162364 /* closures.c in Sources */, 6C43CC301534F7BE00162364 /* closures.c in Sources */,
6C43CC321534F7BE00162364 /* debug.c in Sources */,
6C43CC341534F7BE00162364 /* dlmalloc.c in Sources */,
6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */, 6C43CC361534F7BE00162364 /* java_raw_api.c in Sources */,
6C43CC381534F7BE00162364 /* prep_cif.c in Sources */, 6C43CC381534F7BE00162364 /* prep_cif.c in Sources */,
6C43CC3A1534F7BE00162364 /* raw_api.c in Sources */, 6C43CC3A1534F7BE00162364 /* raw_api.c in Sources */,
@ -430,10 +417,7 @@
6C43CBDE1534F76F00162364 /* trampoline.S in Sources */, 6C43CBDE1534F76F00162364 /* trampoline.S in Sources */,
6C43CBE61534F76F00162364 /* darwin.S in Sources */, 6C43CBE61534F76F00162364 /* darwin.S in Sources */,
6C43CBE81534F76F00162364 /* ffi.c in Sources */, 6C43CBE81534F76F00162364 /* ffi.c in Sources */,
6C43CBE91534F76F00162364 /* ffi64.c in Sources */,
6C43CC2F1534F7BE00162364 /* closures.c in Sources */, 6C43CC2F1534F7BE00162364 /* closures.c in Sources */,
6C43CC311534F7BE00162364 /* debug.c in Sources */,
6C43CC331534F7BE00162364 /* dlmalloc.c in Sources */,
6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */, 6C43CC351534F7BE00162364 /* java_raw_api.c in Sources */,
6C43CC371534F7BE00162364 /* prep_cif.c in Sources */, 6C43CC371534F7BE00162364 /* prep_cif.c in Sources */,
6C43CC391534F7BE00162364 /* raw_api.c in Sources */, 6C43CC391534F7BE00162364 /* raw_api.c in Sources */,

View File

@ -0,0 +1,106 @@
#! /bin/sh
# Script to translate LDFLAGS into a form suitable for use with libtool.
# Copyright (C) 2005 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 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; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
# Contributed by CodeSourcery, LLC.
# This script is designed to be used from a Makefile that uses libtool
# to build libraries as follows:
#
# LTLDFLAGS = $(shell libtool-ldflags $(LDFLAGS))
#
# Then, use (LTLDFLAGS) in place of $(LDFLAGS) in your link line.
# The output of the script. This string is built up as we process the
# arguments.
result=
prev_arg=
for arg
do
case $arg in
-f*|--*)
# Libtool does not ascribe any special meaning options
# that begin with -f or with a double-dash. So, it will
# think these options are linker options, and prefix them
# with "-Wl,". Then, the compiler driver will ignore the
# options. So, we prefix these options with -Xcompiler to
# make clear to libtool that they are in fact compiler
# options.
case $prev_arg in
-Xpreprocessor|-Xcompiler|-Xlinker)
# This option is already prefixed; don't prefix it again.
;;
*)
result="$result -Xcompiler"
;;
esac
;;
*)
# We do not want to add -Xcompiler to other options because
# that would prevent libtool itself from recognizing them.
;;
esac
prev_arg=$arg
# If $(LDFLAGS) is (say):
# a "b'c d" e
# then the user expects that:
# $(LD) $(LDFLAGS)
# will pass three arguments to $(LD):
# 1) a
# 2) b'c d
# 3) e
# We must ensure, therefore, that the arguments are appropriately
# quoted so that using:
# libtool --mode=link ... $(LTLDFLAGS)
# will result in the same number of arguments being passed to
# libtool. In other words, when this script was invoked, the shell
# removed one level of quoting, present in $(LDFLAGS); we have to put
# it back.
# Quote any embedded single quotes.
case $arg in
*"'"*)
# The following command creates the script:
# 1s,^X,,;s|'|'"'"'|g
# which removes a leading X, and then quotes and embedded single
# quotes.
sed_script="1s,^X,,;s|'|'\"'\"'|g"
# Add a leading "X" so that if $arg starts with a dash,
# the echo command will not try to interpret the argument
# as a command-line option.
arg="X$arg"
# Generate the quoted string.
quoted_arg=`echo "$arg" | sed -e "$sed_script"`
;;
*)
quoted_arg=$arg
;;
esac
# Surround the entire argument with single quotes.
quoted_arg="'"$quoted_arg"'"
# Add it to the string.
result="$result $quoted_arg"
done
# Output the string we have built up.
echo "$result"

View File

@ -26,4 +26,4 @@
# release, then set age to 0. # release, then set age to 0.
# #
# CURRENT:REVISION:AGE # CURRENT:REVISION:AGE
6:0:0 6:1:0

View File

@ -70,7 +70,7 @@
# compiler: $LTCC # compiler: $LTCC
# compiler flags: $LTCFLAGS # compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld) # linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 # $progname: (GNU libtool) 2.4.2
# automake: $automake_version # automake: $automake_version
# autoconf: $autoconf_version # autoconf: $autoconf_version
# #
@ -80,7 +80,7 @@
PROGRAM=libtool PROGRAM=libtool
PACKAGE=libtool PACKAGE=libtool
VERSION="2.4.2 Debian-2.4.2-1ubuntu1" VERSION=2.4.2
TIMESTAMP="" TIMESTAMP=""
package_revision=1.3337 package_revision=1.3337
@ -6124,10 +6124,7 @@ func_mode_link ()
case $pass in case $pass in
dlopen) libs="$dlfiles" ;; dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;; dlpreopen) libs="$dlprefiles" ;;
link) link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
libs="$deplibs %DEPLIBS%"
test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
;;
esac esac
fi fi
if test "$linkmode,$pass" = "lib,dlpreopen"; then if test "$linkmode,$pass" = "lib,dlpreopen"; then
@ -6447,19 +6444,19 @@ func_mode_link ()
# It is a libtool convenience library, so add in its objects. # It is a libtool convenience library, so add in its objects.
func_append convenience " $ladir/$objdir/$old_library" func_append convenience " $ladir/$objdir/$old_library"
func_append old_convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library"
tmp_libs=
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done
elif test "$linkmode" != prog && test "$linkmode" != lib; then elif test "$linkmode" != prog && test "$linkmode" != lib; then
func_fatal_error "\`$lib' is not a convenience library" func_fatal_error "\`$lib' is not a convenience library"
fi fi
tmp_libs=
for deplib in $dependency_libs; do
deplibs="$deplib $deplibs"
if $opt_preserve_dup_deps ; then
case "$tmp_libs " in
*" $deplib "*) func_append specialdeplibs " $deplib" ;;
esac
fi
func_append tmp_libs " $deplib"
done
continue continue
fi # $pass = conv fi # $pass = conv
@ -7352,9 +7349,6 @@ func_mode_link ()
revision="$number_minor" revision="$number_minor"
lt_irix_increment=no lt_irix_increment=no
;; ;;
*)
func_fatal_configuration "$modename: unknown library version type \`$version_type'"
;;
esac esac
;; ;;
no) no)

View File

@ -55,7 +55,7 @@
# modified version of the Autoconf Macro, you may extend this special # modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well. # exception to the GPL to apply to your modified version as well.
#serial 12 #serial 13
AC_DEFUN([AX_CC_MAXOPT], AC_DEFUN([AX_CC_MAXOPT],
[ [
@ -64,7 +64,7 @@ AC_REQUIRE([AX_COMPILER_VENDOR])
AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_ENABLE(portable-binary, [AS_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])], AC_ARG_ENABLE(portable-binary, [AS_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])],
acx_maxopt_portable=$withval, acx_maxopt_portable=no) acx_maxopt_portable=$enableval, acx_maxopt_portable=no)
# Try to determine "good" native compiler flags if none specified via CFLAGS # Try to determine "good" native compiler flags if none specified via CFLAGS
if test "$ac_test_CFLAGS" != "set"; then if test "$ac_test_CFLAGS" != "set"; then
@ -141,7 +141,8 @@ if test "$ac_test_CFLAGS" != "set"; then
CFLAGS="-O3 -fomit-frame-pointer" CFLAGS="-O3 -fomit-frame-pointer"
# -malign-double for x86 systems # -malign-double for x86 systems
AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double") # LIBFFI -- DON'T DO THIS - CHANGES ABI
# AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double")
# -fstrict-aliasing for gcc-2.95+ # -fstrict-aliasing for gcc-2.95+
AX_CHECK_COMPILE_FLAG(-fstrict-aliasing, AX_CHECK_COMPILE_FLAG(-fstrict-aliasing,

View File

@ -58,7 +58,7 @@
# modified version of the Autoconf Macro, you may extend this special # modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well. # exception to the GPL to apply to your modified version as well.
#serial 13 #serial 14
AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl
AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
@ -84,6 +84,7 @@ done
FLAGS="$ac_save_[]FLAGS" FLAGS="$ac_save_[]FLAGS"
]) ])
AS_VAR_POPDEF([FLAGS])dnl AS_VAR_POPDEF([FLAGS])dnl
AC_REQUIRE([AX_APPEND_FLAG])
case ".$VAR" in case ".$VAR" in
.ok|.ok,*) m4_ifvaln($3,$3) ;; .ok|.ok,*) m4_ifvaln($3,$3) ;;
.|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;

View File

@ -36,6 +36,7 @@
# #
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu> # Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo # Copyright (c) 2008 Matteo Frigo
# Copyright (c) 2012 Tsukasa Oi
# #
# This program is free software: you can redistribute it and/or modify it # 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 # under the terms of the GNU General Public License as published by the
@ -63,7 +64,7 @@
# modified version of the Autoconf Macro, you may extend this special # modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well. # exception to the GPL to apply to your modified version as well.
#serial 10 #serial 11
AC_DEFUN([AX_GCC_ARCHFLAG], AC_DEFUN([AX_GCC_ARCHFLAG],
[AC_REQUIRE([AC_PROG_CC]) [AC_REQUIRE([AC_PROG_CC])
@ -84,7 +85,7 @@ if test "x$ax_gcc_arch" = xyes; then
ax_gcc_arch="" ax_gcc_arch=""
if test "$cross_compiling" = no; then if test "$cross_compiling" = no; then
case $host_cpu in case $host_cpu in
i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones i[[3456]]86*|x86_64*) # use cpuid codes
AX_GCC_X86_CPUID(0) AX_GCC_X86_CPUID(0)
AX_GCC_X86_CPUID(1) AX_GCC_X86_CPUID(1)
case $ax_cv_gcc_x86_cpuid_0 in case $ax_cv_gcc_x86_cpuid_0 in
@ -92,18 +93,24 @@ case $host_cpu in
case $ax_cv_gcc_x86_cpuid_1 in case $ax_cv_gcc_x86_cpuid_1 in
*5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;;
*5??:*:*:*) ax_gcc_arch=pentium ;; *5??:*:*:*) ax_gcc_arch=pentium ;;
*6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; *0?6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
*6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; *0?6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
*6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; *0?6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
*6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; *0?6[[9de]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;;
*6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; *0?6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
*6??:*:*:*) ax_gcc_arch=pentiumpro ;; *0?6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;;
*f3[[347]]:*:*:*|*f4[1347]:*:*:*) *1?6[[7d]]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;;
*1?6[[aef]]?:*:*:*|*2?6[[5cef]]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;;
*1?6c?:*:*:*|*[[23]]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;;
*2?6[[ad]]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;;
*0?6??:*:*:*) ax_gcc_arch=pentiumpro ;;
*6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;;
?000?f3[[347]]:*:*:*|?000?f4[1347]:*:*:*|?000?f6?:*:*:*)
case $host_cpu in case $host_cpu in
x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;;
*) ax_gcc_arch="prescott pentium4 pentiumpro" ;; *) ax_gcc_arch="prescott pentium4 pentiumpro" ;;
esac ;; esac ;;
*f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; ?000?f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";;
esac ;; esac ;;
*:68747541:*:*) # AMD *:68747541:*:*) # AMD
case $ax_cv_gcc_x86_cpuid_1 in case $ax_cv_gcc_x86_cpuid_1 in
@ -121,10 +128,13 @@ case $host_cpu in
ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;;
*) ax_gcc_arch="athlon-4 athlon k7" ;; *) ax_gcc_arch="athlon-4 athlon k7" ;;
esac ;; esac ;;
*f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; ?00??f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;;
*f5?:*:*:*) ax_gcc_arch="opteron k8" ;; ?00??f5?:*:*:*) ax_gcc_arch="opteron k8" ;;
*f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; ?00??f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;;
*f??:*:*:*) ax_gcc_arch="k8" ;; ?00??f??:*:*:*) ax_gcc_arch="k8" ;;
?05??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;;
?06??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;;
*f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;;
esac ;; esac ;;
*:746e6543:*:*) # IDT *:746e6543:*:*) # IDT
case $ax_cv_gcc_x86_cpuid_1 in case $ax_cv_gcc_x86_cpuid_1 in

View File

@ -1324,7 +1324,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
LD="${LD-ld} -m elf_i386_fbsd" LD="${LD-ld} -m elf_i386_fbsd"
;; ;;
x86_64-*linux*) x86_64-*linux*)
LD="${LD-ld} -m elf_i386" case `/usr/bin/file conftest.o` in
*x86-64*)
LD="${LD-ld} -m elf32_x86_64"
;;
*)
LD="${LD-ld} -m elf_i386"
;;
esac
;; ;;
ppc64-*linux*|powerpc64-*linux*) ppc64-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux" LD="${LD-ld} -m elf32ppclinux"
@ -1688,7 +1695,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
;; ;;
*) *)
lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
if test -n "$lt_cv_sys_max_cmd_len"; then if test -n "$lt_cv_sys_max_cmd_len" && \
test undefined != "$lt_cv_sys_max_cmd_len"; then
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else else
@ -2669,10 +2677,14 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
# before this can be enabled. # before this can be enabled.
hardcode_into_libs=yes hardcode_into_libs=yes
# Add ABI-specific directories to the system library path.
sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib"
# Append ld.so.conf contents to the search path # Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra"
fi fi
# We used to test for /lib/ld.so.1 and disable shared libraries on # We used to test for /lib/ld.so.1 and disable shared libraries on
@ -2684,18 +2696,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
dynamic_linker='GNU/Linux ld.so' dynamic_linker='GNU/Linux ld.so'
;; ;;
netbsdelf*-gnu)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='NetBSD ld.elf_so'
;;
netbsd*) netbsd*)
version_type=sunos version_type=sunos
need_lib_prefix=no need_lib_prefix=no
@ -3301,7 +3301,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
lt_cv_deplibs_check_method=pass_all lt_cv_deplibs_check_method=pass_all
;; ;;
netbsd* | netbsdelf*-gnu) netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
else else
@ -4113,7 +4113,7 @@ m4_if([$1], [CXX], [
;; ;;
esac esac
;; ;;
netbsd* | netbsdelf*-gnu) netbsd*)
;; ;;
*qnx* | *nto*) *qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise # QNX uses GNU C++, but need to define -shared option too, otherwise
@ -4590,9 +4590,6 @@ m4_if([$1], [CXX], [
;; ;;
esac esac
;; ;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
*) *)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;; ;;
@ -4655,9 +4652,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
openbsd*) openbsd*)
with_gnu_ld=no with_gnu_ld=no
;; ;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
esac esac
_LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(ld_shlibs, $1)=yes
@ -4879,7 +4873,7 @@ _LT_EOF
fi fi
;; ;;
netbsd* | netbsdelf*-gnu) netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc= wlarc=
@ -5056,7 +5050,6 @@ _LT_EOF
if test "$aix_use_runtimelinking" = yes; then if test "$aix_use_runtimelinking" = yes; then
shared_flag="$shared_flag "'${wl}-G' shared_flag="$shared_flag "'${wl}-G'
fi fi
_LT_TAGVAR(link_all_deplibs, $1)=no
else else
# not using gcc # not using gcc
if test "$host_cpu" = ia64; then if test "$host_cpu" = ia64; then
@ -5361,7 +5354,7 @@ _LT_EOF
_LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes
;; ;;
netbsd* | netbsdelf*-gnu) netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else else

View File

@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am. # Makefile.in generated by automake 1.12.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994-2012 Free Software Foundation, Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -15,6 +14,23 @@
@SET_MAKE@ @SET_MAKE@
VPATH = @srcdir@ VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@
@ -37,7 +53,19 @@ target_triplet = @target@
subdir = man subdir = man
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \
$(top_srcdir)/m4/ax_append_flag.m4 \
$(top_srcdir)/m4/ax_cc_maxopt.m4 \
$(top_srcdir)/m4/ax_cflags_warn_all.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_configure_args.m4 \
$(top_srcdir)/m4/ax_enable_builddir.m4 \
$(top_srcdir)/m4/ax_gcc_archflag.m4 \
$(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
@ -47,6 +75,11 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
SOURCES = SOURCES =
DIST_SOURCES = DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \ am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -143,6 +176,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PRTDIAG = @PRTDIAG@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
SED = @SED@ SED = @SED@
SET_MAKE = @SET_MAKE@ SET_MAKE = @SET_MAKE@
@ -163,6 +197,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@ am__quote = @am__quote@
am__tar = @am__tar@ am__tar = @am__tar@
am__untar = @am__untar@ am__untar = @am__untar@
ax_enable_builddir_sed = @ax_enable_builddir_sed@
bindir = @bindir@ bindir = @bindir@
build = @build@ build = @build@
build_alias = @build_alias@ build_alias = @build_alias@
@ -198,6 +233,7 @@ psdir = @psdir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
target = @target@ target = @target@
target_alias = @target_alias@ target_alias = @target_alias@
@ -253,11 +289,18 @@ clean-libtool:
-rm -rf .libs _libs -rm -rf .libs _libs
install-man3: $(man_MANS) install-man3: $(man_MANS)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" @list1=''; \
@list=''; test -n "$(man3dir)" || exit 0; \ list2='$(man_MANS)'; \
{ for i in $$list; do echo "$$i"; done; \ test -n "$(man3dir)" \
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ && test -n "`echo $$list1$$list2`" \
sed -n '/\.3[a-z]*$$/p'; \ || exit 0; \
echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
$(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
{ for i in $$list1; do echo "$$i"; done; \
if test -n "$$list2"; then \
for i in $$list2; do echo "$$i"; done \
| sed -n '/\.3[a-z]*$$/p'; \
fi; \
} | while read p; do \ } | while read p; do \
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; echo "$$p"; \ echo "$$d$$p"; echo "$$p"; \
@ -293,6 +336,8 @@ TAGS:
ctags: CTAGS ctags: CTAGS
CTAGS: CTAGS:
cscope cscopelist:
distdir: $(DISTFILES) distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \ @list='$(MANS)'; if test -n "$$list"; then \
@ -301,10 +346,10 @@ distdir: $(DISTFILES)
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
if test -n "$$list" && \ if test -n "$$list" && \
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
echo " typically \`make maintainer-clean' will remove them" >&2; \ echo " typically 'make maintainer-clean' will remove them" >&2; \
exit 1; \ exit 1; \
else :; fi; \ else :; fi; \
else :; fi else :; fi

View File

@ -61,10 +61,8 @@ does not refer to a valid ABI,
.Nm FFI_BAD_ABI .Nm FFI_BAD_ABI
will be returned. Available ABIs are will be returned. Available ABIs are
defined in defined in
.Nm <ffitarget.h> .Nm <ffitarget.h> .
.
.Sh SEE ALSO .Sh SEE ALSO
.Xr ffi 3 , .Xr ffi 3 ,
.Xr ffi_call 3 , .Xr ffi_call 3 ,
.Xr ffi_prep_cif_var 3 .Xr ffi_prep_cif_var 3

0
Modules/_ctypes/libffi/mdate-sh Executable file → Normal file
View File

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

0
Modules/_ctypes/libffi/src/arm/gentramp.sh Normal file → Executable file
View File

View File

@ -0,0 +1,195 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>
Blackfin Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
#include <stdlib.h>
#include <stdio.h>
/* Maximum number of GPRs available for argument passing. */
#define MAX_GPRARGS 3
/*
* Return types
*/
#define FFIBFIN_RET_VOID 0
#define FFIBFIN_RET_BYTE 1
#define FFIBFIN_RET_HALFWORD 2
#define FFIBFIN_RET_INT64 3
#define FFIBFIN_RET_INT32 4
/*====================================================================*/
/* PROTOTYPE *
/*====================================================================*/
void ffi_prep_args(unsigned char *, extended_cif *);
/*====================================================================*/
/* Externals */
/* (Assembly) */
/*====================================================================*/
extern void ffi_call_SYSV(unsigned, extended_cif *, void(*)(unsigned char *, extended_cif *), unsigned, void *, void(*fn)(void));
/*====================================================================*/
/* Implementation */
/* */
/*====================================================================*/
/*
* This function calculates the return type (size) based on type.
*/
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
{
/* --------------------------------------*
* Return handling *
* --------------------------------------*/
switch (cif->rtype->type) {
case FFI_TYPE_VOID:
cif->flags = FFIBFIN_RET_VOID;
break;
case FFI_TYPE_UINT16:
case FFI_TYPE_SINT16:
cif->flags = FFIBFIN_RET_HALFWORD;
break;
case FFI_TYPE_UINT8:
cif->flags = FFIBFIN_RET_BYTE;
break;
case FFI_TYPE_INT:
case FFI_TYPE_UINT32:
case FFI_TYPE_SINT32:
case FFI_TYPE_FLOAT:
case FFI_TYPE_POINTER:
case FFI_TYPE_SINT8:
cif->flags = FFIBFIN_RET_INT32;
break;
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
case FFI_TYPE_DOUBLE:
cif->flags = FFIBFIN_RET_INT64;
break;
case FFI_TYPE_STRUCT:
if (cif->rtype->size <= 4){
cif->flags = FFIBFIN_RET_INT32;
}else if (cif->rtype->size == 8){
cif->flags = FFIBFIN_RET_INT64;
}else{
//it will return via a hidden pointer in P0
cif->flags = FFIBFIN_RET_VOID;
}
break;
default:
FFI_ASSERT(0);
break;
}
return FFI_OK;
}
/*
* This will prepare the arguments and will call the assembly routine
* cif = the call interface
* fn = the function to be called
* rvalue = the return value
* avalue = the arguments
*/
void ffi_call(ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue)
{
int ret_type = cif->flags;
extended_cif ecif;
ecif.cif = cif;
ecif.avalue = avalue;
ecif.rvalue = rvalue;
switch (cif->abi) {
case FFI_SYSV:
ffi_call_SYSV(cif->bytes, &ecif, ffi_prep_args, ret_type, ecif.rvalue, fn);
break;
default:
FFI_ASSERT(0);
break;
}
}
/*
* This function prepares the parameters (copies them from the ecif to the stack)
* to call the function (ffi_prep_args is called by the assembly routine in file
* sysv.S, which also calls the actual function)
*/
void ffi_prep_args(unsigned char *stack, extended_cif *ecif)
{
register unsigned int i = 0;
void **p_argv;
unsigned char *argp;
ffi_type **p_arg;
argp = stack;
p_argv = ecif->avalue;
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
(i != 0);
i--, p_arg++) {
size_t z;
z = (*p_arg)->size;
if (z < sizeof(int)) {
z = sizeof(int);
switch ((*p_arg)->type) {
case FFI_TYPE_SINT8: {
signed char v = *(SINT8 *)(* p_argv);
signed int t = v;
*(signed int *) argp = t;
}
break;
case FFI_TYPE_UINT8: {
unsigned char v = *(UINT8 *)(* p_argv);
unsigned int t = v;
*(unsigned int *) argp = t;
}
break;
case FFI_TYPE_SINT16:
*(signed int *) argp = (signed int) * (SINT16 *)(* p_argv);
break;
case FFI_TYPE_UINT16:
*(unsigned int *) argp = (unsigned int) * (UINT16 *)(* p_argv);
break;
case FFI_TYPE_STRUCT:
memcpy(argp, *p_argv, (*p_arg)->size);
break;
default:
FFI_ASSERT(0);
break;
}
} else if (z == sizeof(int)) {
*(unsigned int *) argp = (unsigned int) * (UINT32 *)(* p_argv);
} else {
memcpy(argp, *p_argv, z);
}
p_argv++;
argp += z;
}
}

View File

@ -0,0 +1,43 @@
/* -----------------------------------------------------------------------
ffitarget.h - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>
Blackfin Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#ifndef LIBFFI_TARGET_H
#define LIBFFI_TARGET_H
#ifndef LIBFFI_ASM
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,
FFI_SYSV,
FFI_LAST_ABI,
FFI_DEFAULT_ABI = FFI_SYSV
} ffi_abi;
#endif
#endif

View File

@ -0,0 +1,177 @@
/* -----------------------------------------------------------------------
sysv.S - Copyright (c) 2012 Alexandre K. I. de Mendonca <alexandre.keunecke@gmail.com>
Blackfin Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
.text
.align 4
/*
There is a "feature" in the bfin toolchain that it puts a _ before funcion names
that's why the function here it's called _ffi_call_SYSV and not ffi_call_SYSV
*/
.global _ffi_call_SYSV;
.type _ffi_call_SYSV, STT_FUNC;
.func ffi_call_SYSV
/*
cif->bytes = R0 (fp+8)
&ecif = R1 (fp+12)
ffi_prep_args = R2 (fp+16)
ret_type = stack (fp+20)
ecif.rvalue = stack (fp+24)
fn = stack (fp+28)
got (fp+32)
There is room for improvement here (we can use temporary registers
instead of saving the values in the memory)
REGS:
P5 => Stack pointer (function arguments)
R5 => cif->bytes
R4 => ret->type
FP-20 = P3
FP-16 = SP (parameters area)
FP-12 = SP (temp)
FP-08 = function return part 1 [R0]
FP-04 = function return part 2 [R1]
*/
_ffi_call_SYSV:
.prologue:
LINK 20;
[FP-20] = P3;
[FP+8] = R0;
[FP+12] = R1;
[FP+16] = R2;
.allocate_stack:
//alocate cif->bytes into the stack
R1 = [FP+8];
R0 = SP;
R0 = R0 - R1;
R1 = 4;
R0 = R0 - R1;
[FP-12] = SP;
SP = R0;
[FP-16] = SP;
.call_prep_args:
//get the addr of prep_args
P0 = [P3 + _ffi_prep_args@FUNCDESC_GOT17M4];
P1 = [P0];
P3 = [P0+4];
R0 = [FP-16];//SP (parameter area)
R1 = [FP+12];//ecif
call (P1);
.call_user_function:
//ajust SP so as to allow the user function access the parameters on the stack
SP = [FP-16]; //point to function parameters
R0 = [SP];
R1 = [SP+4];
R2 = [SP+8];
//load user function address
P0 = FP;
P0 +=28;
P1 = [P0];
P1 = [P1];
P3 = [P0+4];
/*
For functions returning aggregate values (struct) occupying more than 8 bytes,
the caller allocates the return value object on the stack and the address
of this object is passed to the callee as a hidden argument in register P0.
*/
P0 = [FP+24];
call (P1);
SP = [FP-12];
.compute_return:
P2 = [FP-20];
[FP-8] = R0;
[FP-4] = R1;
R0 = [FP+20];
R1 = R0 << 2;
R0 = [P2+.rettable@GOT17M4];
R0 = R1 + R0;
P2 = R0;
R1 = [P2];
P2 = [FP+-20];
R0 = [P2+.rettable@GOT17M4];
R0 = R1 + R0;
P2 = R0;
R0 = [FP-8];
R1 = [FP-4];
jump (P2);
/*
#define FFIBFIN_RET_VOID 0
#define FFIBFIN_RET_BYTE 1
#define FFIBFIN_RET_HALFWORD 2
#define FFIBFIN_RET_INT64 3
#define FFIBFIN_RET_INT32 4
*/
.align 4
.align 4
.rettable:
.dd .epilogue - .rettable
.dd .rbyte - .rettable;
.dd .rhalfword - .rettable;
.dd .rint64 - .rettable;
.dd .rint32 - .rettable;
.rbyte:
P0 = [FP+24];
R0 = R0.B (Z);
[P0] = R0;
JUMP .epilogue
.rhalfword:
P0 = [FP+24];
R0 = R0.L;
[P0] = R0;
JUMP .epilogue
.rint64:
P0 = [FP+24];// &rvalue
[P0] = R0;
[P0+4] = R1;
JUMP .epilogue
.rint32:
P0 = [FP+24];
[P0] = R0;
.epilogue:
R0 = [FP+8];
R1 = [FP+12];
R2 = [FP+16];
P3 = [FP-20];
UNLINK;
RTS;
.size _ffi_call_SYSV,.-_ffi_call_SYSV;
.endfunc

View File

@ -172,6 +172,27 @@ selinux_enabled_check (void)
#endif /* !FFI_MMAP_EXEC_SELINUX */ #endif /* !FFI_MMAP_EXEC_SELINUX */
/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */
#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX
#include <stdlib.h>
static int emutramp_enabled = -1;
static int
emutramp_enabled_check (void)
{
if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL)
return 1;
else
return 0;
}
#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \
: (emutramp_enabled = emutramp_enabled_check ()))
#else
#define is_emutramp_enabled() 0
#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */
#elif defined (__CYGWIN__) || defined(__INTERIX) #elif defined (__CYGWIN__) || defined(__INTERIX)
#include <sys/mman.h> #include <sys/mman.h>
@ -458,6 +479,12 @@ dlmmap (void *start, size_t length, int prot,
printf ("mapping in %zi\n", length); printf ("mapping in %zi\n", length);
#endif #endif
if (execfd == -1 && is_emutramp_enabled ())
{
ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset);
return ptr;
}
if (execfd == -1 && !is_selinux_enabled ()) if (execfd == -1 && !is_selinux_enabled ())
{ {
ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset);

View File

@ -123,6 +123,8 @@ ffi_prep_args (void *stack, extended_cif *ecif)
#define CIF_FLAGS_POINTER 32 #define CIF_FLAGS_POINTER 32
#define CIF_FLAGS_STRUCT1 64 #define CIF_FLAGS_STRUCT1 64
#define CIF_FLAGS_STRUCT2 128 #define CIF_FLAGS_STRUCT2 128
#define CIF_FLAGS_SINT8 256
#define CIF_FLAGS_SINT16 512
/* Perform machine dependent cif processing */ /* Perform machine dependent cif processing */
ffi_status ffi_status
@ -200,6 +202,14 @@ ffi_prep_cif_machdep (ffi_cif *cif)
cif->flags = CIF_FLAGS_DINT; cif->flags = CIF_FLAGS_DINT;
break; break;
case FFI_TYPE_SINT16:
cif->flags = CIF_FLAGS_SINT16;
break;
case FFI_TYPE_SINT8:
cif->flags = CIF_FLAGS_SINT8;
break;
default: default:
cif->flags = CIF_FLAGS_INT; cif->flags = CIF_FLAGS_INT;
break; break;

View File

@ -3,6 +3,7 @@
sysv.S - Copyright (c) 2012 Alan Hourihane sysv.S - Copyright (c) 2012 Alan Hourihane
Copyright (c) 1998, 2012 Andreas Schwab Copyright (c) 1998, 2012 Andreas Schwab
Copyright (c) 2008 Red Hat, Inc. Copyright (c) 2008 Red Hat, Inc.
Copyright (c) 2012 Thorsten Glaser
m68k Foreign Function Interface m68k Foreign Function Interface
@ -168,8 +169,22 @@ retstruct1:
retstruct2: retstruct2:
btst #7,%d2 btst #7,%d2
jbeq noretval jbeq retsint8
move.w %d0,(%a1) move.w %d0,(%a1)
jbra epilogue
retsint8:
btst #8,%d2
jbeq retsint16
extb.l %d0
move.l %d0,(%a1)
jbra epilogue
retsint16:
btst #9,%d2
jbeq noretval
ext.l %d0
move.l %d0,(%a1)
noretval: noretval:
epilogue: epilogue:
@ -201,8 +216,10 @@ CALLFUNC(ffi_closure_SYSV):
lsr.l #1,%d0 lsr.l #1,%d0
jne 1f jne 1f
jcc .Lcls_epilogue jcc .Lcls_epilogue
| CIF_FLAGS_INT
move.l -12(%fp),%d0 move.l -12(%fp),%d0
.Lcls_epilogue: .Lcls_epilogue:
| no CIF_FLAGS_*
unlk %fp unlk %fp
rts rts
1: 1:
@ -210,6 +227,7 @@ CALLFUNC(ffi_closure_SYSV):
lsr.l #2,%d0 lsr.l #2,%d0
jne 1f jne 1f
jcs .Lcls_ret_float jcs .Lcls_ret_float
| CIF_FLAGS_DINT
move.l (%a0)+,%d0 move.l (%a0)+,%d0
move.l (%a0),%d1 move.l (%a0),%d1
jra .Lcls_epilogue jra .Lcls_epilogue
@ -224,6 +242,7 @@ CALLFUNC(ffi_closure_SYSV):
lsr.l #2,%d0 lsr.l #2,%d0
jne 1f jne 1f
jcs .Lcls_ret_ldouble jcs .Lcls_ret_ldouble
| CIF_FLAGS_DOUBLE
#if defined(__MC68881__) || defined(__HAVE_68881__) #if defined(__MC68881__) || defined(__HAVE_68881__)
fmove.d (%a0),%fp0 fmove.d (%a0),%fp0
#else #else
@ -242,17 +261,31 @@ CALLFUNC(ffi_closure_SYSV):
jra .Lcls_epilogue jra .Lcls_epilogue
1: 1:
lsr.l #2,%d0 lsr.l #2,%d0
jne .Lcls_ret_struct2 jne 1f
jcs .Lcls_ret_struct1 jcs .Lcls_ret_struct1
| CIF_FLAGS_POINTER
move.l (%a0),%a0 move.l (%a0),%a0
move.l %a0,%d0 move.l %a0,%d0
jra .Lcls_epilogue jra .Lcls_epilogue
.Lcls_ret_struct1: .Lcls_ret_struct1:
move.b (%a0),%d0 move.b (%a0),%d0
jra .Lcls_epilogue jra .Lcls_epilogue
.Lcls_ret_struct2: 1:
lsr.l #2,%d0
jne 1f
jcs .Lcls_ret_sint8
| CIF_FLAGS_STRUCT2
move.w (%a0),%d0 move.w (%a0),%d0
jra .Lcls_epilogue jra .Lcls_epilogue
.Lcls_ret_sint8:
move.l (%a0),%d0
extb.l %d0
jra .Lcls_epilogue
1:
| CIF_FLAGS_SINT16
move.l (%a0),%d0
ext.l %d0
jra .Lcls_epilogue
CFI_ENDPROC() CFI_ENDPROC()
.size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV) .size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV)

View File

@ -0,0 +1,321 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 2012, 2013 Xilinx, Inc
MicroBlaze Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
extern void ffi_call_SYSV(void (*)(void*, extended_cif*), extended_cif*,
unsigned int, unsigned int, unsigned int*, void (*fn)(void),
unsigned int, unsigned int);
extern void ffi_closure_SYSV(void);
#define WORD_SIZE sizeof(unsigned int)
#define ARGS_REGISTER_SIZE (WORD_SIZE * 6)
#define WORD_ALIGN(x) ALIGN(x, WORD_SIZE)
/* ffi_prep_args is called by the assembly routine once stack space
has been allocated for the function's arguments */
void ffi_prep_args(void* stack, extended_cif* ecif)
{
unsigned int i;
ffi_type** p_arg;
void** p_argv;
void* stack_args_p = stack;
p_argv = ecif->avalue;
if (ecif == NULL || ecif->cif == NULL) {
return; /* no description to prepare */
}
if ((ecif->cif->rtype != NULL) &&
(ecif->cif->rtype->type == FFI_TYPE_STRUCT))
{
/* if return type is a struct which is referenced on the stack/reg5,
* by a pointer. Stored the return value pointer in r5.
*/
char* addr = stack_args_p;
memcpy(addr, &(ecif->rvalue), WORD_SIZE);
stack_args_p += WORD_SIZE;
}
if (ecif->avalue == NULL) {
return; /* no arguments to prepare */
}
for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs;
i++, p_arg++)
{
size_t size = (*p_arg)->size;
int type = (*p_arg)->type;
void* value = p_argv[i];
char* addr = stack_args_p;
int aligned_size = WORD_ALIGN(size);
/* force word alignment on the stack */
stack_args_p += aligned_size;
switch (type)
{
case FFI_TYPE_UINT8:
*(unsigned int *)addr = (unsigned int)*(UINT8*)(value);
break;
case FFI_TYPE_SINT8:
*(signed int *)addr = (signed int)*(SINT8*)(value);
break;
case FFI_TYPE_UINT16:
*(unsigned int *)addr = (unsigned int)*(UINT16*)(value);
break;
case FFI_TYPE_SINT16:
*(signed int *)addr = (signed int)*(SINT16*)(value);
break;
case FFI_TYPE_STRUCT:
#if __BIG_ENDIAN__
/*
* MicroBlaze toolchain appears to emit:
* bsrli r5, r5, 8 (caller)
* ...
* <branch to callee>
* ...
* bslli r5, r5, 8 (callee)
*
* For structs like "struct a { uint8_t a[3]; };", when passed
* by value.
*
* Structs like "struct b { uint16_t a; };" are also expected
* to be packed strangely in registers.
*
* This appears to be because the microblaze toolchain expects
* "struct b == uint16_t", which is only any issue for big
* endian.
*
* The following is a work around for big-endian only, for the
* above mentioned case, it will re-align the contents of a
* <= 3-byte struct value.
*/
if (size < WORD_SIZE)
{
memcpy (addr + (WORD_SIZE - size), value, size);
break;
}
#endif
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_FLOAT:
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
case FFI_TYPE_DOUBLE:
default:
memcpy(addr, value, aligned_size);
}
}
}
ffi_status ffi_prep_cif_machdep(ffi_cif* cif)
{
/* check ABI */
switch (cif->abi)
{
case FFI_SYSV:
break;
default:
return FFI_BAD_ABI;
}
return FFI_OK;
}
void ffi_call(ffi_cif* cif, void (*fn)(void), void* rvalue, void** avalue)
{
extended_cif ecif;
ecif.cif = cif;
ecif.avalue = avalue;
/* If the return value is a struct and we don't have a return */
/* value address then we need to make one */
if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) {
ecif.rvalue = alloca(cif->rtype->size);
} else {
ecif.rvalue = rvalue;
}
switch (cif->abi)
{
case FFI_SYSV:
ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags,
ecif.rvalue, fn, cif->rtype->type, cif->rtype->size);
break;
default:
FFI_ASSERT(0);
break;
}
}
void ffi_closure_call_SYSV(void* register_args, void* stack_args,
ffi_closure* closure, void* rvalue,
unsigned int* rtype, unsigned int* rsize)
{
/* prepare arguments for closure call */
ffi_cif* cif = closure->cif;
ffi_type** arg_types = cif->arg_types;
/* re-allocate data for the args. This needs to be done in order to keep
* multi-word objects (e.g. structs) in contigious memory. Callers are not
* required to store the value of args in the lower 6 words in the stack
* (although they are allocated in the stack).
*/
char* stackclone = alloca(cif->bytes);
void** avalue = alloca(cif->nargs * sizeof(void*));
void* struct_rvalue = NULL;
char* ptr = stackclone;
int i;
/* copy registers into stack clone */
int registers_used = cif->bytes;
if (registers_used > ARGS_REGISTER_SIZE) {
registers_used = ARGS_REGISTER_SIZE;
}
memcpy(stackclone, register_args, registers_used);
/* copy stack allocated args into stack clone */
if (cif->bytes > ARGS_REGISTER_SIZE) {
int stack_used = cif->bytes - ARGS_REGISTER_SIZE;
memcpy(stackclone + ARGS_REGISTER_SIZE, stack_args, stack_used);
}
/* preserve struct type return pointer passing */
if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) {
struct_rvalue = *((void**)ptr);
ptr += WORD_SIZE;
}
/* populate arg pointer list */
for (i = 0; i < cif->nargs; i++)
{
switch (arg_types[i]->type)
{
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
#ifdef __BIG_ENDIAN__
avalue[i] = ptr + 3;
#else
avalue[i] = ptr;
#endif
break;
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
#ifdef __BIG_ENDIAN__
avalue[i] = ptr + 2;
#else
avalue[i] = ptr;
#endif
break;
case FFI_TYPE_STRUCT:
#if __BIG_ENDIAN__
/*
* Work around strange ABI behaviour.
* (see info in ffi_prep_args)
*/
if (arg_types[i]->size < WORD_SIZE)
{
memcpy (ptr, ptr + (WORD_SIZE - arg_types[i]->size), arg_types[i]->size);
}
#endif
avalue[i] = (void*)ptr;
break;
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE:
avalue[i] = ptr;
break;
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_FLOAT:
default:
/* default 4-byte argument */
avalue[i] = ptr;
break;
}
ptr += WORD_ALIGN(arg_types[i]->size);
}
/* set the return type info passed back to the wrapper */
*rsize = cif->rtype->size;
*rtype = cif->rtype->type;
if (struct_rvalue != NULL) {
closure->fun(cif, struct_rvalue, avalue, closure->user_data);
/* copy struct return pointer value into function return value */
*((void**)rvalue) = struct_rvalue;
} else {
closure->fun(cif, rvalue, avalue, closure->user_data);
}
}
ffi_status ffi_prep_closure_loc(
ffi_closure* closure, ffi_cif* cif,
void (*fun)(ffi_cif*, void*, void**, void*),
void* user_data, void* codeloc)
{
unsigned long* tramp = (unsigned long*)&(closure->tramp[0]);
unsigned long cls = (unsigned long)codeloc;
unsigned long fn = 0;
unsigned long fn_closure_call_sysv = (unsigned long)ffi_closure_call_SYSV;
closure->cif = cif;
closure->fun = fun;
closure->user_data = user_data;
switch (cif->abi)
{
case FFI_SYSV:
fn = (unsigned long)ffi_closure_SYSV;
/* load r11 (temp) with fn */
/* imm fn(upper) */
tramp[0] = 0xb0000000 | ((fn >> 16) & 0xffff);
/* addik r11, r0, fn(lower) */
tramp[1] = 0x31600000 | (fn & 0xffff);
/* load r12 (temp) with cls */
/* imm cls(upper) */
tramp[2] = 0xb0000000 | ((cls >> 16) & 0xffff);
/* addik r12, r0, cls(lower) */
tramp[3] = 0x31800000 | (cls & 0xffff);
/* load r3 (temp) with ffi_closure_call_SYSV */
/* imm fn_closure_call_sysv(upper) */
tramp[4] = 0xb0000000 | ((fn_closure_call_sysv >> 16) & 0xffff);
/* addik r3, r0, fn_closure_call_sysv(lower) */
tramp[5] = 0x30600000 | (fn_closure_call_sysv & 0xffff);
/* branch/jump to address stored in r11 (fn) */
tramp[6] = 0x98085800; /* bra r11 */
break;
default:
return FFI_BAD_ABI;
}
return FFI_OK;
}

View File

@ -0,0 +1,53 @@
/* -----------------------------------------------------------------------
ffitarget.h - Copyright (c) 2012, 2013 Xilinx, Inc
Target configuration macros for MicroBlaze.
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_NATIVE_RAW_API 0
#define FFI_TRAMPOLINE_SIZE (4*8)
#endif

View File

@ -0,0 +1,302 @@
/* -----------------------------------------------------------------------
sysv.S - Copyright (c) 2012, 2013 Xilinx, Inc
MicroBlaze Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
/*
* arg[0] (r5) = ffi_prep_args,
* arg[1] (r6) = &ecif,
* arg[2] (r7) = cif->bytes,
* arg[3] (r8) = cif->flags,
* arg[4] (r9) = ecif.rvalue,
* arg[5] (r10) = fn
* arg[6] (sp[0]) = cif->rtype->type
* arg[7] (sp[4]) = cif->rtype->size
*/
.text
.globl ffi_call_SYSV
.type ffi_call_SYSV, @function
ffi_call_SYSV:
/* push callee saves */
addik r1, r1, -20
swi r19, r1, 0 /* Frame Pointer */
swi r20, r1, 4 /* PIC register */
swi r21, r1, 8 /* PIC register */
swi r22, r1, 12 /* save for locals */
swi r23, r1, 16 /* save for locals */
/* save the r5-r10 registers in the stack */
addik r1, r1, -24 /* increment sp to store 6x 32-bit words */
swi r5, r1, 0
swi r6, r1, 4
swi r7, r1, 8
swi r8, r1, 12
swi r9, r1, 16
swi r10, r1, 20
/* save function pointer */
addik r3, r5, 0 /* copy ffi_prep_args into r3 */
addik r22, r1, 0 /* save sp for unallocated args into r22 (callee-saved) */
addik r23, r10, 0 /* save function address into r23 (callee-saved) */
/* prepare stack with allocation for n (bytes = r7) args */
rsub r1, r7, r1 /* subtract bytes from sp */
/* prep args for ffi_prep_args call */
addik r5, r1, 0 /* store stack pointer into arg[0] */
/* r6 still holds ecif for arg[1] */
/* Call ffi_prep_args(stack, &ecif). */
addik r1, r1, -4
swi r15, r1, 0 /* store the link register in the frame */
brald r15, r3
nop /* branch has delay slot */
lwi r15, r1, 0
addik r1, r1, 4 /* restore the link register from the frame */
/* returns calling stack pointer location */
/* prepare args for fn call, prep_args populates them onto the stack */
lwi r5, r1, 0 /* arg[0] */
lwi r6, r1, 4 /* arg[1] */
lwi r7, r1, 8 /* arg[2] */
lwi r8, r1, 12 /* arg[3] */
lwi r9, r1, 16 /* arg[4] */
lwi r10, r1, 20 /* arg[5] */
/* call (fn) (...). */
addik r1, r1, -4
swi r15, r1, 0 /* store the link register in the frame */
brald r15, r23
nop /* branch has delay slot */
lwi r15, r1, 0
addik r1, r1, 4 /* restore the link register from the frame */
/* Remove the space we pushed for the args. */
addik r1, r22, 0 /* restore old SP */
/* restore this functions parameters */
lwi r5, r1, 0 /* arg[0] */
lwi r6, r1, 4 /* arg[1] */
lwi r7, r1, 8 /* arg[2] */
lwi r8, r1, 12 /* arg[3] */
lwi r9, r1, 16 /* arg[4] */
lwi r10, r1, 20 /* arg[5] */
addik r1, r1, 24 /* decrement sp to de-allocate 6x 32-bit words */
/* If the return value pointer is NULL, assume no return value. */
beqi r9, ffi_call_SYSV_end
lwi r22, r1, 48 /* get return type (20 for locals + 28 for arg[6]) */
lwi r23, r1, 52 /* get return size (20 for locals + 32 for arg[7]) */
/* Check if return type is actually a struct, do nothing */
rsubi r11, r22, FFI_TYPE_STRUCT
beqi r11, ffi_call_SYSV_end
/* Return 8bit */
rsubi r11, r23, 1
beqi r11, ffi_call_SYSV_store8
/* Return 16bit */
rsubi r11, r23, 2
beqi r11, ffi_call_SYSV_store16
/* Return 32bit */
rsubi r11, r23, 4
beqi r11, ffi_call_SYSV_store32
/* Return 64bit */
rsubi r11, r23, 8
beqi r11, ffi_call_SYSV_store64
/* Didnt match anything */
bri ffi_call_SYSV_end
ffi_call_SYSV_store64:
swi r3, r9, 0 /* store word r3 into return value */
swi r4, r9, 4 /* store word r4 into return value */
bri ffi_call_SYSV_end
ffi_call_SYSV_store32:
swi r3, r9, 0 /* store word r3 into return value */
bri ffi_call_SYSV_end
ffi_call_SYSV_store16:
#ifdef __BIG_ENDIAN__
shi r3, r9, 2 /* store half-word r3 into return value */
#else
shi r3, r9, 0 /* store half-word r3 into return value */
#endif
bri ffi_call_SYSV_end
ffi_call_SYSV_store8:
#ifdef __BIG_ENDIAN__
sbi r3, r9, 3 /* store byte r3 into return value */
#else
sbi r3, r9, 0 /* store byte r3 into return value */
#endif
bri ffi_call_SYSV_end
ffi_call_SYSV_end:
/* callee restores */
lwi r19, r1, 0 /* frame pointer */
lwi r20, r1, 4 /* PIC register */
lwi r21, r1, 8 /* PIC register */
lwi r22, r1, 12
lwi r23, r1, 16
addik r1, r1, 20
/* return from sub-routine (with delay slot) */
rtsd r15, 8
nop
.size ffi_call_SYSV, . - ffi_call_SYSV
/* ------------------------------------------------------------------------- */
/*
* args passed into this function, are passed down to the callee.
* this function is the target of the closure trampoline, as such r12 is
* a pointer to the closure object.
*/
.text
.globl ffi_closure_SYSV
.type ffi_closure_SYSV, @function
ffi_closure_SYSV:
/* push callee saves */
addik r11, r1, 28 /* save stack args start location (excluding regs/link) */
addik r1, r1, -12
swi r19, r1, 0 /* Frame Pointer */
swi r20, r1, 4 /* PIC register */
swi r21, r1, 8 /* PIC register */
/* store register args on stack */
addik r1, r1, -24
swi r5, r1, 0
swi r6, r1, 4
swi r7, r1, 8
swi r8, r1, 12
swi r9, r1, 16
swi r10, r1, 20
/* setup args */
addik r5, r1, 0 /* register_args */
addik r6, r11, 0 /* stack_args */
addik r7, r12, 0 /* closure object */
addik r1, r1, -8 /* allocate return value */
addik r8, r1, 0 /* void* rvalue */
addik r1, r1, -8 /* allocate for reutrn type/size values */
addik r9, r1, 0 /* void* rtype */
addik r10, r1, 4 /* void* rsize */
/* call the wrap_call function */
addik r1, r1, -28 /* allocate args + link reg */
swi r15, r1, 0 /* store the link register in the frame */
brald r15, r3
nop /* branch has delay slot */
lwi r15, r1, 0
addik r1, r1, 28 /* restore the link register from the frame */
ffi_closure_SYSV_prepare_return:
lwi r9, r1, 0 /* rtype */
lwi r10, r1, 4 /* rsize */
addik r1, r1, 8 /* de-allocate return info values */
/* Check if return type is actually a struct, store 4 bytes */
rsubi r11, r9, FFI_TYPE_STRUCT
beqi r11, ffi_closure_SYSV_store32
/* Return 8bit */
rsubi r11, r10, 1
beqi r11, ffi_closure_SYSV_store8
/* Return 16bit */
rsubi r11, r10, 2
beqi r11, ffi_closure_SYSV_store16
/* Return 32bit */
rsubi r11, r10, 4
beqi r11, ffi_closure_SYSV_store32
/* Return 64bit */
rsubi r11, r10, 8
beqi r11, ffi_closure_SYSV_store64
/* Didnt match anything */
bri ffi_closure_SYSV_end
ffi_closure_SYSV_store64:
lwi r3, r1, 0 /* store word r3 into return value */
lwi r4, r1, 4 /* store word r4 into return value */
/* 64 bits == 2 words, no sign extend occurs */
bri ffi_closure_SYSV_end
ffi_closure_SYSV_store32:
lwi r3, r1, 0 /* store word r3 into return value */
/* 32 bits == 1 word, no sign extend occurs */
bri ffi_closure_SYSV_end
ffi_closure_SYSV_store16:
#ifdef __BIG_ENDIAN__
lhui r3, r1, 2 /* store half-word r3 into return value */
#else
lhui r3, r1, 0 /* store half-word r3 into return value */
#endif
rsubi r11, r9, FFI_TYPE_SINT16
bnei r11, ffi_closure_SYSV_end
sext16 r3, r3 /* fix sign extend of sint8 */
bri ffi_closure_SYSV_end
ffi_closure_SYSV_store8:
#ifdef __BIG_ENDIAN__
lbui r3, r1, 3 /* store byte r3 into return value */
#else
lbui r3, r1, 0 /* store byte r3 into return value */
#endif
rsubi r11, r9, FFI_TYPE_SINT8
bnei r11, ffi_closure_SYSV_end
sext8 r3, r3 /* fix sign extend of sint8 */
bri ffi_closure_SYSV_end
ffi_closure_SYSV_end:
addik r1, r1, 8 /* de-allocate return value */
/* de-allocate stored args */
addik r1, r1, 24
/* callee restores */
lwi r19, r1, 0 /* frame pointer */
lwi r20, r1, 4 /* PIC register */
lwi r21, r1, 8 /* PIC register */
addik r1, r1, 12
/* return from sub-routine (with delay slot) */
rtsd r15, 8
nop
.size ffi_closure_SYSV, . - ffi_closure_SYSV

View File

@ -670,9 +670,16 @@ ffi_prep_closure_loc (ffi_closure *closure,
if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT) if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT)
return FFI_BAD_ABI; return FFI_BAD_ABI;
fn = ffi_closure_O32; fn = ffi_closure_O32;
#else /* FFI_MIPS_N32 */ #else
if (cif->abi != FFI_N32 && cif->abi != FFI_N64) #if _MIPS_SIM ==_ABIN32
if (cif->abi != FFI_N32
&& cif->abi != FFI_N32_SOFT_FLOAT)
return FFI_BAD_ABI; return FFI_BAD_ABI;
#else
if (cif->abi != FFI_N64
&& cif->abi != FFI_N64_SOFT_FLOAT)
return FFI_BAD_ABI;
#endif
fn = ffi_closure_N32; fn = ffi_closure_N32;
#endif /* FFI_MIPS_O32 */ #endif /* FFI_MIPS_O32 */

View File

@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
eabi.S - Copyright (c) 2004 Anthony Green eabi.S - Copyright (c) 2012, 2013 Anthony Green
FR-V Assembly glue. Moxie Assembly glue.
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
@ -34,95 +34,68 @@
.globl ffi_call_EABI .globl ffi_call_EABI
.type ffi_call_EABI, @function .type ffi_call_EABI, @function
# gr8 : ffi_prep_args # $r0 : ffi_prep_args
# gr9 : &ecif # $r1 : &ecif
# gr10: cif->bytes # $r2 : cif->bytes
# gr11: fig->flags # $r3 : fig->flags
# gr12: ecif.rvalue # $r4 : ecif.rvalue
# gr13: fn # $r5 : fn
ffi_call_EABI: ffi_call_EABI:
addi sp, #-80, sp push $sp, $r6
sti fp, @(sp, #24) push $sp, $r7
addi sp, #24, fp push $sp, $r8
movsg lr, gr5 dec $sp, 24
/* Make room for the new arguments. */ /* Store incoming args on stack. */
/* subi sp, fp, gr10 */ sto.l 0($sp), $r0 /* ffi_prep_args */
sto.l 4($sp), $r1 /* ecif */
/* Store return address and incoming args on stack. */ sto.l 8($sp), $r2 /* bytes */
sti gr5, @(fp, #8) sto.l 12($sp), $r3 /* flags */
sti gr8, @(fp, #-4) sto.l 16($sp), $r4 /* &rvalue */
sti gr9, @(fp, #-8) sto.l 20($sp), $r5 /* fn */
sti gr10, @(fp, #-12)
sti gr11, @(fp, #-16)
sti gr12, @(fp, #-20)
sti gr13, @(fp, #-24)
sub sp, gr10, sp
/* Call ffi_prep_args. */ /* Call ffi_prep_args. */
ldi @(fp, #-4), gr4 mov $r6, $r4 /* Save result buffer */
addi sp, #0, gr8 mov $r7, $r5 /* Save the target fn */
ldi @(fp, #-8), gr9 mov $r8, $r3 /* Save the flags */
#ifdef __FRV_FDPIC__ sub.l $sp, $r2 /* Allocate stack space */
ldd @(gr4, gr0), gr14 mov $r0, $sp /* We can stomp over $r0 */
calll @(gr14, gr0) /* $r1 is already set up */
#else jsra ffi_prep_args
calll @(gr4, gr0)
#endif
/* ffi_prep_args returns the new stack pointer. */ /* Load register arguments. */
mov gr8, gr4 ldo.l $r0, 0($sp)
ldo.l $r1, 4($sp)
ldi @(sp, #0), gr8 ldo.l $r2, 8($sp)
ldi @(sp, #4), gr9 ldo.l $r3, 12($sp)
ldi @(sp, #8), gr10 ldo.l $r4, 16($sp)
ldi @(sp, #12), gr11 ldo.l $r5, 20($sp)
ldi @(sp, #16), gr12
ldi @(sp, #20), gr13
/* Always copy the return value pointer into the hidden
parameter register. This is only strictly necessary
when we're returning an aggregate type, but it doesn't
hurt to do this all the time, and it saves a branch. */
ldi @(fp, #-20), gr3
/* Use the ffi_prep_args return value for the new sp. */
mov gr4, sp
/* Call the target function. */ /* Call the target function. */
ldi @(fp, -24), gr4 jsr $r7
#ifdef __FRV_FDPIC__
ldd @(gr4, gr0), gr14
calll @(gr14, gr0)
#else
calll @(gr4, gr0)
#endif
/* Store the result. */ ldi.l $r7, 0xffffffff
ldi @(fp, #-16), gr10 /* fig->flags */ cmp $r8, $r7
ldi @(fp, #-20), gr4 /* ecif.rvalue */ beq retstruct
/* Is the return value stored in two registers? */ ldi.l $r7, 4
cmpi gr10, #8, icc0 cmp $r8, $r7
bne icc0, 0, .L2 bgt ret2reg
/* Yes, save them. */
sti gr8, @(gr4, #0)
sti gr9, @(gr4, #4)
bra .L3
.L2:
/* Is the return value a structure? */
cmpi gr10, #-1, icc0
beq icc0, 0, .L3
/* No, save a 4 byte return value. */
sti gr8, @(gr4, #0)
.L3:
/* Restore the stack, and return. */ st.l ($r6), $r0
ldi @(fp, 8), gr5 jmpa retdone
ld @(fp, gr0), fp
addi sp,#80,sp ret2reg:
jmpl @(gr5,gr0) st.l ($r6), $r0
sto.l 4($r6), $r1
retstruct:
retdone:
/* Return. */
ldo.l $r6, -4($fp)
ldo.l $r7, -8($fp)
ldo.l $r8, -12($fp)
ret
.size ffi_call_EABI, .-ffi_call_EABI .size ffi_call_EABI, .-ffi_call_EABI

View File

@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
ffi.c - Copyright (C) 2009 Anthony Green ffi.c - Copyright (C) 2012, 2013 Anthony Green
Moxie Foreign Function Interface Moxie Foreign Function Interface
@ -43,6 +43,12 @@ void *ffi_prep_args(char *stack, extended_cif *ecif)
p_argv = ecif->avalue; p_argv = ecif->avalue;
argp = stack; argp = stack;
if (ecif->cif->rtype->type == FFI_TYPE_STRUCT)
{
*(void **) argp = ecif->rvalue;
argp += 4;
}
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
(i != 0); (i != 0);
i--, p_arg++) i--, p_arg++)
@ -56,17 +62,6 @@ void *ffi_prep_args(char *stack, extended_cif *ecif)
z = sizeof(void*); z = sizeof(void*);
*(void **) argp = *p_argv; *(void **) argp = *p_argv;
} }
/* if ((*p_arg)->type == FFI_TYPE_FLOAT)
{
if (count > 24)
{
// This is going on the stack. Turn it into a double.
*(double *) argp = (double) *(float*)(* p_argv);
z = sizeof(double);
}
else
*(void **) argp = *(void **)(* p_argv);
} */
else if (z < sizeof(int)) else if (z < sizeof(int))
{ {
z = sizeof(int); z = sizeof(int);
@ -148,7 +143,6 @@ void ffi_call(ffi_cif *cif,
else else
ecif.rvalue = rvalue; ecif.rvalue = rvalue;
switch (cif->abi) switch (cif->abi)
{ {
case FFI_EABI: case FFI_EABI:
@ -165,19 +159,25 @@ void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3,
unsigned arg4, unsigned arg5, unsigned arg6) unsigned arg4, unsigned arg5, unsigned arg6)
{ {
/* This function is called by a trampoline. The trampoline stows a /* This function is called by a trampoline. The trampoline stows a
pointer to the ffi_closure object in gr7. We must save this pointer to the ffi_closure object in $r7. We must save this
pointer in a place that will persist while we do our work. */ pointer in a place that will persist while we do our work. */
register ffi_closure *creg __asm__ ("gr7"); register ffi_closure *creg __asm__ ("$r12");
ffi_closure *closure = creg; ffi_closure *closure = creg;
/* Arguments that don't fit in registers are found on the stack /* Arguments that don't fit in registers are found on the stack
at a fixed offset above the current frame pointer. */ at a fixed offset above the current frame pointer. */
register char *frame_pointer __asm__ ("fp"); register char *frame_pointer __asm__ ("$fp");
char *stack_args = frame_pointer + 16;
/* Pointer to a struct return value. */
void *struct_rvalue = (void *) arg1;
/* 6 words reserved for register args + 3 words from jsr */
char *stack_args = frame_pointer + 9*4;
/* Lay the register arguments down in a continuous chunk of memory. */ /* Lay the register arguments down in a continuous chunk of memory. */
unsigned register_args[6] = unsigned register_args[6] =
{ arg1, arg2, arg3, arg4, arg5, arg6 }; { arg1, arg2, arg3, arg4, arg5, arg6 };
char *register_args_ptr = (char *) register_args;
ffi_cif *cif = closure->cif; ffi_cif *cif = closure->cif;
ffi_type **arg_types = cif->arg_types; ffi_type **arg_types = cif->arg_types;
@ -185,6 +185,12 @@ void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3,
char *ptr = (char *) register_args; char *ptr = (char *) register_args;
int i; int i;
/* preserve struct type return pointer passing */
if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) {
ptr += 4;
register_args_ptr = (char *)&register_args[1];
}
/* Find the address of each argument. */ /* Find the address of each argument. */
for (i = 0; i < cif->nargs; i++) for (i = 0; i < cif->nargs; i++)
{ {
@ -201,6 +207,7 @@ void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3,
case FFI_TYPE_SINT32: case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32: case FFI_TYPE_UINT32:
case FFI_TYPE_FLOAT: case FFI_TYPE_FLOAT:
case FFI_TYPE_POINTER:
avalue[i] = ptr; avalue[i] = ptr;
break; break;
case FFI_TYPE_STRUCT: case FFI_TYPE_STRUCT:
@ -216,30 +223,21 @@ void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3,
/* If we've handled more arguments than fit in registers, /* If we've handled more arguments than fit in registers,
start looking at the those passed on the stack. */ start looking at the those passed on the stack. */
if (ptr == ((char *)register_args + (6*4))) if (ptr == &register_args[6])
ptr = stack_args; ptr = stack_args;
} }
/* Invoke the closure. */ /* Invoke the closure. */
if (cif->rtype->type == FFI_TYPE_STRUCT) if (cif->rtype && (cif->rtype->type == FFI_TYPE_STRUCT))
{ {
/* The caller allocates space for the return structure, and (closure->fun) (cif, struct_rvalue, avalue, closure->user_data);
passes a pointer to this space in gr3. Use this value directly
as the return value. */
register void *return_struct_ptr __asm__("gr3");
(closure->fun) (cif, return_struct_ptr, avalue, closure->user_data);
} }
else else
{ {
/* Allocate space for the return value and call the function. */ /* Allocate space for the return value and call the function. */
long long rvalue; long long rvalue;
(closure->fun) (cif, &rvalue, avalue, closure->user_data); (closure->fun) (cif, &rvalue, avalue, closure->user_data);
asm ("mov $r12, %0\n ld.l $r0, ($r12)\n ldo.l $r1, 4($r12)" : : "r" (&rvalue));
/* Functions return 4-byte or smaller results in gr8. 8-byte
values also use gr9. We fill the both, even for small return
values, just to avoid a branch. */
asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue));
asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1]));
} }
} }
@ -250,27 +248,25 @@ ffi_prep_closure_loc (ffi_closure* closure,
void *user_data, void *user_data,
void *codeloc) void *codeloc)
{ {
unsigned int *tramp = (unsigned int *) &closure->tramp[0]; unsigned short *tramp = (unsigned short *) &closure->tramp[0];
unsigned long fn = (long) ffi_closure_eabi; unsigned long fn = (long) ffi_closure_eabi;
unsigned long cls = (long) codeloc; unsigned long cls = (long) codeloc;
int i;
if (cif->abi != FFI_EABI)
return FFI_BAD_ABI;
fn = (unsigned long) ffi_closure_eabi; fn = (unsigned long) ffi_closure_eabi;
tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ tramp[0] = 0x01e0; /* ldi.l $r7, .... */
tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ tramp[1] = cls >> 16;
tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ tramp[2] = cls & 0xffff;
tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ tramp[3] = 0x1a00; /* jmpa .... */
tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ tramp[4] = fn >> 16;
tramp[5] = fn & 0xffff;
closure->cif = cif; closure->cif = cif;
closure->fun = fun; closure->fun = fun;
closure->user_data = user_data; closure->user_data = user_data;
/* Cache flushing. */
for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++)
__asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i),
"r" (codeloc));
return FFI_OK; return FFI_OK;
} }

View File

@ -0,0 +1,52 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 2012, 2013 Anthony Green
Target configuration macros for Moxie
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
/* ---- System specific configurations ----------------------------------- */
#ifndef LIBFFI_ASM
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,
FFI_EABI,
FFI_DEFAULT_ABI = FFI_EABI,
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_NATIVE_RAW_API 0
/* Trampolines are 12-bytes long. See ffi_prep_closure_loc. */
#define FFI_TRAMPOLINE_SIZE (12)
#endif

View File

@ -137,7 +137,7 @@ ffi_call_AIX:
mtcrf 0x40, r31 mtcrf 0x40, r31
mtctr r0 mtctr r0
/* Load all those argument registers. */ /* Load all those argument registers. */
// We have set up a nice stack frame, just load it into registers. /* We have set up a nice stack frame, just load it into registers. */
ld r3, 40+(1*8)(r1) ld r3, 40+(1*8)(r1)
ld r4, 40+(2*8)(r1) ld r4, 40+(2*8)(r1)
ld r5, 40+(3*8)(r1) ld r5, 40+(3*8)(r1)
@ -150,7 +150,7 @@ ffi_call_AIX:
L1: L1:
/* Load all the FP registers. */ /* Load all the FP registers. */
bf 6,L2 // 2f + 0x18 bf 6,L2 /* 2f + 0x18 */
lfd f1,-32-(13*8)(r28) lfd f1,-32-(13*8)(r28)
lfd f2,-32-(12*8)(r28) lfd f2,-32-(12*8)(r28)
lfd f3,-32-(11*8)(r28) lfd f3,-32-(11*8)(r28)
@ -239,7 +239,7 @@ L(float_return_value):
mtcrf 0x40, r31 mtcrf 0x40, r31
mtctr r0 mtctr r0
/* Load all those argument registers. */ /* Load all those argument registers. */
// We have set up a nice stack frame, just load it into registers. /* We have set up a nice stack frame, just load it into registers. */
lwz r3, 20+(1*4)(r1) lwz r3, 20+(1*4)(r1)
lwz r4, 20+(2*4)(r1) lwz r4, 20+(2*4)(r1)
lwz r5, 20+(3*4)(r1) lwz r5, 20+(3*4)(r1)
@ -252,7 +252,7 @@ L(float_return_value):
L1: L1:
/* Load all the FP registers. */ /* Load all the FP registers. */
bf 6,L2 // 2f + 0x18 bf 6,L2 /* 2f + 0x18 */
lfd f1,-16-(13*8)(r28) lfd f1,-16-(13*8)(r28)
lfd f2,-16-(12*8)(r28) lfd f2,-16-(12*8)(r28)
lfd f3,-16-(11*8)(r28) lfd f3,-16-(11*8)(r28)
@ -307,7 +307,7 @@ L(float_return_value):
#endif #endif
.long 0 .long 0
.byte 0,0,0,1,128,4,0,0 .byte 0,0,0,1,128,4,0,0
//END(ffi_call_AIX) /* END(ffi_call_AIX) */
.csect .text[PR] .csect .text[PR]
.align 2 .align 2
@ -325,4 +325,4 @@ ffi_call_DARWIN:
blr blr
.long 0 .long 0
.byte 0,0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0
//END(ffi_call_DARWIN) /* END(ffi_call_DARWIN) */

View File

@ -48,6 +48,11 @@ enum {
FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */ FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */
FLAG_SYSV_SMST_R4 = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte
structs. */
FLAG_SYSV_SMST_R3 = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte
structs. */
FLAG_ARG_NEEDS_COPY = 1 << (31- 7), FLAG_ARG_NEEDS_COPY = 1 << (31- 7),
#ifndef __NO_FPRS__ #ifndef __NO_FPRS__
FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */
@ -367,6 +372,12 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
/* Check that we didn't overrun the stack... */ /* Check that we didn't overrun the stack... */
FFI_ASSERT (copy_space.c >= next_arg.c); FFI_ASSERT (copy_space.c >= next_arg.c);
FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS);
/* The assert below is testing that the number of integer arguments agrees
with the number found in ffi_prep_cif_machdep(). However, intarg_count
is incremeneted whenever we place an FP arg on the stack, so account for
that before our assert test. */
if (fparg_count > NUM_FPR_ARG_REGISTERS)
intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS;
#ifndef __NO_FPRS__ #ifndef __NO_FPRS__
FFI_ASSERT (fpr_base.u FFI_ASSERT (fpr_base.u
<= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS);
@ -664,9 +675,11 @@ ffi_prep_cif_machdep (ffi_cif *cif)
switch (type) switch (type)
{ {
#ifndef __NO_FPRS__ #ifndef __NO_FPRS__
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE: case FFI_TYPE_LONGDOUBLE:
flags |= FLAG_RETURNS_128BITS; flags |= FLAG_RETURNS_128BITS;
/* Fall through. */ /* Fall through. */
#endif
case FFI_TYPE_DOUBLE: case FFI_TYPE_DOUBLE:
flags |= FLAG_RETURNS_64BITS; flags |= FLAG_RETURNS_64BITS;
/* Fall through. */ /* Fall through. */
@ -684,18 +697,35 @@ ffi_prep_cif_machdep (ffi_cif *cif)
break; break;
case FFI_TYPE_STRUCT: case FFI_TYPE_STRUCT:
/* if (cif->abi == FFI_SYSV)
* The final SYSV ABI says that structures smaller or equal 8 bytes {
* are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them /* The final SYSV ABI says that structures smaller or equal 8 bytes
* in memory. are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them
* in memory. */
* NOTE: The assembly code can safely assume that it just needs to
* store both r3 and r4 into a 8-byte word-aligned buffer, as /* Treat structs with size <= 8 bytes. */
* we allocate a temporary buffer in ffi_call() if this flag is if (size <= 8)
* set. {
*/ flags |= FLAG_RETURNS_SMST;
if (cif->abi == FFI_SYSV && size <= 8) /* These structs are returned in r3. We pack the type and the
flags |= FLAG_RETURNS_SMST; precalculated shift value (needed in the sysv.S) into flags.
The same applies for the structs returned in r3/r4. */
if (size <= 4)
{
flags |= FLAG_SYSV_SMST_R3;
flags |= 8 * (4 - size) << 8;
break;
}
/* These structs are returned in r3 and r4. See above. */
if (size <= 8)
{
flags |= FLAG_SYSV_SMST_R3 | FLAG_SYSV_SMST_R4;
flags |= 8 * (8 - size) << 8;
break;
}
}
}
intarg_count++; intarg_count++;
flags |= FLAG_RETVAL_REFERENCE; flags |= FLAG_RETVAL_REFERENCE;
/* Fall through. */ /* Fall through. */

View File

@ -302,10 +302,10 @@ ffi_prep_args (extended_cif *ecif, unsigned long *const stack)
} }
/* Check that we didn't overrun the stack... */ /* Check that we didn't overrun the stack... */
//FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); /* FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS);
//FFI_ASSERT((unsigned *)fpr_base FFI_ASSERT((unsigned *)fpr_base
// <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS);
//FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); */
} }
#if defined(POWERPC_DARWIN64) #if defined(POWERPC_DARWIN64)

View File

@ -30,16 +30,25 @@
#include <ffi.h> #include <ffi.h>
#ifdef __powerpc64__ #ifdef __powerpc64__
.hidden ffi_call_LINUX64, .ffi_call_LINUX64 .hidden ffi_call_LINUX64
.globl ffi_call_LINUX64, .ffi_call_LINUX64 .globl ffi_call_LINUX64
.section ".opd","aw" .section ".opd","aw"
.align 3 .align 3
ffi_call_LINUX64: ffi_call_LINUX64:
#ifdef _CALL_LINUX
.quad .L.ffi_call_LINUX64,.TOC.@tocbase,0
.type ffi_call_LINUX64,@function
.text
.L.ffi_call_LINUX64:
#else
.hidden .ffi_call_LINUX64
.globl .ffi_call_LINUX64
.quad .ffi_call_LINUX64,.TOC.@tocbase,0 .quad .ffi_call_LINUX64,.TOC.@tocbase,0
.size ffi_call_LINUX64,24 .size ffi_call_LINUX64,24
.type .ffi_call_LINUX64,@function .type .ffi_call_LINUX64,@function
.text .text
.ffi_call_LINUX64: .ffi_call_LINUX64:
#endif
.LFB1: .LFB1:
mflr %r0 mflr %r0
std %r28, -32(%r1) std %r28, -32(%r1)
@ -58,7 +67,11 @@ ffi_call_LINUX64:
/* Call ffi_prep_args64. */ /* Call ffi_prep_args64. */
mr %r4, %r1 mr %r4, %r1
#ifdef _CALL_LINUX
bl ffi_prep_args64
#else
bl .ffi_prep_args64 bl .ffi_prep_args64
#endif
ld %r0, 0(%r29) ld %r0, 0(%r29)
ld %r2, 8(%r29) ld %r2, 8(%r29)
@ -137,7 +150,11 @@ ffi_call_LINUX64:
.LFE1: .LFE1:
.long 0 .long 0
.byte 0,12,0,1,128,4,0,0 .byte 0,12,0,1,128,4,0,0
#ifdef _CALL_LINUX
.size ffi_call_LINUX64,.-.L.ffi_call_LINUX64
#else
.size .ffi_call_LINUX64,.-.ffi_call_LINUX64 .size .ffi_call_LINUX64,.-.ffi_call_LINUX64
#endif
.section .eh_frame,EH_FRAME_FLAGS,@progbits .section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1: .Lframe1:

View File

@ -32,16 +32,24 @@
#ifdef __powerpc64__ #ifdef __powerpc64__
FFI_HIDDEN (ffi_closure_LINUX64) FFI_HIDDEN (ffi_closure_LINUX64)
FFI_HIDDEN (.ffi_closure_LINUX64) .globl ffi_closure_LINUX64
.globl ffi_closure_LINUX64, .ffi_closure_LINUX64
.section ".opd","aw" .section ".opd","aw"
.align 3 .align 3
ffi_closure_LINUX64: ffi_closure_LINUX64:
#ifdef _CALL_LINUX
.quad .L.ffi_closure_LINUX64,.TOC.@tocbase,0
.type ffi_closure_LINUX64,@function
.text
.L.ffi_closure_LINUX64:
#else
FFI_HIDDEN (.ffi_closure_LINUX64)
.globl .ffi_closure_LINUX64
.quad .ffi_closure_LINUX64,.TOC.@tocbase,0 .quad .ffi_closure_LINUX64,.TOC.@tocbase,0
.size ffi_closure_LINUX64,24 .size ffi_closure_LINUX64,24
.type .ffi_closure_LINUX64,@function .type .ffi_closure_LINUX64,@function
.text .text
.ffi_closure_LINUX64: .ffi_closure_LINUX64:
#endif
.LFB1: .LFB1:
# save general regs into parm save area # save general regs into parm save area
std %r3, 48(%r1) std %r3, 48(%r1)
@ -91,7 +99,11 @@ ffi_closure_LINUX64:
addi %r6, %r1, 128 addi %r6, %r1, 128
# make the call # make the call
#ifdef _CALL_LINUX
bl ffi_closure_helper_LINUX64
#else
bl .ffi_closure_helper_LINUX64 bl .ffi_closure_helper_LINUX64
#endif
.Lret: .Lret:
# now r3 contains the return type # now r3 contains the return type
@ -194,7 +206,11 @@ ffi_closure_LINUX64:
.LFE1: .LFE1:
.long 0 .long 0
.byte 0,12,0,1,128,0,0,0 .byte 0,12,0,1,128,0,0,0
#ifdef _CALL_LINUX
.size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64
#else
.size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64
#endif
.section .eh_frame,EH_FRAME_FLAGS,@progbits .section .eh_frame,EH_FRAME_FLAGS,@progbits
.Lframe1: .Lframe1:

View File

@ -142,14 +142,19 @@ L(float_return_value):
#endif #endif
L(small_struct_return_value): L(small_struct_return_value):
/* extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */
* The C code always allocates a properly-aligned 8-byte bounce mtcrf 0x02,%r31 /* copy flags to cr[24:27] (cr6) */
* buffer to make this assembly code very simple. Just write out extrwi %r5,%r31,5,19 /* r5 <- number of bits of padding */
* r3 and r4 to the buffer to allow the C code to handle the rest. subfic %r6,%r6,4 /* r6 <- number of useful bytes in r3 */
*/ bf- 25,L(done_return_value) /* struct in r3 ? if not, done. */
stw %r3, 0(%r30) /* smst_one_register: */
stw %r4, 4(%r30) slw %r3,%r3,%r5 /* Left-justify value in r3 */
b L(done_return_value) mtxer %r6 /* move byte count to XER ... */
stswx %r3,0,%r30 /* ... and store that many bytes */
bf+ 26,L(done_return_value) /* struct in r3:r4 ? */
add %r6,%r6,%r30 /* adjust pointer */
stswi %r4,%r6,4 /* store last four bytes */
b L(done_return_value)
.LFE1: .LFE1:
END(ffi_call_SYSV) END(ffi_call_SYSV)

View File

@ -140,6 +140,13 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
#ifdef SPARC #ifdef SPARC
&& (cif->abi != FFI_V9 || cif->rtype->size > 32) && (cif->abi != FFI_V9 || cif->rtype->size > 32)
#endif #endif
#ifdef TILE
&& (cif->rtype->size > 10 * FFI_SIZEOF_ARG)
#endif
#ifdef XTENSA
&& (cif->rtype->size > 16)
#endif
) )
bytes = STACK_ARG_SIZE(sizeof(void*)); bytes = STACK_ARG_SIZE(sizeof(void*));
#endif #endif
@ -169,6 +176,20 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
if (((*ptr)->alignment - 1) & bytes) if (((*ptr)->alignment - 1) & bytes)
bytes = ALIGN(bytes, (*ptr)->alignment); bytes = ALIGN(bytes, (*ptr)->alignment);
#ifdef TILE
if (bytes < 10 * FFI_SIZEOF_ARG &&
bytes + STACK_ARG_SIZE((*ptr)->size) > 10 * FFI_SIZEOF_ARG)
{
/* An argument is never split between the 10 parameter
registers and the stack. */
bytes = 10 * FFI_SIZEOF_ARG;
}
#endif
#ifdef XTENSA
if (bytes <= 6*4 && bytes + STACK_ARG_SIZE((*ptr)->size) > 6*4)
bytes = 6*4;
#endif
bytes += STACK_ARG_SIZE((*ptr)->size); bytes += STACK_ARG_SIZE((*ptr)->size);
} }
#endif #endif

View File

@ -750,7 +750,8 @@ ffi_prep_closure_loc (ffi_closure *closure,
void *user_data, void *user_data,
void *codeloc) void *codeloc)
{ {
FFI_ASSERT (cif->abi == FFI_SYSV); if (cif->abi != FFI_SYSV)
return FFI_BAD_ABI;
#ifndef __s390x__ #ifndef __s390x__
*(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */

View File

@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
ffi.c - Copyright (c) 2011 Anthony Green ffi.c - Copyright (c) 2011, 2013 Anthony Green
Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc. Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc.
SPARC Foreign Function Interface SPARC Foreign Function Interface
@ -376,6 +376,10 @@ extern int ffi_call_v8(void *, extended_cif *, unsigned,
unsigned, unsigned *, void (*fn)(void)); unsigned, unsigned *, void (*fn)(void));
#endif #endif
#ifndef __GNUC__
void ffi_flush_icache (void *, size_t);
#endif
void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
{ {
extended_cif ecif; extended_cif ecif;
@ -417,7 +421,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
/* behind "call", so we alloc some executable space for it. */ /* behind "call", so we alloc some executable space for it. */
/* l7 is used, we need to make sure v8.S doesn't use %l7. */ /* l7 is used, we need to make sure v8.S doesn't use %l7. */
unsigned int *call_struct = NULL; unsigned int *call_struct = NULL;
ffi_closure_alloc(32, &call_struct); ffi_closure_alloc(32, (void **)&call_struct);
if (call_struct) if (call_struct)
{ {
unsigned long f = (unsigned long)fn; unsigned long f = (unsigned long)fn;
@ -432,10 +436,14 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
call_struct[5] = 0x01000000; /* nop */ call_struct[5] = 0x01000000; /* nop */
call_struct[6] = 0x81c7e008; /* ret */ call_struct[6] = 0x81c7e008; /* ret */
call_struct[7] = 0xbe100017; /* mov %l7, %i7 */ call_struct[7] = 0xbe100017; /* mov %l7, %i7 */
#ifdef __GNUC__
asm volatile ("iflush %0; iflush %0+8; iflush %0+16; iflush %0+24" : : asm volatile ("iflush %0; iflush %0+8; iflush %0+16; iflush %0+24" : :
"r" (call_struct) : "memory"); "r" (call_struct) : "memory");
/* SPARC v8 requires 5 instructions for flush to be visible */ /* SPARC v8 requires 5 instructions for flush to be visible */
asm volatile ("nop; nop; nop; nop; nop"); asm volatile ("nop; nop; nop; nop; nop");
#else
ffi_flush_icache (call_struct, 32);
#endif
ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes,
cif->flags, rvalue, call_struct); cif->flags, rvalue, call_struct);
ffi_closure_free(call_struct); ffi_closure_free(call_struct);
@ -513,6 +521,7 @@ ffi_prep_closure_loc (ffi_closure* closure,
closure->user_data = user_data; closure->user_data = user_data;
/* Flush the Icache. closure is 8 bytes aligned. */ /* Flush the Icache. closure is 8 bytes aligned. */
#ifdef __GNUC__
#ifdef SPARC64 #ifdef SPARC64
asm volatile ("flush %0; flush %0+8" : : "r" (closure) : "memory"); asm volatile ("flush %0; flush %0+8" : : "r" (closure) : "memory");
#else #else
@ -520,6 +529,9 @@ ffi_prep_closure_loc (ffi_closure* closure,
/* SPARC v8 requires 5 instructions for flush to be visible */ /* SPARC v8 requires 5 instructions for flush to be visible */
asm volatile ("nop; nop; nop; nop; nop"); asm volatile ("nop; nop; nop; nop; nop");
#endif #endif
#else
ffi_flush_icache (closure, 16);
#endif
return FFI_OK; return FFI_OK;
} }

View File

@ -1,5 +1,6 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
v8.S - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. v8.S - Copyright (c) 2013 The Written Word, Inc.
Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc.
SPARC Foreign Function Interface SPARC Foreign Function Interface
@ -31,7 +32,35 @@
#define STACKFRAME 96 /* Minimum stack framesize for SPARC */ #define STACKFRAME 96 /* Minimum stack framesize for SPARC */
#define ARGS (64+4) /* Offset of register area in frame */ #define ARGS (64+4) /* Offset of register area in frame */
.text #ifndef __GNUC__
.text
.align 8
.globl ffi_flush_icache
.globl _ffi_flush_icache
ffi_flush_icache:
_ffi_flush_icache:
add %o0, %o1, %o2
#ifdef SPARC64
1: flush %o0
#else
1: iflush %o0
#endif
add %o0, 8, %o0
cmp %o0, %o2
blt 1b
nop
nop
nop
nop
nop
retl
nop
.ffi_flush_icache_end:
.size ffi_flush_icache,.ffi_flush_icache_end-ffi_flush_icache
#endif
.text
.align 8 .align 8
.globl ffi_call_v8 .globl ffi_call_v8
.globl _ffi_call_v8 .globl _ffi_call_v8

View File

@ -0,0 +1,355 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 2012 Tilera Corp.
TILE Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <arch/abi.h>
#include <arch/icache.h>
#include <arch/opcode.h>
/* The first 10 registers are used to pass arguments and return values. */
#define NUM_ARG_REGS 10
/* Performs a raw function call with the given NUM_ARG_REGS register arguments
and the specified additional stack arguments (if any). */
extern void ffi_call_tile(ffi_sarg reg_args[NUM_ARG_REGS],
const ffi_sarg *stack_args,
size_t stack_args_bytes,
void (*fnaddr)(void))
FFI_HIDDEN;
/* This handles the raw call from the closure stub, cleaning up the
parameters and delegating to ffi_closure_tile_inner. */
extern void ffi_closure_tile(void) FFI_HIDDEN;
ffi_status
ffi_prep_cif_machdep(ffi_cif *cif)
{
/* We always allocate room for all registers. Even if we don't
use them as parameters, they get returned in the same array
as struct return values so we need to make room. */
if (cif->bytes < NUM_ARG_REGS * FFI_SIZEOF_ARG)
cif->bytes = NUM_ARG_REGS * FFI_SIZEOF_ARG;
if (cif->rtype->size > NUM_ARG_REGS * FFI_SIZEOF_ARG)
cif->flags = FFI_TYPE_STRUCT;
else
cif->flags = FFI_TYPE_INT;
/* Nothing to do. */
return FFI_OK;
}
static long
assign_to_ffi_arg(ffi_sarg *out, void *in, const ffi_type *type,
int write_to_reg)
{
switch (type->type)
{
case FFI_TYPE_SINT8:
*out = *(SINT8 *)in;
return 1;
case FFI_TYPE_UINT8:
*out = *(UINT8 *)in;
return 1;
case FFI_TYPE_SINT16:
*out = *(SINT16 *)in;
return 1;
case FFI_TYPE_UINT16:
*out = *(UINT16 *)in;
return 1;
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
#ifndef __LP64__
case FFI_TYPE_POINTER:
#endif
/* Note that even unsigned 32-bit quantities are sign extended
on tilegx when stored in a register. */
*out = *(SINT32 *)in;
return 1;
case FFI_TYPE_FLOAT:
#ifdef __tilegx__
if (write_to_reg)
{
/* Properly sign extend the value. */
union { float f; SINT32 s32; } val;
val.f = *(float *)in;
*out = val.s32;
}
else
#endif
{
*(float *)out = *(float *)in;
}
return 1;
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
case FFI_TYPE_DOUBLE:
#ifdef __LP64__
case FFI_TYPE_POINTER:
#endif
*(UINT64 *)out = *(UINT64 *)in;
return sizeof(UINT64) / FFI_SIZEOF_ARG;
case FFI_TYPE_STRUCT:
memcpy(out, in, type->size);
return (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG;
case FFI_TYPE_VOID:
/* Must be a return type. Nothing to do. */
return 0;
default:
FFI_ASSERT(0);
return -1;
}
}
void
ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
{
ffi_sarg * const arg_mem = alloca(cif->bytes);
ffi_sarg * const reg_args = arg_mem;
ffi_sarg * const stack_args = &reg_args[NUM_ARG_REGS];
ffi_sarg *argp = arg_mem;
ffi_type ** const arg_types = cif->arg_types;
const long num_args = cif->nargs;
long i;
if (cif->flags == FFI_TYPE_STRUCT)
{
/* Pass a hidden pointer to the return value. We make sure there
is scratch space for the callee to store the return value even if
our caller doesn't care about it. */
*argp++ = (intptr_t)(rvalue ? rvalue : alloca(cif->rtype->size));
/* No more work needed to return anything. */
rvalue = NULL;
}
for (i = 0; i < num_args; i++)
{
ffi_type *type = arg_types[i];
void * const arg_in = avalue[i];
ptrdiff_t arg_word = argp - arg_mem;
#ifndef __tilegx__
/* Doubleword-aligned values are always in an even-number register
pair, or doubleword-aligned stack slot if out of registers. */
long align = arg_word & (type->alignment > FFI_SIZEOF_ARG);
argp += align;
arg_word += align;
#endif
if (type->type == FFI_TYPE_STRUCT)
{
const size_t arg_size_in_words =
(type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG;
if (arg_word < NUM_ARG_REGS &&
arg_word + arg_size_in_words > NUM_ARG_REGS)
{
/* Args are not allowed to span registers and the stack. */
argp = stack_args;
}
memcpy(argp, arg_in, type->size);
argp += arg_size_in_words;
}
else
{
argp += assign_to_ffi_arg(argp, arg_in, arg_types[i], 1);
}
}
/* Actually do the call. */
ffi_call_tile(reg_args, stack_args,
cif->bytes - (NUM_ARG_REGS * FFI_SIZEOF_ARG), fn);
if (rvalue != NULL)
assign_to_ffi_arg(rvalue, reg_args, cif->rtype, 0);
}
/* Template code for closure. */
extern const UINT64 ffi_template_tramp_tile[] FFI_HIDDEN;
ffi_status
ffi_prep_closure_loc (ffi_closure *closure,
ffi_cif *cif,
void (*fun)(ffi_cif*, void*, void**, void*),
void *user_data,
void *codeloc)
{
#ifdef __tilegx__
/* TILE-Gx */
SINT64 c;
SINT64 h;
int s;
UINT64 *out;
if (cif->abi != FFI_UNIX)
return FFI_BAD_ABI;
out = (UINT64 *)closure->tramp;
c = (intptr_t)closure;
h = (intptr_t)ffi_closure_tile;
s = 0;
/* Find the smallest shift count that doesn't lose information
(i.e. no need to explicitly insert high bits of the address that
are just the sign extension of the low bits). */
while ((c >> s) != (SINT16)(c >> s) || (h >> s) != (SINT16)(h >> s))
s += 16;
#define OPS(a, b, shift) \
(create_Imm16_X0((a) >> (shift)) | create_Imm16_X1((b) >> (shift)))
/* Emit the moveli. */
*out++ = ffi_template_tramp_tile[0] | OPS(c, h, s);
for (s -= 16; s >= 0; s -= 16)
*out++ = ffi_template_tramp_tile[1] | OPS(c, h, s);
#undef OPS
*out++ = ffi_template_tramp_tile[2];
#else
/* TILEPro */
UINT64 *out;
intptr_t delta;
if (cif->abi != FFI_UNIX)
return FFI_BAD_ABI;
out = (UINT64 *)closure->tramp;
delta = (intptr_t)ffi_closure_tile - (intptr_t)codeloc;
*out++ = ffi_template_tramp_tile[0] | create_JOffLong_X1(delta >> 3);
#endif
closure->cif = cif;
closure->fun = fun;
closure->user_data = user_data;
invalidate_icache(closure->tramp, (char *)out - closure->tramp,
getpagesize());
return FFI_OK;
}
/* This is called by the assembly wrapper for closures. This does
all of the work. On entry reg_args[0] holds the values the registers
had when the closure was invoked. On return reg_args[1] holds the register
values to be returned to the caller (many of which may be garbage). */
void FFI_HIDDEN
ffi_closure_tile_inner(ffi_closure *closure,
ffi_sarg reg_args[2][NUM_ARG_REGS],
ffi_sarg *stack_args)
{
ffi_cif * const cif = closure->cif;
void ** const avalue = alloca(cif->nargs * sizeof(void *));
void *rvalue;
ffi_type ** const arg_types = cif->arg_types;
ffi_sarg * const reg_args_in = reg_args[0];
ffi_sarg * const reg_args_out = reg_args[1];
ffi_sarg * argp;
long i, arg_word, nargs = cif->nargs;
/* Use a union to guarantee proper alignment for double. */
union { ffi_sarg arg[NUM_ARG_REGS]; double d; UINT64 u64; } closure_ret;
/* Start out reading register arguments. */
argp = reg_args_in;
/* Copy the caller's structure return address to that the closure
returns the data directly to the caller. */
if (cif->flags == FFI_TYPE_STRUCT)
{
/* Return by reference via hidden pointer. */
rvalue = (void *)(intptr_t)*argp++;
arg_word = 1;
}
else
{
/* Return the value in registers. */
rvalue = &closure_ret;
arg_word = 0;
}
/* Grab the addresses of the arguments. */
for (i = 0; i < nargs; i++)
{
ffi_type * const type = arg_types[i];
const size_t arg_size_in_words =
(type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG;
#ifndef __tilegx__
/* Doubleword-aligned values are always in an even-number register
pair, or doubleword-aligned stack slot if out of registers. */
long align = arg_word & (type->alignment > FFI_SIZEOF_ARG);
argp += align;
arg_word += align;
#endif
if (arg_word == NUM_ARG_REGS ||
(arg_word < NUM_ARG_REGS &&
arg_word + arg_size_in_words > NUM_ARG_REGS))
{
/* Switch to reading arguments from the stack. */
argp = stack_args;
arg_word = NUM_ARG_REGS;
}
avalue[i] = argp;
argp += arg_size_in_words;
arg_word += arg_size_in_words;
}
/* Invoke the closure. */
closure->fun(cif, rvalue, avalue, closure->user_data);
if (cif->flags != FFI_TYPE_STRUCT)
{
/* Canonicalize for register representation. */
assign_to_ffi_arg(reg_args_out, &closure_ret, cif->rtype, 1);
}
}

View File

@ -0,0 +1,65 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 2012 Tilera Corp.
Target configuration macros for TILE.
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
#include <arch/abi.h>
typedef uint_reg_t ffi_arg;
typedef int_reg_t ffi_sarg;
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,
FFI_UNIX,
FFI_LAST_ABI,
FFI_DEFAULT_ABI = FFI_UNIX
} ffi_abi;
#endif
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#ifdef __tilegx__
/* We always pass 8-byte values, even in -m32 mode. */
# define FFI_SIZEOF_ARG 8
# ifdef __LP64__
# define FFI_TRAMPOLINE_SIZE (8 * 5) /* 5 bundles */
# else
# define FFI_TRAMPOLINE_SIZE (8 * 3) /* 3 bundles */
# endif
#else
# define FFI_SIZEOF_ARG 4
# define FFI_TRAMPOLINE_SIZE 8 /* 1 bundle */
#endif
#define FFI_NATIVE_RAW_API 0
#endif

View File

@ -0,0 +1,360 @@
/* -----------------------------------------------------------------------
tile.S - Copyright (c) 2011 Tilera Corp.
Tilera TILEPro and TILE-Gx Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
/* Number of bytes in a register. */
#define REG_SIZE FFI_SIZEOF_ARG
/* Number of bytes in stack linkage area for backtracing.
A note about the ABI: on entry to a procedure, sp points to a stack
slot where it must spill the return address if it's not a leaf.
REG_SIZE bytes beyond that is a slot owned by the caller which
contains the sp value that the caller had when it was originally
entered (i.e. the caller's frame pointer). */
#define LINKAGE_SIZE (2 * REG_SIZE)
/* The first 10 registers are used to pass arguments and return values. */
#define NUM_ARG_REGS 10
#ifdef __tilegx__
#define SW st
#define LW ld
#define BGZT bgtzt
#else
#define SW sw
#define LW lw
#define BGZT bgzt
#endif
/* void ffi_call_tile (int_reg_t reg_args[NUM_ARG_REGS],
const int_reg_t *stack_args,
unsigned long stack_args_bytes,
void (*fnaddr)(void));
On entry, REG_ARGS contain the outgoing register values,
and STACK_ARGS containts STACK_ARG_BYTES of additional values
to be passed on the stack. If STACK_ARG_BYTES is zero, then
STACK_ARGS is ignored.
When the invoked function returns, the values of r0-r9 are
blindly stored back into REG_ARGS for the caller to examine. */
.section .text.ffi_call_tile, "ax", @progbits
.align 8
.globl ffi_call_tile
FFI_HIDDEN(ffi_call_tile)
ffi_call_tile:
/* Incoming arguments. */
#define REG_ARGS r0
#define INCOMING_STACK_ARGS r1
#define STACK_ARG_BYTES r2
#define ORIG_FNADDR r3
/* Temporary values. */
#define FRAME_SIZE r10
#define TMP r11
#define TMP2 r12
#define OUTGOING_STACK_ARGS r13
#define REG_ADDR_PTR r14
#define RETURN_REG_ADDR r15
#define FNADDR r16
.cfi_startproc
{
/* Save return address. */
SW sp, lr
.cfi_offset lr, 0
/* Prepare to spill incoming r52. */
addi TMP, sp, -REG_SIZE
/* Increase frame size to have room to spill r52 and REG_ARGS.
The +7 is to round up mod 8. */
addi FRAME_SIZE, STACK_ARG_BYTES, \
REG_SIZE + REG_SIZE + LINKAGE_SIZE + 7
}
{
/* Round stack frame size to a multiple of 8 to satisfy ABI. */
andi FRAME_SIZE, FRAME_SIZE, -8
/* Compute where to spill REG_ARGS value. */
addi TMP2, sp, -(REG_SIZE * 2)
}
{
/* Spill incoming r52. */
SW TMP, r52
.cfi_offset r52, -REG_SIZE
/* Set up our frame pointer. */
move r52, sp
.cfi_def_cfa_register r52
/* Push stack frame. */
sub sp, sp, FRAME_SIZE
}
{
/* Prepare to set up stack linkage. */
addi TMP, sp, REG_SIZE
/* Prepare to memcpy stack args. */
addi OUTGOING_STACK_ARGS, sp, LINKAGE_SIZE
/* Save REG_ARGS which we will need after we call the subroutine. */
SW TMP2, REG_ARGS
}
{
/* Set up linkage info to hold incoming stack pointer. */
SW TMP, r52
}
{
/* Skip stack args memcpy if we don't have any stack args (common). */
blezt STACK_ARG_BYTES, .Ldone_stack_args_memcpy
}
.Lmemcpy_stack_args:
{
/* Load incoming argument from stack_args. */
LW TMP, INCOMING_STACK_ARGS
addi INCOMING_STACK_ARGS, INCOMING_STACK_ARGS, REG_SIZE
}
{
/* Store stack argument into outgoing stack argument area. */
SW OUTGOING_STACK_ARGS, TMP
addi OUTGOING_STACK_ARGS, OUTGOING_STACK_ARGS, REG_SIZE
addi STACK_ARG_BYTES, STACK_ARG_BYTES, -REG_SIZE
}
{
BGZT STACK_ARG_BYTES, .Lmemcpy_stack_args
}
.Ldone_stack_args_memcpy:
{
/* Copy aside ORIG_FNADDR so we can overwrite its register. */
move FNADDR, ORIG_FNADDR
/* Prepare to load argument registers. */
addi REG_ADDR_PTR, r0, REG_SIZE
/* Load outgoing r0. */
LW r0, r0
}
/* Load up argument registers from the REG_ARGS array. */
#define LOAD_REG(REG, PTR) \
{ \
LW REG, PTR ; \
addi PTR, PTR, REG_SIZE \
}
LOAD_REG(r1, REG_ADDR_PTR)
LOAD_REG(r2, REG_ADDR_PTR)
LOAD_REG(r3, REG_ADDR_PTR)
LOAD_REG(r4, REG_ADDR_PTR)
LOAD_REG(r5, REG_ADDR_PTR)
LOAD_REG(r6, REG_ADDR_PTR)
LOAD_REG(r7, REG_ADDR_PTR)
LOAD_REG(r8, REG_ADDR_PTR)
LOAD_REG(r9, REG_ADDR_PTR)
{
/* Call the subroutine. */
jalr FNADDR
}
{
/* Restore original lr. */
LW lr, r52
/* Prepare to recover ARGS, which we spilled earlier. */
addi TMP, r52, -(2 * REG_SIZE)
}
{
/* Restore ARGS, so we can fill it in with the return regs r0-r9. */
LW RETURN_REG_ADDR, TMP
/* Prepare to restore original r52. */
addi TMP, r52, -REG_SIZE
}
{
/* Pop stack frame. */
move sp, r52
/* Restore original r52. */
LW r52, TMP
}
#define STORE_REG(REG, PTR) \
{ \
SW PTR, REG ; \
addi PTR, PTR, REG_SIZE \
}
/* Return all register values by reference. */
STORE_REG(r0, RETURN_REG_ADDR)
STORE_REG(r1, RETURN_REG_ADDR)
STORE_REG(r2, RETURN_REG_ADDR)
STORE_REG(r3, RETURN_REG_ADDR)
STORE_REG(r4, RETURN_REG_ADDR)
STORE_REG(r5, RETURN_REG_ADDR)
STORE_REG(r6, RETURN_REG_ADDR)
STORE_REG(r7, RETURN_REG_ADDR)
STORE_REG(r8, RETURN_REG_ADDR)
STORE_REG(r9, RETURN_REG_ADDR)
{
jrp lr
}
.cfi_endproc
.size ffi_call_tile, .-ffi_call_tile
/* ffi_closure_tile(...)
On entry, lr points to the closure plus 8 bytes, and r10
contains the actual return address.
This function simply dumps all register parameters into a stack array
and passes the closure, the registers array, and the stack arguments
to C code that does all of the actual closure processing. */
.section .text.ffi_closure_tile, "ax", @progbits
.align 8
.globl ffi_closure_tile
FFI_HIDDEN(ffi_closure_tile)
.cfi_startproc
/* Room to spill all NUM_ARG_REGS incoming registers, plus frame linkage. */
#define CLOSURE_FRAME_SIZE (((NUM_ARG_REGS * REG_SIZE * 2 + LINKAGE_SIZE) + 7) & -8)
ffi_closure_tile:
{
#ifdef __tilegx__
st sp, lr
.cfi_offset lr, 0
#else
/* Save return address (in r10 due to closure stub wrapper). */
SW sp, r10
.cfi_return_column r10
.cfi_offset r10, 0
#endif
/* Compute address for stack frame linkage. */
addli r10, sp, -(CLOSURE_FRAME_SIZE - REG_SIZE)
}
{
/* Save incoming stack pointer in linkage area. */
SW r10, sp
.cfi_offset sp, -(CLOSURE_FRAME_SIZE - REG_SIZE)
/* Push a new stack frame. */
addli sp, sp, -CLOSURE_FRAME_SIZE
.cfi_adjust_cfa_offset CLOSURE_FRAME_SIZE
}
{
/* Create pointer to where to start spilling registers. */
addi r10, sp, LINKAGE_SIZE
}
/* Spill all the incoming registers. */
STORE_REG(r0, r10)
STORE_REG(r1, r10)
STORE_REG(r2, r10)
STORE_REG(r3, r10)
STORE_REG(r4, r10)
STORE_REG(r5, r10)
STORE_REG(r6, r10)
STORE_REG(r7, r10)
STORE_REG(r8, r10)
{
/* Save r9. */
SW r10, r9
#ifdef __tilegx__
/* Pointer to closure is passed in r11. */
move r0, r11
#else
/* Compute pointer to the closure object. Because the closure
starts with a "jal ffi_closure_tile", we can just take the
value of lr (a phony return address pointing into the closure)
and subtract 8. */
addi r0, lr, -8
#endif
/* Compute a pointer to the register arguments we just spilled. */
addi r1, sp, LINKAGE_SIZE
}
{
/* Compute a pointer to the extra stack arguments (if any). */
addli r2, sp, CLOSURE_FRAME_SIZE + LINKAGE_SIZE
/* Call C code to deal with all of the grotty details. */
jal ffi_closure_tile_inner
}
{
addli r10, sp, CLOSURE_FRAME_SIZE
}
{
/* Restore the return address. */
LW lr, r10
/* Compute pointer to registers array. */
addli r10, sp, LINKAGE_SIZE + (NUM_ARG_REGS * REG_SIZE)
}
/* Return all the register values, which C code may have set. */
LOAD_REG(r0, r10)
LOAD_REG(r1, r10)
LOAD_REG(r2, r10)
LOAD_REG(r3, r10)
LOAD_REG(r4, r10)
LOAD_REG(r5, r10)
LOAD_REG(r6, r10)
LOAD_REG(r7, r10)
LOAD_REG(r8, r10)
LOAD_REG(r9, r10)
{
/* Pop the frame. */
addli sp, sp, CLOSURE_FRAME_SIZE
jrp lr
}
.cfi_endproc
.size ffi_closure_tile, . - ffi_closure_tile
/* What follows are code template instructions that get copied to the
closure trampoline by ffi_prep_closure_loc. The zeroed operands
get replaced by their proper values at runtime. */
.section .text.ffi_template_tramp_tile, "ax", @progbits
.align 8
.globl ffi_template_tramp_tile
FFI_HIDDEN(ffi_template_tramp_tile)
ffi_template_tramp_tile:
#ifdef __tilegx__
{
moveli r11, 0 /* backpatched to address of containing closure. */
moveli r10, 0 /* backpatched to ffi_closure_tile. */
}
/* Note: the following bundle gets generated multiple times
depending on the pointer value (esp. useful for -m32 mode). */
{ shl16insli r11, r11, 0 ; shl16insli r10, r10, 0 }
{ info 2+8 /* for backtracer: -> pc in lr, frame size 0 */ ; jr r10 }
#else
/* 'jal .' yields a PC-relative offset of zero so we can OR in the
right offset at runtime. */
{ move r10, lr ; jal . /* ffi_closure_tile */ }
#endif
.size ffi_template_tramp_tile, . - ffi_template_tramp_tile

View File

@ -424,7 +424,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
/** private members **/ /** private members **/
/* The following __attribute__((regparm(1))) decorations will have no effect /* The following __attribute__((regparm(1))) decorations will have no effect
on MSVC - standard cdecl convention applies. */ on MSVC or SUNPRO_C -- standard conventions apply. */
static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, static void ffi_prep_incoming_args_SYSV (char *stack, void **ret,
void** args, ffi_cif* cif); void** args, ffi_cif* cif);
void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *)

View File

@ -1,5 +1,6 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
ffi64.c - Copyright (c) 20011 Anthony Green ffi64.c - Copyright (c) 2013 The Written Word, Inc.
Copyright (c) 2011 Anthony Green
Copyright (c) 2008, 2010 Red Hat, Inc. Copyright (c) 2008, 2010 Red Hat, Inc.
Copyright (c) 2002, 2007 Bo Thorsen <bo@suse.de> Copyright (c) 2002, 2007 Bo Thorsen <bo@suse.de>
@ -37,17 +38,29 @@
#define MAX_GPR_REGS 6 #define MAX_GPR_REGS 6
#define MAX_SSE_REGS 8 #define MAX_SSE_REGS 8
#ifdef __INTEL_COMPILER #if defined(__INTEL_COMPILER)
#define UINT128 __m128 #define UINT128 __m128
#else #else
#if defined(__SUNPRO_C)
#include <sunmedia_types.h>
#define UINT128 __m128i
#else
#define UINT128 __int128_t #define UINT128 __int128_t
#endif #endif
#endif
union big_int_union
{
UINT32 i32;
UINT64 i64;
UINT128 i128;
};
struct register_args struct register_args
{ {
/* Registers for argument passing. */ /* Registers for argument passing. */
UINT64 gpr[MAX_GPR_REGS]; UINT64 gpr[MAX_GPR_REGS];
UINT128 sse[MAX_SSE_REGS]; union big_int_union sse[MAX_SSE_REGS];
}; };
extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
@ -471,16 +484,33 @@ ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
{ {
case X86_64_INTEGER_CLASS: case X86_64_INTEGER_CLASS:
case X86_64_INTEGERSI_CLASS: case X86_64_INTEGERSI_CLASS:
reg_args->gpr[gprcount] = 0; /* Sign-extend integer arguments passed in general
memcpy (&reg_args->gpr[gprcount], a, size < 8 ? size : 8); purpose registers, to cope with the fact that
LLVM incorrectly assumes that this will be done
(the x86-64 PS ABI does not specify this). */
switch (arg_types[i]->type)
{
case FFI_TYPE_SINT8:
*(SINT64 *)&reg_args->gpr[gprcount] = (SINT64) *((SINT8 *) a);
break;
case FFI_TYPE_SINT16:
*(SINT64 *)&reg_args->gpr[gprcount] = (SINT64) *((SINT16 *) a);
break;
case FFI_TYPE_SINT32:
*(SINT64 *)&reg_args->gpr[gprcount] = (SINT64) *((SINT32 *) a);
break;
default:
reg_args->gpr[gprcount] = 0;
memcpy (&reg_args->gpr[gprcount], a, size < 8 ? size : 8);
}
gprcount++; gprcount++;
break; break;
case X86_64_SSE_CLASS: case X86_64_SSE_CLASS:
case X86_64_SSEDF_CLASS: case X86_64_SSEDF_CLASS:
reg_args->sse[ssecount++] = *(UINT64 *) a; reg_args->sse[ssecount++].i64 = *(UINT64 *) a;
break; break;
case X86_64_SSESF_CLASS: case X86_64_SSESF_CLASS:
reg_args->sse[ssecount++] = *(UINT32 *) a; reg_args->sse[ssecount++].i32 = *(UINT32 *) a;
break; break;
default: default:
abort(); abort();

View File

@ -61,8 +61,9 @@ typedef unsigned long long ffi_arg;
typedef long long ffi_sarg; typedef long long ffi_sarg;
#endif #endif
#else #else
#if defined __x86_64__ && !defined __LP64__ #if defined __x86_64__ && defined __ILP32__
#define FFI_SIZEOF_ARG 8 #define FFI_SIZEOF_ARG 8
#define FFI_SIZEOF_JAVA_RAW 4
typedef unsigned long long ffi_arg; typedef unsigned long long ffi_arg;
typedef long long ffi_sarg; typedef long long ffi_sarg;
#else #else

View File

@ -1,5 +1,6 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008, 2010 Red Hat, Inc. sysv.S - Copyright (c) 2013 The Written Word, Inc.
- Copyright (c) 1996,1998,2001-2003,2005,2008,2010 Red Hat, Inc.
X86 Foreign Function Interface X86 Foreign Function Interface
@ -181,9 +182,19 @@ ffi_closure_SYSV:
leal -24(%ebp), %edx leal -24(%ebp), %edx
movl %edx, -12(%ebp) /* resp */ movl %edx, -12(%ebp) /* resp */
leal 8(%ebp), %edx leal 8(%ebp), %edx
#ifdef __SUNPRO_C
/* The SUNPRO compiler doesn't support GCC's regparm function
attribute, so we have to pass all three arguments to
ffi_closure_SYSV_inner on the stack. */
movl %edx, 8(%esp) /* args = __builtin_dwarf_cfa () */
leal -12(%ebp), %edx
movl %edx, 4(%esp) /* &resp */
movl %eax, (%esp) /* closure */
#else
movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */
leal -12(%ebp), %edx leal -12(%ebp), %edx
movl %edx, (%esp) /* &resp */ movl %edx, (%esp) /* &resp */
#endif
#if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__
call ffi_closure_SYSV_inner call ffi_closure_SYSV_inner
#else #else
@ -328,6 +339,9 @@ ffi_closure_raw_SYSV:
.size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV
#endif #endif
#if defined __GNUC__
/* Only emit dwarf unwind info when building with GNU toolchain. */
#if defined __PIC__ #if defined __PIC__
# if defined __sun__ && defined __svr4__ # if defined __sun__ && defined __svr4__
/* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld before 2.22 /* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld before 2.22
@ -459,6 +473,7 @@ ffi_closure_raw_SYSV:
.align 4 .align 4
.LEFDE3: .LEFDE3:
#endif
#endif #endif
#endif /* ifndef __x86_64__ */ #endif /* ifndef __x86_64__ */

View File

@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
unix64.S - Copyright (c) 2002 Bo Thorsen <bo@suse.de> unix64.S - Copyright (c) 2013 The Written Word, Inc.
Copyright (c) 2008 Red Hat, Inc - Copyright (c) 2008 Red Hat, Inc
- Copyright (c) 2002 Bo Thorsen <bo@suse.de>
x86-64 Foreign Function Interface x86-64 Foreign Function Interface
@ -324,6 +325,9 @@ ffi_closure_unix64:
.LUW9: .LUW9:
.size ffi_closure_unix64,.-ffi_closure_unix64 .size ffi_closure_unix64,.-ffi_closure_unix64
#ifdef __GNUC__
/* Only emit DWARF unwind info when building with the GNU toolchain. */
#ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE #ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE
.section .eh_frame,"a",@unwind .section .eh_frame,"a",@unwind
#else #else
@ -419,6 +423,8 @@ ffi_closure_unix64:
.align 8 .align 8
.LEFDE3: .LEFDE3:
#endif /* __GNUC__ */
#endif /* __x86_64__ */ #endif /* __x86_64__ */
#if defined __ELF__ && defined __linux__ #if defined __ELF__ && defined __linux__

View File

@ -0,0 +1,298 @@
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 2013 Tensilica, Inc.
XTENSA Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#include <ffi.h>
#include <ffi_common.h>
/*
|----------------------------------------|
| |
on entry to ffi_call ----> |----------------------------------------|
| caller stack frame for registers a0-a3 |
|----------------------------------------|
| |
| additional arguments |
entry of the function ---> |----------------------------------------|
| copy of function arguments a2-a7 |
| - - - - - - - - - - - - - |
| |
The area below the entry line becomes the new stack frame for the function.
*/
#define FFI_TYPE_STRUCT_REGS FFI_TYPE_LAST
extern void ffi_call_SYSV(void *rvalue, unsigned rsize, unsigned flags,
void(*fn)(void), unsigned nbytes, extended_cif*);
extern void ffi_closure_SYSV(void) FFI_HIDDEN;
ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
{
switch(cif->rtype->type) {
case FFI_TYPE_SINT8:
case FFI_TYPE_UINT8:
case FFI_TYPE_SINT16:
case FFI_TYPE_UINT16:
cif->flags = cif->rtype->type;
break;
case FFI_TYPE_VOID:
case FFI_TYPE_FLOAT:
cif->flags = FFI_TYPE_UINT32;
break;
case FFI_TYPE_DOUBLE:
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
cif->flags = FFI_TYPE_UINT64; // cif->rtype->type;
break;
case FFI_TYPE_STRUCT:
cif->flags = FFI_TYPE_STRUCT; //_REGS;
/* Up to 16 bytes are returned in registers */
if (cif->rtype->size > 4 * 4) {
/* returned structure is referenced by a register; use 8 bytes
(including 4 bytes for potential additional alignment) */
cif->flags = FFI_TYPE_STRUCT;
cif->bytes += 8;
}
break;
default:
cif->flags = FFI_TYPE_UINT32;
break;
}
/* Round the stack up to a full 4 register frame, just in case
(we use this size in movsp). This way, it's also a multiple of
8 bytes for 64-bit arguments. */
cif->bytes = ALIGN(cif->bytes, 16);
return FFI_OK;
}
void ffi_prep_args(extended_cif *ecif, unsigned char* stack)
{
unsigned int i;
unsigned long *addr;
ffi_type **ptr;
union {
void **v;
char **c;
signed char **sc;
unsigned char **uc;
signed short **ss;
unsigned short **us;
unsigned int **i;
long long **ll;
float **f;
double **d;
} p_argv;
/* Verify that everything is aligned up properly */
FFI_ASSERT (((unsigned long) stack & 0x7) == 0);
p_argv.v = ecif->avalue;
addr = (unsigned long*)stack;
/* structures with a size greater than 16 bytes are passed in memory */
if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 16)
{
*addr++ = (unsigned long)ecif->rvalue;
}
for (i = ecif->cif->nargs, ptr = ecif->cif->arg_types;
i > 0;
i--, ptr++, p_argv.v++)
{
switch ((*ptr)->type)
{
case FFI_TYPE_SINT8:
*addr++ = **p_argv.sc;
break;
case FFI_TYPE_UINT8:
*addr++ = **p_argv.uc;
break;
case FFI_TYPE_SINT16:
*addr++ = **p_argv.ss;
break;
case FFI_TYPE_UINT16:
*addr++ = **p_argv.us;
break;
case FFI_TYPE_FLOAT:
case FFI_TYPE_INT:
case FFI_TYPE_UINT32:
case FFI_TYPE_SINT32:
case FFI_TYPE_POINTER:
*addr++ = **p_argv.i;
break;
case FFI_TYPE_DOUBLE:
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
if (((unsigned long)addr & 4) != 0)
addr++;
*(unsigned long long*)addr = **p_argv.ll;
addr += sizeof(unsigned long long) / sizeof (addr);
break;
case FFI_TYPE_STRUCT:
{
unsigned long offs;
unsigned long size;
if (((unsigned long)addr & 4) != 0 && (*ptr)->alignment > 4)
addr++;
offs = (unsigned long) addr - (unsigned long) stack;
size = (*ptr)->size;
/* Entire structure must fit the argument registers or referenced */
if (offs < FFI_REGISTER_NARGS * 4
&& offs + size > FFI_REGISTER_NARGS * 4)
addr = (unsigned long*) (stack + FFI_REGISTER_NARGS * 4);
memcpy((char*) addr, *p_argv.c, size);
addr += (size + 3) / 4;
break;
}
default:
FFI_ASSERT(0);
}
}
}
void ffi_call(ffi_cif* cif, void(*fn)(void), void *rvalue, void **avalue)
{
extended_cif ecif;
unsigned long rsize = cif->rtype->size;
int flags = cif->flags;
void *alloc = NULL;
ecif.cif = cif;
ecif.avalue = avalue;
/* Note that for structures that are returned in registers (size <= 16 bytes)
we allocate a temporary buffer and use memcpy to copy it to the final
destination. The reason is that the target address might be misaligned or
the length not a multiple of 4 bytes. Handling all those cases would be
very complex. */
if (flags == FFI_TYPE_STRUCT && (rsize <= 16 || rvalue == NULL))
{
alloc = alloca(ALIGN(rsize, 4));
ecif.rvalue = alloc;
}
else
{
ecif.rvalue = rvalue;
}
if (cif->abi != FFI_SYSV)
FFI_ASSERT(0);
ffi_call_SYSV (ecif.rvalue, rsize, cif->flags, fn, cif->bytes, &ecif);
if (alloc != NULL && rvalue != NULL)
memcpy(rvalue, alloc, rsize);
}
extern void ffi_trampoline();
extern void ffi_cacheflush(void* start, void* end);
ffi_status
ffi_prep_closure_loc (ffi_closure* closure,
ffi_cif* cif,
void (*fun)(ffi_cif*, void*, void**, void*),
void *user_data,
void *codeloc)
{
/* copye trampoline to stack and patch 'ffi_closure_SYSV' pointer */
memcpy(closure->tramp, ffi_trampoline, FFI_TRAMPOLINE_SIZE);
*(unsigned int*)(&closure->tramp[8]) = (unsigned int)ffi_closure_SYSV;
// Do we have this function?
// __builtin___clear_cache(closer->tramp, closer->tramp + FFI_TRAMPOLINE_SIZE)
ffi_cacheflush(closure->tramp, closure->tramp + FFI_TRAMPOLINE_SIZE);
closure->cif = cif;
closure->fun = fun;
closure->user_data = user_data;
return FFI_OK;
}
long FFI_HIDDEN
ffi_closure_SYSV_inner(ffi_closure *closure, void **values, void *rvalue)
{
ffi_cif *cif;
ffi_type **arg_types;
void **avalue;
int i, areg;
cif = closure->cif;
if (cif->abi != FFI_SYSV)
return FFI_BAD_ABI;
areg = 0;
int rtype = cif->rtype->type;
if (rtype == FFI_TYPE_STRUCT && cif->rtype->size > 4 * 4)
{
rvalue = *values;
areg++;
}
cif = closure->cif;
arg_types = cif->arg_types;
avalue = alloca(cif->nargs * sizeof(void *));
for (i = 0; i < cif->nargs; i++)
{
if (arg_types[i]->alignment == 8 && (areg & 1) != 0)
areg++;
// skip the entry 16,a1 framework, add 16 bytes (4 registers)
if (areg == FFI_REGISTER_NARGS)
areg += 4;
if (arg_types[i]->type == FFI_TYPE_STRUCT)
{
int numregs = ((arg_types[i]->size + 3) & ~3) / 4;
if (areg < FFI_REGISTER_NARGS && areg + numregs > FFI_REGISTER_NARGS)
areg = FFI_REGISTER_NARGS + 4;
}
avalue[i] = &values[areg];
areg += (arg_types[i]->size + 3) / 4;
}
(closure->fun)(cif, rvalue, avalue, closure->user_data);
return rtype;
}

View File

@ -0,0 +1,53 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 2013 Tensilica, Inc.
Target configuration macros for XTENSA.
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
#define FFI_REGISTER_NARGS 6
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
#define FFI_NATIVE_RAW_API 0
#define FFI_TRAMPOLINE_SIZE 24
#endif

View File

@ -0,0 +1,253 @@
/* -----------------------------------------------------------------------
sysv.S - Copyright (c) 2013 Tensilica, Inc.
XTENSA Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#define LIBFFI_ASM
#include <fficonfig.h>
#include <ffi.h>
#define ENTRY(name) .text; .globl name; .type name,@function; .align 4; name:
#define END(name) .size name , . - name
/* Assert that the table below is in sync with ffi.h. */
#if FFI_TYPE_UINT8 != 5 \
|| FFI_TYPE_SINT8 != 6 \
|| FFI_TYPE_UINT16 != 7 \
|| FFI_TYPE_SINT16 != 8 \
|| FFI_TYPE_UINT32 != 9 \
|| FFI_TYPE_SINT32 != 10 \
|| FFI_TYPE_UINT64 != 11
#error "xtensa/sysv.S out of sync with ffi.h"
#endif
/* ffi_call_SYSV (rvalue, rbytes, flags, (*fnaddr)(), bytes, ecif)
void *rvalue; a2
unsigned long rbytes; a3
unsigned flags; a4
void (*fnaddr)(); a5
unsigned long bytes; a6
extended_cif* ecif) a7
*/
ENTRY(ffi_call_SYSV)
entry a1, 32 # 32 byte frame for using call8 below
mov a10, a7 # a10(->arg0): ecif
sub a11, a1, a6 # a11(->arg1): stack pointer
mov a7, a1 # fp
movsp a1, a11 # set new sp = old_sp - bytes
movi a8, ffi_prep_args
callx8 a8 # ffi_prep_args(ecif, stack)
# prepare to move stack pointer back up to 6 arguments
# note that 'bytes' is already aligned
movi a10, 6*4
sub a11, a6, a10
movgez a6, a10, a11
add a6, a1, a6
# we can pass up to 6 arguments in registers
# for simplicity, just load 6 arguments
# (the stack size is at least 32 bytes, so no risk to cross boundaries)
l32i a10, a1, 0
l32i a11, a1, 4
l32i a12, a1, 8
l32i a13, a1, 12
l32i a14, a1, 16
l32i a15, a1, 20
# move stack pointer
movsp a1, a6
callx8 a5 # (*fn)(args...)
# Handle return value(s)
beqz a2, .Lexit
movi a5, FFI_TYPE_STRUCT
bne a4, a5, .Lstore
movi a5, 16
blt a5, a3, .Lexit
s32i a10, a2, 0
blti a3, 5, .Lexit
addi a3, a3, -1
s32i a11, a2, 4
blti a3, 8, .Lexit
s32i a12, a2, 8
blti a3, 12, .Lexit
s32i a13, a2, 12
.Lexit: retw
.Lstore:
addi a4, a4, -FFI_TYPE_UINT8
bgei a4, 7, .Lexit # should never happen
movi a6, store_calls
add a4, a4, a4
addx4 a6, a4, a6 # store_table + idx * 8
jx a6
.align 8
store_calls:
# UINT8
s8i a10, a2, 0
retw
# SINT8
.align 8
s8i a10, a2, 0
retw
# UINT16
.align 8
s16i a10, a2, 0
retw
# SINT16
.align 8
s16i a10, a2, 0
retw
# UINT32
.align 8
s32i a10, a2, 0
retw
# SINT32
.align 8
s32i a10, a2, 0
retw
# UINT64
.align 8
s32i a10, a2, 0
s32i a11, a2, 4
retw
END(ffi_call_SYSV)
/*
* void ffi_cacheflush (unsigned long start, unsigned long end)
*/
#define EXTRA_ARGS_SIZE 24
ENTRY(ffi_cacheflush)
entry a1, 16
1: dhwbi a2, 0
ihi a2, 0
addi a2, a2, 4
blt a2, a3, 1b
retw
END(ffi_cacheflush)
/* ffi_trampoline is copied to the stack */
ENTRY(ffi_trampoline)
entry a1, 16 + (FFI_REGISTER_NARGS * 4) + (4 * 4) # [ 0]
j 2f # [ 3]
.align 4 # [ 6]
1: .long 0 # [ 8]
2: l32r a15, 1b # [12]
_mov a14, a0 # [15]
callx0 a15 # [18]
# [21]
END(ffi_trampoline)
/*
* ffi_closure()
*
* a0: closure + 21
* a14: return address (a0)
*/
ENTRY(ffi_closure_SYSV)
/* intentionally omitting entry here */
# restore return address (a0) and move pointer to closure to a10
addi a10, a0, -21
mov a0, a14
# allow up to 4 arguments as return values
addi a11, a1, 4 * 4
# save up to 6 arguments to stack (allocated by entry below)
s32i a2, a11, 0
s32i a3, a11, 4
s32i a4, a11, 8
s32i a5, a11, 12
s32i a6, a11, 16
s32i a7, a11, 20
movi a8, ffi_closure_SYSV_inner
mov a12, a1
callx8 a8 # .._inner(*closure, **avalue, *rvalue)
# load up to four return arguments
l32i a2, a1, 0
l32i a3, a1, 4
l32i a4, a1, 8
l32i a5, a1, 12
# (sign-)extend return value
movi a11, FFI_TYPE_UINT8
bne a10, a11, 1f
extui a2, a2, 0, 8
retw
1: movi a11, FFI_TYPE_SINT8
bne a10, a11, 1f
sext a2, a2, 7
retw
1: movi a11, FFI_TYPE_UINT16
bne a10, a11, 1f
extui a2, a2, 0, 16
retw
1: movi a11, FFI_TYPE_SINT16
bne a10, a11, 1f
sext a2, a2, 15
1: retw
END(ffi_closure_SYSV)

View File

@ -13,73 +13,82 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
AM_RUNTESTFLAGS = AM_RUNTESTFLAGS =
EXTRA_DEJAGNU_SITE_CONFIG=../local.exp
CLEANFILES = *.exe core* *.log *.sum CLEANFILES = *.exe core* *.log *.sum
EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \
libffi.call/cls_align_longdouble_split.c libffi.call/closure_loc_fn0.c \ libffi.call/cls_align_longdouble_split.c \
libffi.call/cls_schar.c libffi.call/closure_fn1.c \ libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \
libffi.call/many2_win32.c libffi.call/return_ul.c \ libffi.call/closure_fn1.c libffi.call/many2_win32.c \
libffi.call/cls_align_double.c libffi.call/return_fl2.c \ libffi.call/return_ul.c libffi.call/cls_align_double.c \
libffi.call/cls_1_1byte.c libffi.call/cls_64byte.c \ libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \
libffi.call/nested_struct7.c libffi.call/cls_align_sint32.c \ libffi.call/cls_64byte.c libffi.call/nested_struct7.c \
libffi.call/nested_struct2.c libffi.call/ffitest.h \ libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \
libffi.call/nested_struct4.c libffi.call/cls_multi_ushort.c \ libffi.call/ffitest.h libffi.call/nested_struct4.c \
libffi.call/struct3.c libffi.call/cls_3byte1.c \ libffi.call/cls_multi_ushort.c libffi.call/struct3.c \
libffi.call/cls_16byte.c libffi.call/struct8.c \ libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \
libffi.call/nested_struct8.c libffi.call/cls_multi_sshort.c \ libffi.call/struct8.c libffi.call/nested_struct8.c \
libffi.call/cls_3byte2.c libffi.call/fastthis2_win32.c \ libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \
libffi.call/cls_pointer.c libffi.call/err_bad_typedef.c \ libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \
libffi.call/cls_4_1byte.c libffi.call/cls_9byte2.c \ libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \
libffi.call/cls_multi_schar.c libffi.call/stret_medium2.c \ libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \
libffi.call/cls_5_1_byte.c libffi.call/call.exp \ libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \
libffi.call/cls_double.c libffi.call/cls_align_sint16.c \ libffi.call/call.exp libffi.call/cls_double.c \
libffi.call/cls_uint.c libffi.call/return_ll1.c \ libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \
libffi.call/nested_struct3.c libffi.call/cls_20byte1.c \ libffi.call/return_ll1.c libffi.call/nested_struct3.c \
libffi.call/closure_fn4.c libffi.call/cls_uchar.c \ libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \
libffi.call/struct2.c libffi.call/cls_7byte.c libffi.call/strlen.c \ libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \
libffi.call/many.c libffi.call/testclosure.c libffi.call/return_fl.c \ libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \
libffi.call/struct5.c libffi.call/cls_12byte.c \ libffi.call/return_fl.c libffi.call/struct5.c \
libffi.call/cls_multi_sshortchar.c \ libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \
libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \
libffi.call/return_fl3.c libffi.call/stret_medium.c \ libffi.call/return_fl3.c libffi.call/stret_medium.c \
libffi.call/nested_struct6.c libffi.call/a.out \ libffi.call/nested_struct6.c libffi.call/closure_fn3.c \
libffi.call/closure_fn3.c libffi.call/float3.c libffi.call/many2.c \ libffi.call/float3.c libffi.call/many2.c \
libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \
libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \
libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \
libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \
libffi.call/cls_sshort.c libffi.call/many_win32.c \ libffi.call/cls_sshort.c libffi.call/many_win32.c \
libffi.call/nested_struct.c libffi.call/cls_20byte.c \ libffi.call/nested_struct.c libffi.call/cls_20byte.c \
libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \
libffi.call/return_uc.c libffi.call/closure_thiscall.c \ libffi.call/return_uc.c libffi.call/closure_thiscall.c \
libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ libffi.call/cls_18byte.c libffi.call/cls_8byte.c \
libffi.call/promotion.c libffi.call/struct1_win32.c \ libffi.call/promotion.c libffi.call/struct1_win32.c \
libffi.call/return_dbl.c libffi.call/cls_24byte.c \ libffi.call/return_dbl.c libffi.call/cls_24byte.c \
libffi.call/struct4.c libffi.call/cls_6byte.c \ libffi.call/struct4.c libffi.call/cls_6byte.c \
libffi.call/cls_align_uint32.c libffi.call/float.c \ libffi.call/cls_align_uint32.c libffi.call/float.c \
libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \
libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \
libffi.call/cls_align_float.c libffi.call/return_fl1.c \ libffi.call/cls_align_float.c libffi.call/return_fl1.c \
libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \
libffi.call/stret_large2.c libffi.call/return_sl.c \ libffi.call/stret_large2.c libffi.call/return_sl.c \
libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ libffi.call/closure_fn0.c libffi.call/cls_5byte.c \
libffi.call/cls_2byte.c libffi.call/float2.c \ libffi.call/cls_2byte.c libffi.call/float2.c \
libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \
libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ libffi.call/stret_large.c libffi.call/cls_ulonglong.c \
libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ libffi.call/cls_ushort.c libffi.call/nested_struct1.c \
libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \
libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \
libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \
libffi.call/struct1.c libffi.call/nested_struct9.c \ libffi.call/struct1.c libffi.call/nested_struct9.c \
libffi.call/huge_struct.c libffi.call/problem1.c libffi.call/float4.c \ libffi.call/huge_struct.c libffi.call/problem1.c \
libffi.call/fastthis3_win32.c libffi.call/return_ldl.c \ libffi.call/float4.c libffi.call/fastthis3_win32.c \
libffi.call/strlen2_win32.c libffi.call/closure_fn5.c \ libffi.call/return_ldl.c libffi.call/strlen2_win32.c \
libffi.call/struct2_win32.c libffi.call/struct6.c \ libffi.call/closure_fn5.c libffi.call/struct2_win32.c \
libffi.call/return_ll.c libffi.call/struct9.c libffi.call/return_sc.c \ libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \
libffi.call/struct7.c libffi.call/cls_align_uint64.c \ libffi.call/return_sc.c libffi.call/struct7.c \
libffi.call/cls_4byte.c libffi.call/strlen_win32.c \ libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \
libffi.call/cls_6_1_byte.c libffi.call/cls_7_1_byte.c \ libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \
libffi.special/unwindtest.cc libffi.special/special.exp \ libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \
libffi.special/unwindtest_ffi_call.cc libffi.special/ffitestcxx.h \ libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \
lib/wrapper.exp lib/target-libpath.exp lib/libffi.exp libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \
lib/libffi.exp libffi.call/cls_struct_va1.c \
libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \
libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \
libffi.call/nested_struct11.c libffi.call/uninitialized.c \
libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \
libffi.call/va_struct3.c

View File

@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am. # Makefile.in generated by automake 1.12.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994-2012 Free Software Foundation, Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -15,6 +14,23 @@
@SET_MAKE@ @SET_MAKE@
VPATH = @srcdir@ VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@
@ -37,7 +53,19 @@ target_triplet = @target@
subdir = testsuite subdir = testsuite
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/asmcfi.m4 \
$(top_srcdir)/m4/ax_append_flag.m4 \
$(top_srcdir)/m4/ax_cc_maxopt.m4 \
$(top_srcdir)/m4/ax_cflags_warn_all.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_configure_args.m4 \
$(top_srcdir)/m4/ax_enable_builddir.m4 \
$(top_srcdir)/m4/ax_gcc_archflag.m4 \
$(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
@ -47,6 +75,11 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
SOURCES = SOURCES =
DIST_SOURCES = DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DEJATOOL = $(PACKAGE) DEJATOOL = $(PACKAGE)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -114,6 +147,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PRTDIAG = @PRTDIAG@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
SED = @SED@ SED = @SED@
SET_MAKE = @SET_MAKE@ SET_MAKE = @SET_MAKE@
@ -134,6 +168,7 @@ am__leading_dot = @am__leading_dot@
am__quote = @am__quote@ am__quote = @am__quote@
am__tar = @am__tar@ am__tar = @am__tar@
am__untar = @am__untar@ am__untar = @am__untar@
ax_enable_builddir_sed = @ax_enable_builddir_sed@
bindir = @bindir@ bindir = @bindir@
build = @build@ build = @build@
build_alias = @build_alias@ build_alias = @build_alias@
@ -169,6 +204,7 @@ psdir = @psdir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@ sysconfdir = @sysconfdir@
target = @target@ target = @target@
target_alias = @target_alias@ target_alias = @target_alias@
@ -191,75 +227,82 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
echo $(top_srcdir)/../dejagnu/runtest ; \ echo $(top_srcdir)/../dejagnu/runtest ; \
else echo runtest; fi` else echo runtest; fi`
EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp
CLEANFILES = *.exe core* *.log *.sum CLEANFILES = *.exe core* *.log *.sum
EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \
libffi.call/cls_align_longdouble_split.c libffi.call/closure_loc_fn0.c \ libffi.call/cls_align_longdouble_split.c \
libffi.call/cls_schar.c libffi.call/closure_fn1.c \ libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \
libffi.call/many2_win32.c libffi.call/return_ul.c \ libffi.call/closure_fn1.c libffi.call/many2_win32.c \
libffi.call/cls_align_double.c libffi.call/return_fl2.c \ libffi.call/return_ul.c libffi.call/cls_align_double.c \
libffi.call/cls_1_1byte.c libffi.call/cls_64byte.c \ libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \
libffi.call/nested_struct7.c libffi.call/cls_align_sint32.c \ libffi.call/cls_64byte.c libffi.call/nested_struct7.c \
libffi.call/nested_struct2.c libffi.call/ffitest.h \ libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \
libffi.call/nested_struct4.c libffi.call/cls_multi_ushort.c \ libffi.call/ffitest.h libffi.call/nested_struct4.c \
libffi.call/struct3.c libffi.call/cls_3byte1.c \ libffi.call/cls_multi_ushort.c libffi.call/struct3.c \
libffi.call/cls_16byte.c libffi.call/struct8.c \ libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \
libffi.call/nested_struct8.c libffi.call/cls_multi_sshort.c \ libffi.call/struct8.c libffi.call/nested_struct8.c \
libffi.call/cls_3byte2.c libffi.call/fastthis2_win32.c \ libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \
libffi.call/cls_pointer.c libffi.call/err_bad_typedef.c \ libffi.call/fastthis2_win32.c libffi.call/cls_pointer.c \
libffi.call/cls_4_1byte.c libffi.call/cls_9byte2.c \ libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \
libffi.call/cls_multi_schar.c libffi.call/stret_medium2.c \ libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \
libffi.call/cls_5_1_byte.c libffi.call/call.exp \ libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \
libffi.call/cls_double.c libffi.call/cls_align_sint16.c \ libffi.call/call.exp libffi.call/cls_double.c \
libffi.call/cls_uint.c libffi.call/return_ll1.c \ libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \
libffi.call/nested_struct3.c libffi.call/cls_20byte1.c \ libffi.call/return_ll1.c libffi.call/nested_struct3.c \
libffi.call/closure_fn4.c libffi.call/cls_uchar.c \ libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \
libffi.call/struct2.c libffi.call/cls_7byte.c libffi.call/strlen.c \ libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \
libffi.call/many.c libffi.call/testclosure.c libffi.call/return_fl.c \ libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \
libffi.call/struct5.c libffi.call/cls_12byte.c \ libffi.call/return_fl.c libffi.call/struct5.c \
libffi.call/cls_multi_sshortchar.c \ libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \
libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \
libffi.call/return_fl3.c libffi.call/stret_medium.c \ libffi.call/return_fl3.c libffi.call/stret_medium.c \
libffi.call/nested_struct6.c libffi.call/a.out \ libffi.call/nested_struct6.c libffi.call/closure_fn3.c \
libffi.call/closure_fn3.c libffi.call/float3.c libffi.call/many2.c \ libffi.call/float3.c libffi.call/many2.c \
libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \ libffi.call/closure_stdcall.c libffi.call/cls_align_uint16.c \
libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \
libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \
libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \
libffi.call/cls_sshort.c libffi.call/many_win32.c \ libffi.call/cls_sshort.c libffi.call/many_win32.c \
libffi.call/nested_struct.c libffi.call/cls_20byte.c \ libffi.call/nested_struct.c libffi.call/cls_20byte.c \
libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \
libffi.call/return_uc.c libffi.call/closure_thiscall.c \ libffi.call/return_uc.c libffi.call/closure_thiscall.c \
libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ libffi.call/cls_18byte.c libffi.call/cls_8byte.c \
libffi.call/promotion.c libffi.call/struct1_win32.c \ libffi.call/promotion.c libffi.call/struct1_win32.c \
libffi.call/return_dbl.c libffi.call/cls_24byte.c \ libffi.call/return_dbl.c libffi.call/cls_24byte.c \
libffi.call/struct4.c libffi.call/cls_6byte.c \ libffi.call/struct4.c libffi.call/cls_6byte.c \
libffi.call/cls_align_uint32.c libffi.call/float.c \ libffi.call/cls_align_uint32.c libffi.call/float.c \
libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \
libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \
libffi.call/cls_align_float.c libffi.call/return_fl1.c \ libffi.call/cls_align_float.c libffi.call/return_fl1.c \
libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ libffi.call/nested_struct10.c libffi.call/nested_struct5.c \
libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \ libffi.call/fastthis1_win32.c libffi.call/cls_align_sint64.c \
libffi.call/stret_large2.c libffi.call/return_sl.c \ libffi.call/stret_large2.c libffi.call/return_sl.c \
libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ libffi.call/closure_fn0.c libffi.call/cls_5byte.c \
libffi.call/cls_2byte.c libffi.call/float2.c \ libffi.call/cls_2byte.c libffi.call/float2.c \
libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \
libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ libffi.call/stret_large.c libffi.call/cls_ulonglong.c \
libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ libffi.call/cls_ushort.c libffi.call/nested_struct1.c \
libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \
libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \
libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \
libffi.call/struct1.c libffi.call/nested_struct9.c \ libffi.call/struct1.c libffi.call/nested_struct9.c \
libffi.call/huge_struct.c libffi.call/problem1.c libffi.call/float4.c \ libffi.call/huge_struct.c libffi.call/problem1.c \
libffi.call/fastthis3_win32.c libffi.call/return_ldl.c \ libffi.call/float4.c libffi.call/fastthis3_win32.c \
libffi.call/strlen2_win32.c libffi.call/closure_fn5.c \ libffi.call/return_ldl.c libffi.call/strlen2_win32.c \
libffi.call/struct2_win32.c libffi.call/struct6.c \ libffi.call/closure_fn5.c libffi.call/struct2_win32.c \
libffi.call/return_ll.c libffi.call/struct9.c libffi.call/return_sc.c \ libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \
libffi.call/struct7.c libffi.call/cls_align_uint64.c \ libffi.call/return_sc.c libffi.call/struct7.c \
libffi.call/cls_4byte.c libffi.call/strlen_win32.c \ libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \
libffi.call/cls_6_1_byte.c libffi.call/cls_7_1_byte.c \ libffi.call/strlen_win32.c libffi.call/cls_6_1_byte.c \
libffi.special/unwindtest.cc libffi.special/special.exp \ libffi.call/cls_7_1_byte.c libffi.special/unwindtest.cc \
libffi.special/unwindtest_ffi_call.cc libffi.special/ffitestcxx.h \ libffi.special/special.exp libffi.special/unwindtest_ffi_call.cc \
lib/wrapper.exp lib/target-libpath.exp lib/libffi.exp libffi.special/ffitestcxx.h lib/wrapper.exp lib/target-libpath.exp \
lib/libffi.exp libffi.call/cls_struct_va1.c \
libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \
libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \
libffi.call/nested_struct11.c libffi.call/uninitialized.c \
libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \
libffi.call/va_struct3.c
all: all-am all: all-am
@ -306,6 +349,8 @@ TAGS:
ctags: CTAGS ctags: CTAGS
CTAGS: CTAGS:
cscope cscopelist:
check-DEJAGNU: site.exp check-DEJAGNU: site.exp
srcdir='$(srcdir)'; export srcdir; \ srcdir='$(srcdir)'; export srcdir; \
@ -316,11 +361,11 @@ check-DEJAGNU: site.exp
if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
then :; else exit_status=1; fi; \ then :; else exit_status=1; fi; \
done; \ done; \
else echo "WARNING: could not find \`runtest'" 1>&2; :;\ else echo "WARNING: could not find 'runtest'" 1>&2; :;\
fi; \ fi; \
exit $$exit_status exit $$exit_status
site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@echo 'Making a new site.exp file...' @echo 'Making a new site.exp file ...'
@echo '## these variables are automatically generated by make ##' >site.tmp @echo '## these variables are automatically generated by make ##' >site.tmp
@echo '# Do not edit here. If you wish to override these values' >>site.tmp @echo '# Do not edit here. If you wish to override these values' >>site.tmp
@echo '# edit the last section' >>site.tmp @echo '# edit the last section' >>site.tmp

View File

@ -101,9 +101,17 @@ proc libffi-init { args } {
global tool_root_dir global tool_root_dir
global ld_library_path global ld_library_path
global using_gcc
set blddirffi [pwd]/.. set blddirffi [pwd]/..
verbose "libffi $blddirffi" verbose "libffi $blddirffi"
# Are we building with GCC?
set tmp [grep ../config.status "GCC='yes'"]
if { [string match $tmp "GCC='yes'"] } {
set using_gcc "yes"
set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
if {$gccdir != ""} { if {$gccdir != ""} {
set gccdir [file dirname $gccdir] set gccdir [file dirname $gccdir]
@ -127,6 +135,13 @@ proc libffi-init { args } {
} }
} }
} }
} else {
set using_gcc "no"
}
# add the library path for libffi. # add the library path for libffi.
append ld_library_path ":${blddirffi}/.libs" append ld_library_path ":${blddirffi}/.libs"
@ -203,6 +218,10 @@ proc libffi_target_compile { source dest type options } {
lappend options "libs= -lffi" lappend options "libs= -lffi"
if { [string match "aarch64*-*-linux*" $target_triplet] } {
lappend options "libs= -lpthread"
}
verbose "options: $options" verbose "options: $options"
return [target_compile $source $dest $type $options] return [target_compile $source $dest $type $options]
} }

View File

@ -19,11 +19,20 @@ libffi-init
global srcdir subdir global srcdir subdir
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" if { [string match $using_gcc "yes"] } {
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" ""
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" ""
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" ""
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" ""
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" ""
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" ""
} else {
# Assume we are using the vendor compiler.
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" ""
}
dg-finish dg-finish

View File

@ -45,9 +45,9 @@ int main (void)
args[2] = NULL; args[2] = NULL;
ffi_call(&cif, FFI_FN(printf), &res, args); ffi_call(&cif, FFI_FN(printf), &res, args);
// { dg-output "7.0" } /* { dg-output "7.0" } */
printf("res: %d\n", (int) res); printf("res: %d\n", (int) res);
// { dg-output "\nres: 4" } /* { dg-output "\nres: 4" } */
/* The call to cls_double_va_fn is static, so have to use a normal prep_cif */ /* The call to cls_double_va_fn is static, so have to use a normal prep_cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK);
@ -55,9 +55,9 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
res = ((int(*)(char*, double))(code))(format, doubleArg); res = ((int(*)(char*, double))(code))(format, doubleArg);
// { dg-output "\n7.0" } /* { dg-output "\n7.0" } */
printf("res: %d\n", (int) res); printf("res: %d\n", (int) res);
// { dg-output "\nres: 4" } /* { dg-output "\nres: 4" } */
exit(0); exit(0);
} }

View File

@ -5,7 +5,9 @@
Originator: Blake Chaffin */ Originator: Blake Chaffin */
/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
/* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */ /* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have
remove the xfail for arm*-*-* below, until we know more. */
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */

View File

@ -45,9 +45,9 @@ int main (void)
args[2] = NULL; args[2] = NULL;
ffi_call(&cif, FFI_FN(printf), &res, args); ffi_call(&cif, FFI_FN(printf), &res, args);
// { dg-output "7.0" } /* { dg-output "7.0" } */
printf("res: %d\n", (int) res); printf("res: %d\n", (int) res);
// { dg-output "\nres: 4" } /* { dg-output "\nres: 4" } */
/* The call to cls_longdouble_va_fn is static, so have to use a normal prep_cif */ /* The call to cls_longdouble_va_fn is static, so have to use a normal prep_cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint,
@ -56,9 +56,9 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK);
res = ((int(*)(char*, long double))(code))(format, ldArg); res = ((int(*)(char*, long double))(code))(format, ldArg);
// { dg-output "\n7.0" } /* { dg-output "\n7.0" } */
printf("res: %d\n", (int) res); printf("res: %d\n", (int) res);
// { dg-output "\nres: 4" } /* { dg-output "\nres: 4" } */
exit(0); exit(0);
} }

View File

@ -35,7 +35,7 @@ int main (void)
void *code; void *code;
ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[3]; void* args[3];
// ffi_type cls_pointer_type; /* ffi_type cls_pointer_type; */
ffi_type* arg_types[3]; ffi_type* arg_types[3];
/* cls_pointer_type.size = sizeof(void*); /* cls_pointer_type.size = sizeof(void*);

View File

@ -98,7 +98,7 @@ int main (void)
void *code; void *code;
ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[3]; void* args[3];
// ffi_type cls_pointer_type; /* ffi_type cls_pointer_type; */
ffi_type* arg_types[3]; ffi_type* arg_types[3];
/* cls_pointer_type.size = sizeof(void*); /* cls_pointer_type.size = sizeof(void*);
@ -125,18 +125,18 @@ int main (void)
ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args);
printf("res: 0x%08x\n", (unsigned int) res); printf("res: 0x%08x\n", (unsigned int) res);
// { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */
// { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */
// { dg-output "\nres: 0x8bf258bd" } /* { dg-output "\nres: 0x8bf258bd" } */
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK);
res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2);
printf("res: 0x%08x\n", (unsigned int) res); printf("res: 0x%08x\n", (unsigned int) res);
// { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */
// { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */
// { dg-output "\nres: 0x8bf258bd" } /* { dg-output "\nres: 0x8bf258bd" } */
exit(0); exit(0);
} }

View File

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

View File

@ -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__)
{
*(ffi_arg *)resp = *(T *)args[0];
printf("%d: %d %d\n", (int)(*(ffi_arg *)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);
}

View File

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

View File

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

View File

@ -11,7 +11,7 @@
static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp,
void** args, void* userdata __UNUSED__) void** args, void* userdata __UNUSED__)
{ {
*(unsigned long long *)resp= *(unsigned long long *)args[0]; *(unsigned long long *)resp= 0xfffffffffffffffLL ^ *(unsigned long long *)args[0];
printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0], printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0],
*(unsigned long long *)(resp)); *(unsigned long long *)(resp));
@ -34,14 +34,14 @@ int main (void)
&ffi_type_uint64, cl_arg_types) == FFI_OK); &ffi_type_uint64, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK);
res = (*((cls_ret_ulonglong)code))(214LL); res = (*((cls_ret_ulonglong)code))(214LL);
/* { dg-output "214: 214" } */ /* { dg-output "214: 1152921504606846761" } */
printf("res: %" PRIdLL "\n", res); printf("res: %" PRIdLL "\n", res);
/* { dg-output "\nres: 214" } */ /* { dg-output "\nres: 1152921504606846761" } */
res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); res = (*((cls_ret_ulonglong)code))(9223372035854775808LL);
/* { dg-output "\n9223372035854775808: 9223372035854775808" } */ /* { dg-output "\n9223372035854775808: 8070450533247928831" } */
printf("res: %" PRIdLL "\n", res); printf("res: %" PRIdLL "\n", res);
/* { dg-output "\nres: 9223372035854775808" } */ /* { dg-output "\nres: 8070450533247928831" } */
exit(0); exit(0);
} }

View File

@ -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__)
{
*(ffi_arg *)resp = *(T *)args[0];
printf("%d: %d %d\n", (int)(*(ffi_arg *)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);
}

View File

@ -15,7 +15,7 @@
#define MAX_ARGS 256 #define MAX_ARGS 256
#define CHECK(x) !(x) ? abort() : 0 #define CHECK(x) !(x) ? (abort(), 1) : 0
/* Define __UNUSED__ that also other compilers than gcc can run the tests. */ /* Define __UNUSED__ that also other compilers than gcc can run the tests. */
#undef __UNUSED__ #undef __UNUSED__
@ -127,44 +127,6 @@
#define PRId64 "I64d" #define PRId64 "I64d"
#endif #endif
#ifdef USING_MMAP #ifndef PRIuPTR
static inline void * #define PRIuPTR "u"
allocate_mmap (size_t size)
{
void *page;
#if defined (HAVE_MMAP_DEV_ZERO)
static int dev_zero_fd = -1;
#endif
#ifdef HAVE_MMAP_DEV_ZERO
if (dev_zero_fd == -1)
{
dev_zero_fd = open ("/dev/zero", O_RDONLY);
if (dev_zero_fd == -1)
{
perror ("open /dev/zero: %m");
exit (1);
}
}
#endif
#ifdef HAVE_MMAP_ANON
page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
#endif
#ifdef HAVE_MMAP_DEV_ZERO
page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE, dev_zero_fd, 0);
#endif
if (page == (void *) MAP_FAILED)
{
perror ("virtual memory exhausted");
exit (1);
}
return page;
}
#endif #endif

View File

@ -56,9 +56,9 @@ int main (void)
* different. */ * different. */
/* Call it statically and then via ffi */ /* Call it statically and then via ffi */
resfp=float_va_fn(0,2.0); resfp=float_va_fn(0,2.0);
// { dg-output "0: 2.0 : total: 2.0" } /* { dg-output "0: 2.0 : total: 2.0" } */
printf("compiled: %.1f\n", resfp); printf("compiled: %.1f\n", resfp);
// { dg-output "\ncompiled: 2.0" } /* { dg-output "\ncompiled: 2.0" } */
arg_types[0] = &ffi_type_uint; arg_types[0] = &ffi_type_uint;
arg_types[1] = &ffi_type_double; arg_types[1] = &ffi_type_double;
@ -71,16 +71,16 @@ int main (void)
values[0] = &firstarg; values[0] = &firstarg;
values[1] = &doubles[0]; values[1] = &doubles[0];
ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values); ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
// { dg-output "\n0: 2.0 : total: 2.0" } /* { dg-output "\n0: 2.0 : total: 2.0" } */
printf("ffi: %.1f\n", resfp); printf("ffi: %.1f\n", resfp);
// { dg-output "\nffi: 2.0" } /* { dg-output "\nffi: 2.0" } */
/* Second test, float_va_fn(2,2.0,3.0,4.0), now with variadic params */ /* Second test, float_va_fn(2,2.0,3.0,4.0), now with variadic params */
/* Call it statically and then via ffi */ /* Call it statically and then via ffi */
resfp=float_va_fn(2,2.0,3.0,4.0); resfp=float_va_fn(2,2.0,3.0,4.0);
// { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } /* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */
printf("compiled: %.1f\n", resfp); printf("compiled: %.1f\n", resfp);
// { dg-output "\ncompiled: 11.0" } /* { dg-output "\ncompiled: 11.0" } */
arg_types[0] = &ffi_type_uint; arg_types[0] = &ffi_type_uint;
arg_types[1] = &ffi_type_double; arg_types[1] = &ffi_type_double;
@ -99,9 +99,9 @@ int main (void)
values[2] = &doubles[1]; values[2] = &doubles[1];
values[3] = &doubles[2]; values[3] = &doubles[2];
ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values); ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values);
// { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } /* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */
printf("ffi: %.1f\n", resfp); printf("ffi: %.1f\n", resfp);
// { dg-output "\nffi: 11.0" } /* { dg-output "\nffi: 11.0" } */
exit(0); exit(0);
} }

View File

@ -8,6 +8,7 @@
/* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */
/* { dg-options -Wformat=0 { target moxie*-*-elf } } */
/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
#include "ffitest.h" #include "ffitest.h"
@ -295,7 +296,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK); CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK);
ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues); ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues);
// { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
@ -308,7 +309,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj,
retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp,
retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx);
// { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK);
@ -323,7 +324,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
ui8, si8); ui8, si8);
// { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
"%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx "
@ -336,7 +337,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__)
retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj,
retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp,
retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx);
// { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */
return 0; return 0;
} }

View File

@ -12,7 +12,10 @@
typedef unsigned char u8; typedef unsigned char u8;
__attribute__((noinline)) uint8_t #ifdef __GNUC__
__attribute__((noinline))
#endif
uint8_t
foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d, foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d,
uint8_t e, uint8_t f, uint8_t g) uint8_t e, uint8_t f, uint8_t g)
{ {

View File

@ -5,7 +5,6 @@
Originator: From the original ffitest.c */ Originator: From the original ffitest.c */
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options -O2 } */
#include "ffitest.h" #include "ffitest.h"

View File

@ -156,6 +156,6 @@ int main (void)
CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii));
CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd));
CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff));
// CHECK( 1 == 0); /* CHECK( 1 == 0); */
exit(0); exit(0);
} }

View File

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

View File

@ -9,6 +9,7 @@
static double return_dbl(double dbl) static double return_dbl(double dbl)
{ {
printf ("%f\n", dbl);
return 2 * dbl; return 2 * dbl;
} }
int main (void) int main (void)

View File

@ -32,7 +32,7 @@ int main (void)
uc < (unsigned char) '\xff'; uc++) uc < (unsigned char) '\xff'; uc++)
{ {
ffi_call(&cif, FFI_FN(return_uc), &rint, values); ffi_call(&cif, FFI_FN(return_uc), &rint, values);
CHECK(rint == (signed int) uc); CHECK((unsigned char)rint == uc);
} }
exit(0); exit(0);
} }

View File

@ -9,8 +9,8 @@
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
#include "ffitest.h" #include "ffitest.h"
// 13 FPRs: 104 bytes /* 13 FPRs: 104 bytes */
// 14 FPRs: 112 bytes /* 14 FPRs: 112 bytes */
typedef struct struct_108byte { typedef struct struct_108byte {
double a; double a;

View File

@ -9,8 +9,8 @@
/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */
#include "ffitest.h" #include "ffitest.h"
// 13 FPRs: 104 bytes /* 13 FPRs: 104 bytes */
// 14 FPRs: 112 bytes /* 14 FPRs: 112 bytes */
typedef struct struct_116byte { typedef struct struct_116byte {
double a; double a;

View File

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

View File

@ -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*-*-* } } */
#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_uchar;
arg_types[5] = &ffi_type_schar;
arg_types[6] = &ffi_type_ushort;
arg_types[7] = &ffi_type_sshort;
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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

Some files were not shown because too many files have changed in this diff Show More