diff options
52 files changed, 981 insertions, 261 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 97d43cc..cdcfd4a 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,59 @@ +2003-11-21 Andreas Jaeger <aj@suse.de> + Andreas Tobler <a.tobler@schweiz.ch> + + * acinclude.m4: Add AC_FUNC_MMAP_BLACKLIST. + * configure.in: Call AC_FUNC_MMAP_BLACKLIST. + * Makefile.in: Rebuilt. + * aclocal.m4: Likewise. + * configure: Likewise. + * fficonfig.h.in: Likewise. + * testsuite/lib/libffi-dg.exp: Add include dir. + * testsuite/libffi.call/ffitest.h: Add MMAP definitions. + * testsuite/libffi.special/ffitestcxx.h: Likewise. + * testsuite/libffi.call/closure_fn0.c: Use MMAP functionality + for ffi_closure if available. + * testsuite/libffi.call/closure_fn1.c: Likewise. + * testsuite/libffi.call/closure_fn2.c: Likewise. + * testsuite/libffi.call/closure_fn3.c: Likewise. + * testsuite/libffi.call/closure_fn4.c: Likewise. + * testsuite/libffi.call/closure_fn5.c: Likewise. + * testsuite/libffi.call/cls_12byte.c: Likewise. + * testsuite/libffi.call/cls_16byte.c: Likewise. + * testsuite/libffi.call/cls_18byte.c: Likewise. + * testsuite/libffi.call/cls_19byte.c: Likewise. + * testsuite/libffi.call/cls_1_1byte.c: Likewise. + * testsuite/libffi.call/cls_20byte.c: Likewise. + * testsuite/libffi.call/cls_20byte1.c: Likewise. + * testsuite/libffi.call/cls_24byte.c: Likewise. + * testsuite/libffi.call/cls_2byte.c: Likewise. + * testsuite/libffi.call/cls_3_1byte.c: Likewise. + * testsuite/libffi.call/cls_3byte1.c: Likewise. + * testsuite/libffi.call/cls_3byte2.c: Likewise. + * testsuite/libffi.call/cls_4_1byte.c: Likewise. + * testsuite/libffi.call/cls_4byte.c: Likewise. + * testsuite/libffi.call/cls_5byte.c: Likewise. + * testsuite/libffi.call/cls_64byte.c: Likewise. + * testsuite/libffi.call/cls_6byte.c: Likewise. + * testsuite/libffi.call/cls_7byte.c: Likewise. + * testsuite/libffi.call/cls_8byte.c: Likewise. + * testsuite/libffi.call/cls_9byte1.c: Likewise. + * testsuite/libffi.call/cls_9byte2.c: Likewise. + * testsuite/libffi.call/cls_double.c: Likewise. + * testsuite/libffi.call/cls_float.c: Likewise. + * testsuite/libffi.call/cls_schar.c: Likewise. + * testsuite/libffi.call/cls_sint.c: Likewise. + * testsuite/libffi.call/cls_sshort.c: Likewise. + * testsuite/libffi.call/cls_uchar.c: Likewise. + * testsuite/libffi.call/cls_uint.c: Likewise. + * testsuite/libffi.call/cls_ulonglong.c: Likewise. + * testsuite/libffi.call/cls_ushort.c: Likewise. + * testsuite/libffi.call/nested_struct.c: Likewise. + * testsuite/libffi.call/nested_struct1.c: Likewise. + * testsuite/libffi.call/nested_struct2.c: Likewise. + * testsuite/libffi.call/nested_struct3.c: Likewise. + * testsuite/libffi.call/problem1.c: Likewise. + * testsuite/libffi.special/unwindtest.cc: Likewise. + 2003-11-20 Andreas Tobler <a.tobler@schweiz.ch> * testsuite/lib/libffi-dg.exp: Make the -lgcc_s conditional. diff --git a/libffi/Makefile.in b/libffi/Makefile.in index d0f3ff8..212fcac 100644 --- a/libffi/Makefile.in +++ b/libffi/Makefile.in @@ -242,113 +242,113 @@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ libffi_convenience_la_LDFLAGS = libffi_convenience_la_LIBADD = +@X86_64_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ +@X86_64_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ +@X86_64_TRUE@src/java_raw_api.lo src/x86/ffi64.lo src/x86/unix64.lo \ +@X86_64_TRUE@src/x86/ffi.lo src/x86/sysv.lo +@POWERPC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ +@POWERPC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ +@POWERPC_TRUE@src/java_raw_api.lo src/powerpc/ffi.lo \ +@POWERPC_TRUE@src/powerpc/sysv.lo src/powerpc/ppc_closure.lo \ +@POWERPC_TRUE@src/powerpc/linux64.lo src/powerpc/linux64_closure.lo +@SH_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@SH_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo src/sh/sysv.lo \ +@SH_TRUE@src/sh/ffi.lo @POWERPC_DARWIN_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ @POWERPC_DARWIN_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ @POWERPC_DARWIN_TRUE@src/java_raw_api.lo src/powerpc/ffi_darwin.lo \ @POWERPC_DARWIN_TRUE@src/powerpc/darwin.lo \ @POWERPC_DARWIN_TRUE@src/powerpc/darwin_closure.lo -@S390_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo -@IA64_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo -@MIPS_IRIX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ -@MIPS_IRIX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ -@MIPS_IRIX_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \ -@MIPS_IRIX_TRUE@src/mips/n32.lo +@M68K_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo +@SPARC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ +@SPARC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ +@SPARC_TRUE@src/java_raw_api.lo src/sparc/ffi.lo src/sparc/v8.lo \ +@SPARC_TRUE@src/sparc/v9.lo +@X86_WIN32_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ +@X86_WIN32_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ +@X86_WIN32_TRUE@src/java_raw_api.lo src/x86/ffi.lo src/x86/win32.lo +@ARM_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@ARM_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@ARM_TRUE@src/arm/sysv.lo src/arm/ffi.lo @ALPHA_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ @ALPHA_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ @ALPHA_TRUE@src/java_raw_api.lo src/alpha/ffi.lo src/alpha/osf.lo +@S390_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo @POWERPC_AIX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ @POWERPC_AIX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ @POWERPC_AIX_TRUE@src/java_raw_api.lo src/powerpc/ffi_darwin.lo \ @POWERPC_AIX_TRUE@src/powerpc/aix.lo src/powerpc/aix_closure.lo -@X86_WIN32_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ -@X86_WIN32_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ -@X86_WIN32_TRUE@src/java_raw_api.lo src/x86/ffi.lo src/x86/win32.lo +@IA64_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo @SH64_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ @SH64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ @SH64_TRUE@src/sh64/sysv.lo src/sh64/ffi.lo -@X86_64_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ -@X86_64_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ -@X86_64_TRUE@src/java_raw_api.lo src/x86/ffi64.lo src/x86/unix64.lo \ -@X86_64_TRUE@src/x86/ffi.lo src/x86/sysv.lo -@ARM_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@ARM_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@ARM_TRUE@src/arm/sysv.lo src/arm/ffi.lo -@SPARC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ -@SPARC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ -@SPARC_TRUE@src/java_raw_api.lo src/sparc/ffi.lo src/sparc/v8.lo \ -@SPARC_TRUE@src/sparc/v9.lo -@M68K_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo -@POWERPC_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ -@POWERPC_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ -@POWERPC_TRUE@src/java_raw_api.lo src/powerpc/ffi.lo \ -@POWERPC_TRUE@src/powerpc/sysv.lo src/powerpc/ppc_closure.lo \ -@POWERPC_TRUE@src/powerpc/linux64.lo src/powerpc/linux64_closure.lo +@MIPS_IRIX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ +@MIPS_IRIX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ +@MIPS_IRIX_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo \ +@MIPS_IRIX_TRUE@src/mips/n32.lo @MIPS_LINUX_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo \ @MIPS_LINUX_TRUE@src/prep_cif.lo src/types.lo src/raw_api.lo \ @MIPS_LINUX_TRUE@src/java_raw_api.lo src/mips/ffi.lo src/mips/o32.lo -@SH_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@SH_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo src/sh/sysv.lo \ -@SH_TRUE@src/sh/ffi.lo @X86_TRUE@libffi_convenience_la_OBJECTS = src/debug.lo src/prep_cif.lo \ @X86_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ @X86_TRUE@src/x86/ffi.lo src/x86/sysv.lo libffi_la_LIBADD = +@X86_64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@X86_64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@X86_64_TRUE@src/x86/ffi64.lo src/x86/unix64.lo src/x86/ffi.lo \ +@X86_64_TRUE@src/x86/sysv.lo +@POWERPC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@POWERPC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@POWERPC_TRUE@src/powerpc/ffi.lo src/powerpc/sysv.lo \ +@POWERPC_TRUE@src/powerpc/ppc_closure.lo src/powerpc/linux64.lo \ +@POWERPC_TRUE@src/powerpc/linux64_closure.lo +@SH_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ +@SH_TRUE@src/raw_api.lo src/java_raw_api.lo src/sh/sysv.lo \ +@SH_TRUE@src/sh/ffi.lo @POWERPC_DARWIN_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ @POWERPC_DARWIN_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ @POWERPC_DARWIN_TRUE@src/powerpc/ffi_darwin.lo src/powerpc/darwin.lo \ @POWERPC_DARWIN_TRUE@src/powerpc/darwin_closure.lo -@S390_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo -@IA64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo -@MIPS_IRIX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@MIPS_IRIX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@MIPS_IRIX_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo +@M68K_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo +@SPARC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@SPARC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@SPARC_TRUE@src/sparc/ffi.lo src/sparc/v8.lo src/sparc/v9.lo +@X86_WIN32_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@X86_WIN32_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@X86_WIN32_TRUE@src/x86/ffi.lo src/x86/win32.lo +@ARM_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ +@ARM_TRUE@src/raw_api.lo src/java_raw_api.lo src/arm/sysv.lo \ +@ARM_TRUE@src/arm/ffi.lo @ALPHA_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ @ALPHA_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ @ALPHA_TRUE@src/alpha/ffi.lo src/alpha/osf.lo +@S390_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@S390_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@S390_TRUE@src/s390/sysv.lo src/s390/ffi.lo @POWERPC_AIX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ @POWERPC_AIX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ @POWERPC_AIX_TRUE@src/powerpc/ffi_darwin.lo src/powerpc/aix.lo \ @POWERPC_AIX_TRUE@src/powerpc/aix_closure.lo -@X86_WIN32_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@X86_WIN32_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@X86_WIN32_TRUE@src/x86/ffi.lo src/x86/win32.lo +@IA64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@IA64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@IA64_TRUE@src/ia64/ffi.lo src/ia64/unix.lo @SH64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ @SH64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ @SH64_TRUE@src/sh64/sysv.lo src/sh64/ffi.lo -@X86_64_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@X86_64_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@X86_64_TRUE@src/x86/ffi64.lo src/x86/unix64.lo src/x86/ffi.lo \ -@X86_64_TRUE@src/x86/sysv.lo -@ARM_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ -@ARM_TRUE@src/raw_api.lo src/java_raw_api.lo src/arm/sysv.lo \ -@ARM_TRUE@src/arm/ffi.lo -@SPARC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@SPARC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@SPARC_TRUE@src/sparc/ffi.lo src/sparc/v8.lo src/sparc/v9.lo -@M68K_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@M68K_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@M68K_TRUE@src/m68k/ffi.lo src/m68k/sysv.lo -@POWERPC_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ -@POWERPC_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ -@POWERPC_TRUE@src/powerpc/ffi.lo src/powerpc/sysv.lo \ -@POWERPC_TRUE@src/powerpc/ppc_closure.lo src/powerpc/linux64.lo \ -@POWERPC_TRUE@src/powerpc/linux64_closure.lo +@MIPS_IRIX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ +@MIPS_IRIX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ +@MIPS_IRIX_TRUE@src/mips/ffi.lo src/mips/o32.lo src/mips/n32.lo @MIPS_LINUX_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo \ @MIPS_LINUX_TRUE@src/types.lo src/raw_api.lo src/java_raw_api.lo \ @MIPS_LINUX_TRUE@src/mips/ffi.lo src/mips/o32.lo -@SH_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ -@SH_TRUE@src/raw_api.lo src/java_raw_api.lo src/sh/sysv.lo \ -@SH_TRUE@src/sh/ffi.lo @X86_TRUE@libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ @X86_TRUE@src/raw_api.lo src/java_raw_api.lo src/x86/ffi.lo \ @X86_TRUE@src/x86/sysv.lo diff --git a/libffi/acinclude.m4 b/libffi/acinclude.m4 index 9c2ef36..9089609 100644 --- a/libffi/acinclude.m4 +++ b/libffi/acinclude.m4 @@ -8,4 +8,93 @@ AC_DEFUN([AM_PROG_LIBTOOL],) AC_SUBST(LIBTOOL) ]) +# mmap(2) blacklisting. Some platforms provide the mmap library routine +# but don't support all of the features we need from it. +AC_DEFUN([AC_FUNC_MMAP_BLACKLIST], +[if test $ac_cv_header_sys_mman_h != yes \ + || test $ac_cv_func_mmap != yes; then + ac_cv_func_mmap_file=no + ac_cv_func_mmap_dev_zero=no + ac_cv_func_mmap_anon=no +else + AC_CACHE_CHECK([whether read-only mmap of a plain file works], + ac_cv_func_mmap_file, + [# Add a system to this blacklist if + # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a + # memory area containing the same data that you'd get if you applied + # read() to the same fd. The only system known to have a problem here + # is VMS, where text files have record structure. + case "$host_os" in + vms* | ultrix*) + ac_cv_func_mmap_file=no ;; + *) + ac_cv_func_mmap_file=yes;; + esac]) + AC_CACHE_CHECK([whether mmap from /dev/zero works], + ac_cv_func_mmap_dev_zero, + [# Add a system to this blacklist if it has mmap() but /dev/zero + # does not exist, or if mmapping /dev/zero does not give anonymous + # zeroed pages with both the following properties: + # 1. If you map N consecutive pages in with one call, and then + # unmap any subset of those pages, the pages that were not + # explicitly unmapped remain accessible. + # 2. If you map two adjacent blocks of memory and then unmap them + # both at once, they must both go away. + # Systems known to be in this category are Windows (all variants), + # VMS, and Darwin. + case "$host_os" in + vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) + ac_cv_func_mmap_dev_zero=no ;; + *) + ac_cv_func_mmap_dev_zero=yes;; + esac]) + + # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. + AC_CACHE_CHECK([for MAP_ANON(YMOUS)], ac_cv_decl_map_anon, + [AC_TRY_COMPILE( +[#include <sys/types.h> +#include <sys/mman.h> +#include <unistd.h> + +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif +], +[int n = MAP_ANONYMOUS;], + ac_cv_decl_map_anon=yes, + ac_cv_decl_map_anon=no)]) + + if test $ac_cv_decl_map_anon = no; then + ac_cv_func_mmap_anon=no + else + AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works], + ac_cv_func_mmap_anon, + [# Add a system to this blacklist if it has mmap() and MAP_ANON or + # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) + # doesn't give anonymous zeroed pages with the same properties listed + # above for use of /dev/zero. + # Systems known to be in this category are Windows, VMS, and SCO Unix. + case "$host_os" in + vms* | cygwin* | pe | mingw* | sco* | udk* ) + ac_cv_func_mmap_anon=no ;; + *) + ac_cv_func_mmap_anon=yes;; + esac]) + fi +fi + +if test $ac_cv_func_mmap_file = yes; then + AC_DEFINE(HAVE_MMAP_FILE, 1, + [Define if read-only mmap of a plain file works.]) +fi +if test $ac_cv_func_mmap_dev_zero = yes; then + AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1, + [Define if mmap of /dev/zero works.]) +fi +if test $ac_cv_func_mmap_anon = yes; then + AC_DEFINE(HAVE_MMAP_ANON, 1, + [Define if mmap with MAP_ANON(YMOUS) works.]) +fi +]) + sinclude(../config/accross.m4) diff --git a/libffi/aclocal.m4 b/libffi/aclocal.m4 index 6ee9737..7dabcce 100644 --- a/libffi/aclocal.m4 +++ b/libffi/aclocal.m4 @@ -1,6 +1,6 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4-p5 +dnl aclocal.m4 generated automatically by aclocal 1.4 -dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -20,11 +20,100 @@ AC_DEFUN([AM_PROG_LIBTOOL],) AC_SUBST(LIBTOOL) ]) +# mmap(2) blacklisting. Some platforms provide the mmap library routine +# but don't support all of the features we need from it. +AC_DEFUN([AC_FUNC_MMAP_BLACKLIST], +[if test $ac_cv_header_sys_mman_h != yes \ + || test $ac_cv_func_mmap != yes; then + ac_cv_func_mmap_file=no + ac_cv_func_mmap_dev_zero=no + ac_cv_func_mmap_anon=no +else + AC_CACHE_CHECK([whether read-only mmap of a plain file works], + ac_cv_func_mmap_file, + [# Add a system to this blacklist if + # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a + # memory area containing the same data that you'd get if you applied + # read() to the same fd. The only system known to have a problem here + # is VMS, where text files have record structure. + case "$host_os" in + vms* | ultrix*) + ac_cv_func_mmap_file=no ;; + *) + ac_cv_func_mmap_file=yes;; + esac]) + AC_CACHE_CHECK([whether mmap from /dev/zero works], + ac_cv_func_mmap_dev_zero, + [# Add a system to this blacklist if it has mmap() but /dev/zero + # does not exist, or if mmapping /dev/zero does not give anonymous + # zeroed pages with both the following properties: + # 1. If you map N consecutive pages in with one call, and then + # unmap any subset of those pages, the pages that were not + # explicitly unmapped remain accessible. + # 2. If you map two adjacent blocks of memory and then unmap them + # both at once, they must both go away. + # Systems known to be in this category are Windows (all variants), + # VMS, and Darwin. + case "$host_os" in + vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) + ac_cv_func_mmap_dev_zero=no ;; + *) + ac_cv_func_mmap_dev_zero=yes;; + esac]) + + # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. + AC_CACHE_CHECK([for MAP_ANON(YMOUS)], ac_cv_decl_map_anon, + [AC_TRY_COMPILE( +[#include <sys/types.h> +#include <sys/mman.h> +#include <unistd.h> + +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif +], +[int n = MAP_ANONYMOUS;], + ac_cv_decl_map_anon=yes, + ac_cv_decl_map_anon=no)]) + + if test $ac_cv_decl_map_anon = no; then + ac_cv_func_mmap_anon=no + else + AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works], + ac_cv_func_mmap_anon, + [# Add a system to this blacklist if it has mmap() and MAP_ANON or + # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) + # doesn't give anonymous zeroed pages with the same properties listed + # above for use of /dev/zero. + # Systems known to be in this category are Windows, VMS, and SCO Unix. + case "$host_os" in + vms* | cygwin* | pe | mingw* | sco* | udk* ) + ac_cv_func_mmap_anon=no ;; + *) + ac_cv_func_mmap_anon=yes;; + esac]) + fi +fi + +if test $ac_cv_func_mmap_file = yes; then + AC_DEFINE(HAVE_MMAP_FILE, 1, + [Define if read-only mmap of a plain file works.]) +fi +if test $ac_cv_func_mmap_dev_zero = yes; then + AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1, + [Define if mmap of /dev/zero works.]) +fi +if test $ac_cv_func_mmap_anon = yes; then + AC_DEFINE(HAVE_MMAP_ANON, 1, + [Define if mmap with MAP_ANON(YMOUS) works.]) +fi +]) + sinclude(../config/accross.m4) # Like AC_CONFIG_HEADER, but automatically create stamp file. -AC_DEFUN([AM_CONFIG_HEADER], +AC_DEFUN(AM_CONFIG_HEADER, [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. @@ -54,7 +143,7 @@ changequote([,]))]) dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) -AC_DEFUN([AM_INIT_AUTOMAKE], +AC_DEFUN(AM_INIT_AUTOMAKE, [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) @@ -82,7 +171,7 @@ AC_REQUIRE([AC_PROG_MAKE_SET])]) # Check to make sure that the build environment is sane. # -AC_DEFUN([AM_SANITY_CHECK], +AC_DEFUN(AM_SANITY_CHECK, [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 @@ -123,7 +212,7 @@ AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. -AC_DEFUN([AM_MISSING_PROG], +AC_DEFUN(AM_MISSING_PROG, [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. @@ -142,7 +231,7 @@ AC_SUBST($1)]) # serial 1 -AC_DEFUN([AM_MAINTAINER_MODE], +AC_DEFUN(AM_MAINTAINER_MODE, [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, @@ -159,7 +248,7 @@ AC_DEFUN([AM_MAINTAINER_MODE], # Define a conditional. -AC_DEFUN([AM_CONDITIONAL], +AC_DEFUN(AM_CONDITIONAL, [AC_SUBST($1_TRUE) AC_SUBST($1_FALSE) if $2; then diff --git a/libffi/configure b/libffi/configure index 8a9ec77..8e09442 100755 --- a/libffi/configure +++ b/libffi/configure @@ -1250,6 +1250,7 @@ cygwin* | mingw* |pw32*) ;; darwin* | rhapsody*) + # this will be overwritten by pass_all, but leave it in just in case lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in @@ -1260,6 +1261,7 @@ darwin* | rhapsody*) lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' ;; esac + lt_cv_deplibs_check_method=pass_all ;; freebsd* ) @@ -1384,13 +1386,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:1388: checking for object suffix" >&5 +echo "configure:1390: checking for object suffix" >&5 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftest* echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:1394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then for ac_file in conftest.*; do case $ac_file in *.c) ;; @@ -1410,7 +1412,7 @@ ac_objext=$ac_cv_objext echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1414: checking for executable suffix" >&5 +echo "configure:1416: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1420,7 +1422,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1453,7 +1455,7 @@ case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6 -echo "configure:1457: checking for ${ac_tool_prefix}file" >&5 +echo "configure:1459: checking for ${ac_tool_prefix}file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1515,7 +1517,7 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then echo $ac_n "checking for file""... $ac_c" 1>&6 -echo "configure:1519: checking for file" >&5 +echo "configure:1521: checking for file" >&5 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1586,7 +1588,7 @@ esac # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1590: checking for $ac_word" >&5 +echo "configure:1592: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1618,7 +1620,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1622: checking for $ac_word" >&5 +echo "configure:1624: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1653,7 +1655,7 @@ fi # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1657: checking for $ac_word" >&5 +echo "configure:1659: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1685,7 +1687,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1689: checking for $ac_word" >&5 +echo "configure:1691: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1752,8 +1754,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 1756 "configure"' > conftest.$ac_ext - if { (eval echo configure:1757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 1758 "configure"' > conftest.$ac_ext + if { (eval echo configure:1759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) @@ -1786,7 +1788,7 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:1790: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:1792: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *ELF-32*) HPUX_IA64_MODE="32" @@ -1802,7 +1804,7 @@ ia64-*-hpux*) x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { (eval echo configure:1806: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:1808: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *32-bit*) case $host in @@ -1846,7 +1848,7 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:1850: checking whether the C compiler needs -belf" >&5 +echo "configure:1852: checking whether the C compiler needs -belf" >&5 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1859,14 +1861,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 1863 "configure" +#line 1865 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:1870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* lt_cv_cc_needs_belf=yes else @@ -1994,7 +1996,7 @@ exec 5>>./config.log # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1998: checking for a BSD compatible install" >&5 +echo "configure:2000: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2047,7 +2049,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:2051: checking whether build environment is sane" >&5 +echo "configure:2053: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -2104,7 +2106,7 @@ test "$program_suffix" != NONE && test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:2108: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:2110: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2143,7 +2145,7 @@ fi missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:2147: checking for working aclocal" >&5 +echo "configure:2149: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -2156,7 +2158,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:2160: checking for working autoconf" >&5 +echo "configure:2162: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -2169,7 +2171,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:2173: checking for working automake" >&5 +echo "configure:2175: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -2182,7 +2184,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:2186: checking for working autoheader" >&5 +echo "configure:2188: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -2195,7 +2197,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:2199: checking for working makeinfo" >&5 +echo "configure:2201: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -2212,7 +2214,7 @@ fi echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:2216: checking for executable suffix" >&5 +echo "configure:2218: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2222,7 +2224,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:2226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:2228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -2243,7 +2245,7 @@ echo "$ac_t""${ac_cv_exeext}" 1>&6 ac_exeext=$EXEEXT echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:2247: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:2249: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -2269,7 +2271,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2273: checking for $ac_word" >&5 +echo "configure:2275: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2299,7 +2301,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2303: checking for $ac_word" >&5 +echo "configure:2305: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2350,7 +2352,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2354: checking for $ac_word" >&5 +echo "configure:2356: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2382,7 +2384,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2386: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2388: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2393,12 +2395,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2397 "configure" +#line 2399 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2424,12 +2426,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2428: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2430: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2433: checking whether we are using GNU C" >&5 +echo "configure:2435: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2438,7 +2440,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2442: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2444: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2457,7 +2459,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2461: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2463: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2495,6 +2497,8 @@ fi +AC_FUNC_MMAP_BLACKLIST + if test -d $srcdir/testsuite; then @@ -2697,7 +2701,7 @@ case x$TARGET in esac echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2701: checking how to run the C preprocessor" >&5 +echo "configure:2705: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2712,13 +2716,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 2716 "configure" +#line 2720 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2722: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2729,13 +2733,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 2733 "configure" +#line 2737 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2739: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2746,13 +2750,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 2750 "configure" +#line 2754 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2756: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2760: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2777,12 +2781,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2781: checking for ANSI C header files" >&5 +echo "configure:2785: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2786 "configure" +#line 2790 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -2790,7 +2794,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2798: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2807,7 +2811,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2811 "configure" +#line 2815 "configure" #include "confdefs.h" #include <string.h> EOF @@ -2825,7 +2829,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 2829 "configure" +#line 2833 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -2846,7 +2850,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 2850 "configure" +#line 2854 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2857,7 +2861,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2883,12 +2887,12 @@ fi for ac_func in memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2887: checking for $ac_func" >&5 +echo "configure:2891: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2892 "configure" +#line 2896 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2911,7 +2915,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2938,19 +2942,19 @@ done # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2942: checking for working alloca.h" >&5 +echo "configure:2946: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2947 "configure" +#line 2951 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -2971,12 +2975,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2975: checking for alloca" >&5 +echo "configure:2979: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2980 "configure" +#line 2984 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -3004,7 +3008,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:3008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -3036,12 +3040,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:3040: checking whether alloca needs Cray hooks" >&5 +echo "configure:3044: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3045 "configure" +#line 3049 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -3066,12 +3070,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3070: checking for $ac_func" >&5 +echo "configure:3074: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3075 "configure" +#line 3079 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3094,7 +3098,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3121,7 +3125,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:3125: checking stack direction for C alloca" >&5 +echo "configure:3129: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3129,7 +3133,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 3133 "configure" +#line 3137 "configure" #include "confdefs.h" find_stack_direction () { @@ -3148,7 +3152,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:3152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3156: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -3171,13 +3175,13 @@ fi echo $ac_n "checking size of double""... $ac_c" 1>&6 -echo "configure:3175: checking size of double" >&5 +echo "configure:3179: checking size of double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext <<EOF -#line 3181 "configure" +#line 3185 "configure" #include "confdefs.h" #include "confdefs.h" #include <sys/types.h> @@ -3187,7 +3191,7 @@ int main() { switch (0) case 0: case (sizeof (double) == $ac_size):; ; return 0; } EOF -if { (eval echo configure:3191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sizeof_double=$ac_size else @@ -3210,13 +3214,13 @@ EOF echo $ac_n "checking size of long double""... $ac_c" 1>&6 -echo "configure:3214: checking size of long double" >&5 +echo "configure:3218: checking size of long double" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext <<EOF -#line 3220 "configure" +#line 3224 "configure" #include "confdefs.h" #include "confdefs.h" #include <sys/types.h> @@ -3226,7 +3230,7 @@ int main() { switch (0) case 0: case (sizeof (long double) == $ac_size):; ; return 0; } EOF -if { (eval echo configure:3230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sizeof_long_double=$ac_size else @@ -3263,14 +3267,14 @@ fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3267: checking whether byte ordering is bigendian" >&5 +echo "configure:3271: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 3274 "configure" +#line 3278 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3281,11 +3285,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3285: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3289: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 3289 "configure" +#line 3293 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3296,7 +3300,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3304: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -3316,7 +3320,7 @@ if test "$cross_compiling" = yes; then echo $ac_n "cross-compiling... " 2>&6 else cat > conftest.$ac_ext <<EOF -#line 3320 "configure" +#line 3324 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -3329,7 +3333,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:3333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -3347,7 +3351,7 @@ fi echo "$ac_t""$ac_cv_c_bigendian" 1>&6 if test $ac_cv_c_bigendian = unknown; then echo $ac_n "checking to probe for byte ordering""... $ac_c" 1>&6 -echo "configure:3351: checking to probe for byte ordering" >&5 +echo "configure:3355: checking to probe for byte ordering" >&5 cat >conftest.c <<EOF short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; @@ -3401,7 +3405,7 @@ fi if test x$TARGET = xSPARC; then echo $ac_n "checking assembler and linker support unaligned pc related relocs""... $ac_c" 1>&6 -echo "configure:3405: checking assembler and linker support unaligned pc related relocs" >&5 +echo "configure:3409: checking assembler and linker support unaligned pc related relocs" >&5 if eval "test \"`echo '$''{'libffi_cv_as_sparc_ua_pcrel'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3411,14 +3415,14 @@ else CFLAGS="$CFLAGS -fpic" LDFLAGS="$LDFLAGS -shared" cat > conftest.$ac_ext <<EOF -#line 3415 "configure" +#line 3419 "configure" #include "confdefs.h" asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text"); int main() { ; return 0; } EOF -if { (eval echo configure:3422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* libffi_cv_as_sparc_ua_pcrel=yes else @@ -3441,7 +3445,7 @@ EOF fi echo $ac_n "checking assembler .register pseudo-op support""... $ac_c" 1>&6 -echo "configure:3445: checking assembler .register pseudo-op support" >&5 +echo "configure:3449: checking assembler .register pseudo-op support" >&5 if eval "test \"`echo '$''{'libffi_cv_as_register_pseudo_op'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3449,14 +3453,14 @@ else libffi_cv_as_register_pseudo_op=unknown # Check if we have .register cat > conftest.$ac_ext <<EOF -#line 3453 "configure" +#line 3457 "configure" #include "confdefs.h" asm (".register %g2, #scratch"); int main() { ; return 0; } EOF -if { (eval echo configure:3460: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libffi_cv_as_register_pseudo_op=yes else @@ -3479,7 +3483,7 @@ EOF fi echo $ac_n "checking whether .eh_frame section should be read-only""... $ac_c" 1>&6 -echo "configure:3483: checking whether .eh_frame section should be read-only" >&5 +echo "configure:3487: checking whether .eh_frame section should be read-only" >&5 if eval "test \"`echo '$''{'libffi_cv_ro_eh_frame'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4101,4 +4105,3 @@ chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/libffi/configure.in b/libffi/configure.in index e11f42e..3691c6e 100644 --- a/libffi/configure.in +++ b/libffi/configure.in @@ -46,6 +46,8 @@ AC_PROG_CC AC_PROG_LIBTOOL +AC_FUNC_MMAP_BLACKLIST + dnl The -no-testsuite modules omit the test subdir. AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) diff --git a/libffi/fficonfig.h.in b/libffi/fficonfig.h.in index 0664506..bd6d486 100644 --- a/libffi/fficonfig.h.in +++ b/libffi/fficonfig.h.in @@ -28,6 +28,15 @@ /* Define if you have the memcpy function. */ #undef HAVE_MEMCPY +/* Define if read-only mmap of a plain file works. */ +#undef HAVE_MMAP_FILE + +/* Define if mmap of /dev/zero works. */ +#undef HAVE_MMAP_DEV_ZERO + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +#undef HAVE_MMAP_ANON + /* The number of bytes in type double */ #undef SIZEOF_DOUBLE diff --git a/libffi/testsuite/lib/libffi-dg.exp b/libffi/testsuite/lib/libffi-dg.exp index 87e285a..95d09c1 100644 --- a/libffi/testsuite/lib/libffi-dg.exp +++ b/libffi/testsuite/lib/libffi-dg.exp @@ -162,7 +162,7 @@ proc libffi_target_compile { source dest type options } { } # search for ffi_mips.h in srcdir, too - lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include" + lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.." lappend options "additional_flags=${libffi_link_flags}" if { [string match "powerpc-*-darwin*" $target_triplet] } { diff --git a/libffi/testsuite/libffi.call/closure_fn0.c b/libffi/testsuite/libffi.call/closure_fn0.c index f418f01..6d9b2cb 100644 --- a/libffi/testsuite/libffi.call/closure_fn0.c +++ b/libffi/testsuite/libffi.call/closure_fn0.c @@ -45,11 +45,19 @@ typedef int (*closure_test_type0)(unsigned long long, int, unsigned long long, int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = &ffi_type_uint; cl_arg_types[2] = &ffi_type_uint64; diff --git a/libffi/testsuite/libffi.call/closure_fn1.c b/libffi/testsuite/libffi.call/closure_fn1.c index f98a017..41818ad 100644 --- a/libffi/testsuite/libffi.call/closure_fn1.c +++ b/libffi/testsuite/libffi.call/closure_fn1.c @@ -9,6 +9,7 @@ /* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" + static void closure_test_fn1(ffi_cif* cif,void* resp,void** args, void* userdata) { @@ -40,11 +41,19 @@ typedef int (*closure_test_type1)(float, float, float, float, signed short, int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; diff --git a/libffi/testsuite/libffi.call/closure_fn2.c b/libffi/testsuite/libffi.call/closure_fn2.c index 5b06ec8..2a98f96 100644 --- a/libffi/testsuite/libffi.call/closure_fn2.c +++ b/libffi/testsuite/libffi.call/closure_fn2.c @@ -41,11 +41,19 @@ typedef int (*closure_test_type2)(double, double, double, double, signed short, int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_double; cl_arg_types[1] = &ffi_type_double; cl_arg_types[2] = &ffi_type_double; diff --git a/libffi/testsuite/libffi.call/closure_fn3.c b/libffi/testsuite/libffi.call/closure_fn3.c index 6af54c7..4f744c8 100644 --- a/libffi/testsuite/libffi.call/closure_fn3.c +++ b/libffi/testsuite/libffi.call/closure_fn3.c @@ -42,11 +42,18 @@ typedef int (*closure_test_type3)(float, float, float, float, float, float, int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; diff --git a/libffi/testsuite/libffi.call/closure_fn4.c b/libffi/testsuite/libffi.call/closure_fn4.c index 87ca0db..cbaaf30 100644 --- a/libffi/testsuite/libffi.call/closure_fn4.c +++ b/libffi/testsuite/libffi.call/closure_fn4.c @@ -59,11 +59,19 @@ typedef int (*closure_test_type0)(unsigned long long, unsigned long long, int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[17]; int i, res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + for (i = 0; i < 15; i++) { cl_arg_types[i] = &ffi_type_uint64; } diff --git a/libffi/testsuite/libffi.call/closure_fn5.c b/libffi/testsuite/libffi.call/closure_fn5.c index f7918c1..6a4fc67 100644 --- a/libffi/testsuite/libffi.call/closure_fn5.c +++ b/libffi/testsuite/libffi.call/closure_fn5.c @@ -59,10 +59,17 @@ typedef int (*closure_test_type0)(unsigned long long, unsigned long long, int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[17]; int i, res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif for (i = 0; i < 10; i++) { cl_arg_types[i] = &ffi_type_uint64; diff --git a/libffi/testsuite/libffi.call/cls_12byte.c b/libffi/testsuite/libffi.call/cls_12byte.c index a917a70..f8a87ec 100644 --- a/libffi/testsuite/libffi.call/cls_12byte.c +++ b/libffi/testsuite/libffi.call/cls_12byte.c @@ -41,13 +41,21 @@ static void cls_struct_12byte_gn(ffi_cif* cif, void* resp, void** args, void* us int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_16byte.c b/libffi/testsuite/libffi.call/cls_16byte.c index ae0e7c7..f8a3b57 100644 --- a/libffi/testsuite/libffi.call/cls_16byte.c +++ b/libffi/testsuite/libffi.call/cls_16byte.c @@ -42,13 +42,21 @@ static void cls_struct_16byte_gn(ffi_cif* cif, void* resp, void** args, void* us int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_18byte.c b/libffi/testsuite/libffi.call/cls_18byte.c index 0b1d07f..50ce9ff 100644 --- a/libffi/testsuite/libffi.call/cls_18byte.c +++ b/libffi/testsuite/libffi.call/cls_18byte.c @@ -46,13 +46,21 @@ cls_struct_18byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[3]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_19byte.c b/libffi/testsuite/libffi.call/cls_19byte.c index 2bb0b67..3bef938 100644 --- a/libffi/testsuite/libffi.call/cls_19byte.c +++ b/libffi/testsuite/libffi.call/cls_19byte.c @@ -49,13 +49,21 @@ cls_struct_19byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[3]; ffi_type* cls_struct_fields[6]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; @@ -85,7 +93,7 @@ int main (void) ffi_call(&cif, FFI_FN(cls_struct_19byte_fn), &res_dbl, args_dbl); /* { dg-output "1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ - printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, + printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); /* { dg-output "\nres: 5 252 250 8 239" } */ diff --git a/libffi/testsuite/libffi.call/cls_1_1byte.c b/libffi/testsuite/libffi.call/cls_1_1byte.c index f7682fe..cdf4963 100644 --- a/libffi/testsuite/libffi.call/cls_1_1byte.c +++ b/libffi/testsuite/libffi.call/cls_1_1byte.c @@ -40,13 +40,21 @@ cls_struct_1_1byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[2]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_20byte.c b/libffi/testsuite/libffi.call/cls_20byte.c index f3cc0eb..b02b84d 100644 --- a/libffi/testsuite/libffi.call/cls_20byte.c +++ b/libffi/testsuite/libffi.call/cls_20byte.c @@ -42,13 +42,21 @@ cls_struct_20byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_20byte1.c b/libffi/testsuite/libffi.call/cls_20byte1.c index 089f02e..41866fe 100644 --- a/libffi/testsuite/libffi.call/cls_20byte1.c +++ b/libffi/testsuite/libffi.call/cls_20byte1.c @@ -42,13 +42,21 @@ cls_struct_20byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[3]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_24byte.c b/libffi/testsuite/libffi.call/cls_24byte.c index f3adb9d..ff0f841 100644 --- a/libffi/testsuite/libffi.call/cls_24byte.c +++ b/libffi/testsuite/libffi.call/cls_24byte.c @@ -53,13 +53,21 @@ cls_struct_24byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_2byte.c b/libffi/testsuite/libffi.call/cls_2byte.c index 672437d..2e38177 100644 --- a/libffi/testsuite/libffi.call/cls_2byte.c +++ b/libffi/testsuite/libffi.call/cls_2byte.c @@ -42,13 +42,21 @@ cls_struct_2byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_3_1byte.c b/libffi/testsuite/libffi.call/cls_3_1byte.c index 26f6501..8e3044f 100644 --- a/libffi/testsuite/libffi.call/cls_3_1byte.c +++ b/libffi/testsuite/libffi.call/cls_3_1byte.c @@ -46,13 +46,21 @@ cls_struct_3_1byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_3byte1.c b/libffi/testsuite/libffi.call/cls_3byte1.c index 9f51f55..294067f 100644 --- a/libffi/testsuite/libffi.call/cls_3byte1.c +++ b/libffi/testsuite/libffi.call/cls_3byte1.c @@ -42,13 +42,21 @@ cls_struct_3byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_3byte2.c b/libffi/testsuite/libffi.call/cls_3byte2.c index 815debf..c429958 100644 --- a/libffi/testsuite/libffi.call/cls_3byte2.c +++ b/libffi/testsuite/libffi.call/cls_3byte2.c @@ -42,13 +42,21 @@ cls_struct_3byte_gn1(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_4_1byte.c b/libffi/testsuite/libffi.call/cls_4_1byte.c index 000506e..008e24a 100644 --- a/libffi/testsuite/libffi.call/cls_4_1byte.c +++ b/libffi/testsuite/libffi.call/cls_4_1byte.c @@ -48,13 +48,21 @@ cls_struct_4_1byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_4byte.c b/libffi/testsuite/libffi.call/cls_4byte.c index fdf9b9b..ecb2ce9 100644 --- a/libffi/testsuite/libffi.call/cls_4byte.c +++ b/libffi/testsuite/libffi.call/cls_4byte.c @@ -42,13 +42,21 @@ cls_struct_4byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_5byte.c b/libffi/testsuite/libffi.call/cls_5byte.c index 877ea4c..6274a19 100644 --- a/libffi/testsuite/libffi.call/cls_5byte.c +++ b/libffi/testsuite/libffi.call/cls_5byte.c @@ -45,13 +45,21 @@ cls_struct_5byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_64byte.c b/libffi/testsuite/libffi.call/cls_64byte.c index 28d5590..cc1b771 100644 --- a/libffi/testsuite/libffi.call/cls_64byte.c +++ b/libffi/testsuite/libffi.call/cls_64byte.c @@ -58,13 +58,21 @@ cls_struct_64byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[9]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_6byte.c b/libffi/testsuite/libffi.call/cls_6byte.c index 5eb17d2..0c1ab28 100644 --- a/libffi/testsuite/libffi.call/cls_6byte.c +++ b/libffi/testsuite/libffi.call/cls_6byte.c @@ -47,13 +47,21 @@ cls_struct_6byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_7byte.c b/libffi/testsuite/libffi.call/cls_7byte.c index 9c1765a..a7998dd 100644 --- a/libffi/testsuite/libffi.call/cls_7byte.c +++ b/libffi/testsuite/libffi.call/cls_7byte.c @@ -47,13 +47,21 @@ cls_struct_7byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_8byte.c b/libffi/testsuite/libffi.call/cls_8byte.c index d9050d4..efa1afc 100644 --- a/libffi/testsuite/libffi.call/cls_8byte.c +++ b/libffi/testsuite/libffi.call/cls_8byte.c @@ -41,13 +41,21 @@ cls_struct_8byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_9byte1.c b/libffi/testsuite/libffi.call/cls_9byte1.c index 06acca4..6994570 100644 --- a/libffi/testsuite/libffi.call/cls_9byte1.c +++ b/libffi/testsuite/libffi.call/cls_9byte1.c @@ -43,13 +43,21 @@ static void cls_struct_9byte_gn(ffi_cif* cif, void* resp, void** args, int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_9byte2.c b/libffi/testsuite/libffi.call/cls_9byte2.c index 21d7b49..976ed59 100644 --- a/libffi/testsuite/libffi.call/cls_9byte2.c +++ b/libffi/testsuite/libffi.call/cls_9byte2.c @@ -43,13 +43,21 @@ static void cls_struct_9byte_gn(ffi_cif* cif, void* resp, void** args, int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/cls_double.c b/libffi/testsuite/libffi.call/cls_double.c index 51ec26a..3df6cf3 100644 --- a/libffi/testsuite/libffi.call/cls_double.c +++ b/libffi/testsuite/libffi.call/cls_double.c @@ -20,11 +20,19 @@ typedef double (*cls_ret_double)(double); int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[2]; double res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_double; cl_arg_types[1] = NULL; diff --git a/libffi/testsuite/libffi.call/cls_float.c b/libffi/testsuite/libffi.call/cls_float.c index bd1601e..ac4ec48 100644 --- a/libffi/testsuite/libffi.call/cls_float.c +++ b/libffi/testsuite/libffi.call/cls_float.c @@ -21,11 +21,19 @@ typedef float (*cls_ret_float)(float); int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[2]; float res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = NULL; diff --git a/libffi/testsuite/libffi.call/cls_schar.c b/libffi/testsuite/libffi.call/cls_schar.c index ecdbfb6..1e607ab 100644 --- a/libffi/testsuite/libffi.call/cls_schar.c +++ b/libffi/testsuite/libffi.call/cls_schar.c @@ -19,11 +19,19 @@ typedef signed char (*cls_ret_schar)(signed char); int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[2]; signed char res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = NULL; diff --git a/libffi/testsuite/libffi.call/cls_sint.c b/libffi/testsuite/libffi.call/cls_sint.c index caae0d4..c85067b 100644 --- a/libffi/testsuite/libffi.call/cls_sint.c +++ b/libffi/testsuite/libffi.call/cls_sint.c @@ -19,11 +19,19 @@ typedef signed int (*cls_ret_sint)(signed int); int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[2]; signed int res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_sint32; cl_arg_types[1] = NULL; diff --git a/libffi/testsuite/libffi.call/cls_sshort.c b/libffi/testsuite/libffi.call/cls_sshort.c index 3b1e4c6..65e6872 100644 --- a/libffi/testsuite/libffi.call/cls_sshort.c +++ b/libffi/testsuite/libffi.call/cls_sshort.c @@ -19,11 +19,19 @@ typedef signed short (*cls_ret_sshort)(signed short); int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[2]; signed short res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_sint16; cl_arg_types[1] = NULL; diff --git a/libffi/testsuite/libffi.call/cls_uchar.c b/libffi/testsuite/libffi.call/cls_uchar.c index e5027b2..6a1e637 100644 --- a/libffi/testsuite/libffi.call/cls_uchar.c +++ b/libffi/testsuite/libffi.call/cls_uchar.c @@ -19,11 +19,19 @@ typedef unsigned char (*cls_ret_uchar)(unsigned char); int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[2]; unsigned char res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_uchar; cl_arg_types[1] = NULL; diff --git a/libffi/testsuite/libffi.call/cls_uint.c b/libffi/testsuite/libffi.call/cls_uint.c index 08f2912..501e179 100644 --- a/libffi/testsuite/libffi.call/cls_uint.c +++ b/libffi/testsuite/libffi.call/cls_uint.c @@ -20,11 +20,19 @@ typedef unsigned int (*cls_ret_uint)(unsigned int); int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[2]; unsigned int res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_uint32; cl_arg_types[1] = NULL; diff --git a/libffi/testsuite/libffi.call/cls_ulonglong.c b/libffi/testsuite/libffi.call/cls_ulonglong.c index 80dc2db..072da8c 100644 --- a/libffi/testsuite/libffi.call/cls_ulonglong.c +++ b/libffi/testsuite/libffi.call/cls_ulonglong.c @@ -20,11 +20,19 @@ typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long); int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[2]; unsigned long long res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = NULL; diff --git a/libffi/testsuite/libffi.call/cls_ushort.c b/libffi/testsuite/libffi.call/cls_ushort.c index 3599f67..f6626b9 100644 --- a/libffi/testsuite/libffi.call/cls_ushort.c +++ b/libffi/testsuite/libffi.call/cls_ushort.c @@ -20,11 +20,19 @@ typedef unsigned short (*cls_ret_ushort)(unsigned short); int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[2]; unsigned short res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cl_arg_types[0] = &ffi_type_ushort; cl_arg_types[1] = NULL; diff --git a/libffi/testsuite/libffi.call/ffitest.h b/libffi/testsuite/libffi.call/ffitest.h index 7856405..2d0df0e 100644 --- a/libffi/testsuite/libffi.call/ffitest.h +++ b/libffi/testsuite/libffi.call/ffitest.h @@ -2,8 +2,77 @@ #include <stdio.h> #include <string.h> #include <ffi.h> +#include "fficonfig.h" #define MAX_ARGS 256 -#define CHECK(x) !(x) ? abort() : 0 +#define CHECK(x) !(x) ? abort() : 0 + +/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a + file open. */ +#ifdef HAVE_MMAP_ANON +# undef HAVE_MMAP_DEV_ZERO + +# include <sys/mman.h> +# ifndef MAP_FAILED +# define MAP_FAILED -1 +# endif +# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +# endif +# define USING_MMAP + +#endif + +#ifdef HAVE_MMAP_DEV_ZERO + +# include <sys/mman.h> +# ifndef MAP_FAILED +# define MAP_FAILED -1 +# endif +# define USING_MMAP + +#endif + +#ifdef USING_MMAP +static inline void * +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 == MAP_FAILED) + { + perror ("virtual memory exhausted"); + exit (1); + } + + return page; +} + +#endif diff --git a/libffi/testsuite/libffi.call/nested_struct.c b/libffi/testsuite/libffi.call/nested_struct.c index e9fb4f9..86d685a 100644 --- a/libffi/testsuite/libffi.call/nested_struct.c +++ b/libffi/testsuite/libffi.call/nested_struct.c @@ -67,8 +67,10 @@ cls_struct_combined_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type* cls_struct_fields1[5]; @@ -76,6 +78,12 @@ int main (void) ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/nested_struct1.c b/libffi/testsuite/libffi.call/nested_struct1.c index 57373fb..1d87945 100644 --- a/libffi/testsuite/libffi.call/nested_struct1.c +++ b/libffi/testsuite/libffi.call/nested_struct1.c @@ -71,8 +71,10 @@ cls_struct_combined_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type* cls_struct_fields1[5]; @@ -80,6 +82,12 @@ int main (void) ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/nested_struct2.c b/libffi/testsuite/libffi.call/nested_struct2.c index 7c06685..3572a4c 100644 --- a/libffi/testsuite/libffi.call/nested_struct2.c +++ b/libffi/testsuite/libffi.call/nested_struct2.c @@ -58,14 +58,22 @@ B_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/nested_struct3.c b/libffi/testsuite/libffi.call/nested_struct3.c index 0f578b2..95cf2f3 100644 --- a/libffi/testsuite/libffi.call/nested_struct3.c +++ b/libffi/testsuite/libffi.call/nested_struct3.c @@ -49,14 +49,22 @@ B_gn(ffi_cif* cif, void* resp, void** args, void* userdata) int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; diff --git a/libffi/testsuite/libffi.call/problem1.c b/libffi/testsuite/libffi.call/problem1.c index f3bd3b5..5b6397f 100644 --- a/libffi/testsuite/libffi.call/problem1.c +++ b/libffi/testsuite/libffi.call/problem1.c @@ -29,61 +29,69 @@ my_ffi_struct callee(struct my_ffi_struct a1, struct my_ffi_struct a2) void stub(ffi_cif* cif, void* resp, void** args, void* userdata) { - struct my_ffi_struct a1; - struct my_ffi_struct a2; + struct my_ffi_struct a1; + struct my_ffi_struct a2; - a1 = *(struct my_ffi_struct*)(args[0]); - a2 = *(struct my_ffi_struct*)(args[1]); + a1 = *(struct my_ffi_struct*)(args[0]); + a2 = *(struct my_ffi_struct*)(args[1]); - *(my_ffi_struct *)resp = callee(a1, a2); + *(my_ffi_struct *)resp = callee(a1, a2); } int main(void) { - ffi_type* my_ffi_struct_fields[4]; - ffi_type my_ffi_struct_type; - ffi_cif cif; - static ffi_closure cl; - ffi_closure *pcl = &cl; - void* args[4]; - ffi_type* arg_types[3]; - - struct my_ffi_struct g = { 1.0, 2.0, 3.0 }; - struct my_ffi_struct f = { 1.0, 2.0, 3.0 }; - struct my_ffi_struct res; - - my_ffi_struct_type.size = 0; - my_ffi_struct_type.alignment = 0; - my_ffi_struct_type.type = FFI_TYPE_STRUCT; - my_ffi_struct_type.elements = my_ffi_struct_fields; - - my_ffi_struct_fields[0] = &ffi_type_double; - my_ffi_struct_fields[1] = &ffi_type_double; - my_ffi_struct_fields[2] = &ffi_type_double; - my_ffi_struct_fields[3] = NULL; - - arg_types[0] = &my_ffi_struct_type; - arg_types[1] = &my_ffi_struct_type; - arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &my_ffi_struct_type, - arg_types) == FFI_OK); - - args[0] = &g; - args[1] = &f; - args[2] = NULL; - ffi_call(&cif, FFI_FN(callee), &res, args); - /* { dg-output "1 2 3 1 2 3: 2 4 6" } */ - printf("res: %g %g %g\n", res.a, res.b, res.c); - /* { dg-output "\nres: 2 4 6" } */ - - CHECK(ffi_prep_closure(pcl, &cif, stub, NULL) == FFI_OK); - - res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(pcl))(g, f); - /* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */ - printf("res: %g %g %g\n", res.a, res.b, res.c); - /* { dg-output "\nres: 2 4 6" } */ - - exit(0);; + ffi_type* my_ffi_struct_fields[4]; + ffi_type my_ffi_struct_type; + ffi_cif cif; +#ifndef USING_MMAP + static ffi_closure cl; +#endif + ffi_closure *pcl; + void* args[4]; + ffi_type* arg_types[3]; + +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + + struct my_ffi_struct g = { 1.0, 2.0, 3.0 }; + struct my_ffi_struct f = { 1.0, 2.0, 3.0 }; + struct my_ffi_struct res; + + my_ffi_struct_type.size = 0; + my_ffi_struct_type.alignment = 0; + my_ffi_struct_type.type = FFI_TYPE_STRUCT; + my_ffi_struct_type.elements = my_ffi_struct_fields; + + my_ffi_struct_fields[0] = &ffi_type_double; + my_ffi_struct_fields[1] = &ffi_type_double; + my_ffi_struct_fields[2] = &ffi_type_double; + my_ffi_struct_fields[3] = NULL; + + arg_types[0] = &my_ffi_struct_type; + arg_types[1] = &my_ffi_struct_type; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &my_ffi_struct_type, + arg_types) == FFI_OK); + + args[0] = &g; + args[1] = &f; + args[2] = NULL; + ffi_call(&cif, FFI_FN(callee), &res, args); + /* { dg-output "1 2 3 1 2 3: 2 4 6" } */ + printf("res: %g %g %g\n", res.a, res.b, res.c); + /* { dg-output "\nres: 2 4 6" } */ + + CHECK(ffi_prep_closure(pcl, &cif, stub, NULL) == FFI_OK); + + res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(pcl))(g, f); + /* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */ + printf("res: %g %g %g\n", res.a, res.b, res.c); + /* { dg-output "\nres: 2 4 6" } */ + + exit(0);; } diff --git a/libffi/testsuite/libffi.special/ffitestcxx.h b/libffi/testsuite/libffi.special/ffitestcxx.h index fabe305..ef08882 100644 --- a/libffi/testsuite/libffi.special/ffitestcxx.h +++ b/libffi/testsuite/libffi.special/ffitestcxx.h @@ -1,8 +1,76 @@ #include <stdlib.h> #include <stdio.h> #include <ffi.h> +#include "fficonfig.h" #define MAX_ARGS 256 #define CHECK(x) (!(x) ? abort() : (void)0) +/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a + file open. */ +#ifdef HAVE_MMAP_ANON +# undef HAVE_MMAP_DEV_ZERO + +# include <sys/mman.h> +# ifndef MAP_FAILED +# define MAP_FAILED -1 +# endif +# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +# endif +# define USING_MMAP + +#endif + +#ifdef HAVE_MMAP_DEV_ZERO + +# include <sys/mman.h> +# ifndef MAP_FAILED +# define MAP_FAILED -1 +# endif +# define USING_MMAP + +#endif + +#ifdef USING_MMAP +static inline void * +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 == MAP_FAILED) + { + perror ("virtual memory exhausted"); + exit (1); + } + + return page; +} + +#endif diff --git a/libffi/testsuite/libffi.special/unwindtest.cc b/libffi/testsuite/libffi.special/unwindtest.cc index d393a50..7261a07 100644 --- a/libffi/testsuite/libffi.special/unwindtest.cc +++ b/libffi/testsuite/libffi.special/unwindtest.cc @@ -49,10 +49,18 @@ typedef int (*closure_test_type1)(float, float, float, float, signed short, int main (void) { ffi_cif cif; +#ifndef USING_MMAP static ffi_closure cl; - ffi_closure *pcl = &cl; +#endif + ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; +#ifdef USING_MMAP + pcl = allocate_mmap (sizeof(ffi_closure)); +#else + pcl = &cl; +#endif + { cl_arg_types[1] = NULL; |