diff options
Diffstat (limited to 'libffi')
-rw-r--r-- | libffi/ChangeLog | 21 | ||||
-rw-r--r-- | libffi/Makefile.am | 7 | ||||
-rw-r--r-- | libffi/Makefile.in | 5 | ||||
-rw-r--r-- | libffi/aclocal.m4 | 34 | ||||
-rwxr-xr-x | libffi/configure | 543 | ||||
-rw-r--r-- | libffi/configure.in | 2 | ||||
-rw-r--r-- | libffi/include/ffi.h.in | 76 | ||||
-rw-r--r-- | libffi/src/ffitest.c | 33 | ||||
-rw-r--r-- | libffi/src/ia64/ffi.c | 670 | ||||
-rw-r--r-- | libffi/src/ia64/ia64_flags.h | 62 | ||||
-rw-r--r-- | libffi/src/ia64/unix.S | 301 | ||||
-rw-r--r-- | libffi/src/java_raw_api.c | 271 | ||||
-rw-r--r-- | libffi/src/raw_api.c | 8 |
13 files changed, 1681 insertions, 352 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 4692d4f540f..49a78bda796 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,24 @@ +2000-02-25 Hans Boehm <boehm@acm.org> + + * src/ia64/ffi.c, src/ia64/ia64_flags.h, src/ia64/unix.S: New + files. + * src/raw_api.c (ffi_translate_args): Fixed typo in argument + list. + (ffi_prep_raw_closure): Use ffi_translate_args, not + ffi_closure_translate. + * src/java_raw_api.c: New file. + * src/ffitest.c (closure_test_fn): New function. + (main): Define `rint' as long long on IA64. Added new test when + FFI_CLOSURES is defined. + * include/ffi.h.in (ALIGN): Use size_t, not unsigned. + (ffi_abi): Recognize IA64. + (ffi_raw): Added `flt' field. + Added "Java raw API" code. + * configure.in: Recognize ia64. + * Makefile.am (TARGET_SRC_IA64): New macro. + (libffi_la_common_SOURCES): Added java_raw_api.c. + (libffi_la_SOURCES): Define in IA64 case. + 2000-01-04 Tom Tromey <tromey@cygnus.com> * Makefile.in: Rebuilt with newer automake. diff --git a/libffi/Makefile.am b/libffi/Makefile.am index 79f54baaf00..28369e78917 100644 --- a/libffi/Makefile.am +++ b/libffi/Makefile.am @@ -42,13 +42,15 @@ TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S TARGET_SRC_SPARC = src/sparc/ffi.c src/sparc/v8.S TARGET_SRC_ALPHA = src/alpha/ffi.c src/alpha/osf.S +TARGET_SRC_IA64 = src/alpha/ffi.c src/alpha/unix.S TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S TARGET_SRC_ARM = src/arm/sysv.S src/arm/ffi.c ##libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c $(TARGET_SRC_@TARGET@) ## Work around automake deficiency -libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c src/raw_api.c +libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c \ + src/raw_api.c src/java_raw_api.c if MIPS_GCC libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC) endif @@ -64,6 +66,9 @@ endif if ALPHA libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_ALPHA) endif +if IA64 +libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_IA64) +endif if M68K libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_M68K) endif diff --git a/libffi/Makefile.in b/libffi/Makefile.in index 637be51497b..cd171a6bba3 100644 --- a/libffi/Makefile.in +++ b/libffi/Makefile.in @@ -117,16 +117,18 @@ TARGET_SRC_MIPS_SGI = src/mips/ffi.c src/mips/o32.s src/mips/n32.s TARGET_SRC_X86 = src/x86/ffi.c src/x86/sysv.S TARGET_SRC_SPARC = src/sparc/ffi.c src/sparc/v8.S TARGET_SRC_ALPHA = src/alpha/ffi.c src/alpha/osf.S +TARGET_SRC_IA64 = src/alpha/ffi.c src/alpha/unix.S TARGET_SRC_M68K = src/m68k/ffi.c src/m68k/sysv.S TARGET_SRC_POWERPC = src/powerpc/ffi.c src/powerpc/sysv.S TARGET_SRC_ARM = src/arm/sysv.S src/arm/ffi.c -libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c src/raw_api.c +libffi_la_common_SOURCES = src/debug.c src/prep_cif.c src/types.c src/raw_api.c src/java_raw_api.c @MIPS_GCC_TRUE@libffi_la_SOURCES = @MIPS_GCC_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_GCC) @MIPS_SGI_TRUE@libffi_la_SOURCES = @MIPS_SGI_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_MIPS_SGI) @X86_TRUE@libffi_la_SOURCES = @X86_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_X86) @SPARC_TRUE@libffi_la_SOURCES = @SPARC_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_SPARC) @ALPHA_TRUE@libffi_la_SOURCES = @ALPHA_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_ALPHA) +@IA64_TRUE@libffi_la_SOURCES = $(libffi_la_common_SOURCES) $(TARGET_SRC_IA64) @M68K_TRUE@libffi_la_SOURCES = @M68K_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_M68K) @POWERPC_TRUE@libffi_la_SOURCES = @POWERPC_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_POWERPC) @ARM_TRUE@libffi_la_SOURCES = @ARM_TRUE@$(libffi_la_common_SOURCES) $(TARGET_SRC_ARM) @@ -290,6 +292,7 @@ debug.lo: src/debug.c prep_cif.lo: src/prep_cif.c types.lo: src/types.c raw_api.lo: src/raw_api.c +java_raw_api.lo: src/java_raw_api.c ffi.lo: src/alpha/ffi.c osf.lo: src/alpha/osf.S sysv.lo: src/arm/sysv.S diff --git a/libffi/aclocal.m4 b/libffi/aclocal.m4 index e0b65b99cb4..5bcef980326 100644 --- a/libffi/aclocal.m4 +++ b/libffi/aclocal.m4 @@ -1,4 +1,4 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4a +dnl aclocal.m4 generated automatically by aclocal 1.4 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -44,8 +44,6 @@ dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN(AM_INIT_AUTOMAKE, [AC_REQUIRE([AC_PROG_INSTALL]) -dnl We require 2.13 because we rely on SHELL being computed by configure. -AC_PREREQ([2.13]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] @@ -66,23 +64,6 @@ AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -dnl Set install_sh for make dist -install_sh="$missing_dir/install-sh" -test -f "$install_sh" || install_sh="$missing_dir/install.sh" -AC_SUBST(install_sh) -dnl We check for tar when the user configures the end package. -dnl This is sad, since we only need this for "dist". However, -dnl there's no other good way to do it. We prefer GNU tar if -dnl we can find it. If we can't find a tar, it doesn't really matter. -AC_CHECK_PROGS(AMTAR, gnutar gtar tar) -AMTARFLAGS= -if test -n "$AMTAR"; then - if $SHELL -c "$AMTAR --version" > /dev/null 2>&1; then - dnl We have GNU tar. - AMTARFLAGS=o - fi -fi -AC_SUBST(AMTARFLAGS) AC_REQUIRE([AC_PROG_MAKE_SET])]) # @@ -191,7 +172,7 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ || AC_MSG_ERROR([libtool configure failed]) # Reload cache, that may have been modified by ltconfig @@ -223,6 +204,11 @@ AC_REQUIRE([AC_PROG_NM])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" @@ -241,7 +227,7 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. -case "$host" in +case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext @@ -457,7 +443,6 @@ else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_SUBST(LD) AC_PROG_LD_GNU ]) @@ -503,14 +488,13 @@ else fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) -AC_SUBST(NM) ]) # AC_CHECK_LIBM - check for math library AC_DEFUN(AC_CHECK_LIBM, [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= -case "$host" in +case "$lt_target" in *-*-beos* | *-*-cygwin*) # These system don't have libm ;; diff --git a/libffi/configure b/libffi/configure index 104ea16b952..f8259483b5c 100755 --- a/libffi/configure +++ b/libffi/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13.1 +# Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -49,6 +49,7 @@ program_suffix=NONE program_transform_name=s,x,x, silent= site= +sitefile= srcdir= target=NONE verbose= @@ -163,6 +164,7 @@ Configuration: --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX @@ -333,6 +335,11 @@ EOF -site=* | --site=* | --sit=*) site="$ac_optarg" ;; + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) @@ -354,7 +361,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13.1" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -498,12 +505,16 @@ fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi +else + CONFIG_SITE="$sitefile" fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then @@ -514,7 +525,7 @@ done if test -r "$cache_file"; then echo "loading cache $cache_file" - test -f "$cache_file" && . $cache_file + . $cache_file else echo "creating cache $cache_file" > $cache_file @@ -568,50 +579,36 @@ done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. -echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:578: checking host system type" >&5 -if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then # Make sure we can run config.sub. - if $ac_config_sub sun4 >/dev/null 2>&1; then : - else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } - fi - - ac_cv_host_alias=$host - case "$ac_cv_host_alias" in - NONE) - case $nonopt in - NONE) - if ac_cv_host_alias=`$ac_config_guess`; then : - else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } - fi ;; - *) ac_cv_host_alias=$nonopt ;; - esac ;; - esac - - ac_cv_host=`$ac_config_sub $ac_cv_host_alias` - ac_cv_host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` - ac_cv_host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` - ac_cv_host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -else - echo $ac_n "(cached) $ac_c" 1>&6 +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi -echo "$ac_t""$ac_cv_host" 1>&6 - -host=$ac_cv_host -host_alias=$ac_cv_host_alias -host_cpu=$ac_cv_host_cpu -host_vendor=$ac_cv_host_vendor -host_os=$ac_cv_host_os - +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:594: checking host system type" >&5 +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 # Find a good install program. We prefer a C program (faster), @@ -626,9 +623,9 @@ host_os=$ac_cv_host_os # 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:630: checking for a BSD compatible install" >&5 +echo "configure:627: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then -if eval "test \"\${ac_cv_path_install+set}\" = set"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" @@ -646,10 +643,6 @@ else grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : - elif test $ac_prog = install && - grep pwplus $ac_dir/$ac_prog >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 @@ -678,12 +671,12 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' +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:687: checking whether build environment is sane" >&5 +echo "configure:680: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -731,18 +724,18 @@ EOF_SED rm -f conftestsed fi test "$program_prefix" != NONE && - program_transform_name="s,^,${program_prefix},;$program_transform_name" + program_transform_name="s,^,${program_prefix},; $program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && - program_transform_name="s,\$\$,${program_suffix},;$program_transform_name" + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" # sed with no file args requires a program. 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:744: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:737: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftestmake <<\EOF @@ -767,7 +760,6 @@ else fi - PACKAGE=libffi VERSION=2.00-beta @@ -780,7 +772,7 @@ fi missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:784: checking for working aclocal" >&5 +echo "configure:776: 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. @@ -793,7 +785,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:797: checking for working autoconf" >&5 +echo "configure:789: 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. @@ -806,7 +798,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:810: checking for working automake" >&5 +echo "configure:802: 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. @@ -819,7 +811,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:823: checking for working autoheader" >&5 +echo "configure:815: 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. @@ -832,7 +824,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:836: checking for working makeinfo" >&5 +echo "configure:828: 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. @@ -844,59 +836,15 @@ else echo "$ac_t""missing" 1>&6 fi -install_sh="$missing_dir/install-sh" -test -f "$install_sh" || install_sh="$missing_dir/install.sh" - -for ac_prog in gnutar gtar tar -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:856: checking for $ac_word" >&5 -if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$AMTAR"; then - ac_cv_prog_AMTAR="$AMTAR" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_AMTAR="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -AMTAR="$ac_cv_prog_AMTAR" -if test -n "$AMTAR"; then - echo "$ac_t""$AMTAR" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$AMTAR" && break -done - -AMTARFLAGS= -if test -n "$AMTAR"; then - if $SHELL -c "$AMTAR --version" > /dev/null 2>&1; then - AMTARFLAGS=o - fi -fi - echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:895: checking for Cygwin environment" >&5 -if eval "test \"\${ac_cv_cygwin+set}\" = set"; then +echo "configure:843: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 900 "configure" +#line 848 "configure" #include "confdefs.h" int main() { @@ -907,7 +855,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -917,25 +865,26 @@ else ac_cv_cygwin=no fi rm -f conftest* +rm -f conftest* fi echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:927: checking for mingw32 environment" >&5 -if eval "test \"\${ac_cv_mingw32+set}\" = set"; then +echo "configure:876: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 932 "configure" +#line 881 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:939: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:888: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -945,57 +894,29 @@ else ac_cv_mingw32=no fi rm -f conftest* +rm -f conftest* fi echo "$ac_t""$ac_cv_mingw32" 1>&6 MINGW32= test "$ac_cv_mingw32" = yes && MINGW32=yes -echo $ac_n "checking for EMX OS/2 environment""... $ac_c" 1>&6 -echo "configure:955: checking for EMX OS/2 environment" >&5 -if eval "test \"\${ac_cv_emxos2+set}\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 960 "configure" -#include "confdefs.h" - -int main() { -return __EMX__; -; return 0; } -EOF -if { (eval echo configure:967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_emxos2=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_emxos2=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_emxos2" 1>&6 -EMXOS2= -test "$ac_cv_emxos2" = yes && EMXOS2=yes - echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:986: checking for executable suffix" >&5 -if eval "test \"\${ac_cv_exeext+set}\" = set"; then +echo "configure:907: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = yes; then + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then ac_cv_exeext=.exe else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.C | *.o | *.obj | *.xcoff) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -1013,7 +934,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:1017: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:938: 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" @@ -1039,8 +960,8 @@ 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:1043: checking for $ac_word" >&5 -if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then +echo "configure:964: 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 if test -n "$CC"; then @@ -1069,8 +990,8 @@ 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:1073: checking for $ac_word" >&5 -if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then +echo "configure:994: 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 if test -n "$CC"; then @@ -1116,12 +1037,12 @@ fi if test -z "$CC"; then case "`uname -s`" in - *win32* | *WIN32* | *CYGWIN*) + *win32* | *WIN32*) # 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:1124: checking for $ac_word" >&5 -if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then +echo "configure:1045: 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 if test -n "$CC"; then @@ -1151,8 +1072,8 @@ fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1156: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5 +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1077: 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. @@ -1163,12 +1084,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1167 "configure" +#line 1088 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1093: \"$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 @@ -1193,14 +1114,14 @@ echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 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 $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1198: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:1119: 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:1203: checking whether we are using GNU C" >&5 -if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then +echo "configure:1124: 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 cat > conftest.c <<EOF @@ -1208,7 +1129,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1212: \"$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:1133: \"$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 @@ -1227,8 +1148,8 @@ 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:1231: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then +echo "configure:1152: 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 echo 'void f(){}' > conftest.c @@ -1327,51 +1248,29 @@ else enable_fast_install=yes fi - echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1333: checking build system type" >&5 -if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then - -# Make sure we can run config.sub. - if $ac_config_sub sun4 >/dev/null 2>&1; then : - else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } - fi - - ac_cv_build_alias=$build - case "$ac_cv_build_alias" in - NONE) - case $nonopt in - NONE) - ac_cv_build_alias=$host_alias ;; - - *) ac_cv_build_alias=$nonopt ;; - esac ;; - esac - - ac_cv_build=`$ac_config_sub $ac_cv_build_alias` - ac_cv_build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` - ac_cv_build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` - ac_cv_build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -else - echo $ac_n "(cached) $ac_c" 1>&6 -fi - -echo "$ac_t""$ac_cv_build" 1>&6 - -build=$ac_cv_build -build_alias=$ac_cv_build_alias -build_cpu=$ac_cv_build_cpu -build_vendor=$ac_cv_build_vendor -build_os=$ac_cv_build_os - - +echo "configure:1253: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 # 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:1374: checking for $ac_word" >&5 -if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then +echo "configure:1273: 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 if test -n "$RANLIB"; then @@ -1409,7 +1308,7 @@ ac_prog=ld if test "$ac_cv_prog_gcc" = yes; then # Check if gcc -print-prog-name=ld gives a path. echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 -echo "configure:1413: checking for ld used by GCC" >&5 +echo "configure:1312: checking for ld used by GCC" >&5 ac_prog=`($CC -print-prog-name=ld) 2>&5` case "$ac_prog" in # Accept absolute paths. @@ -1433,12 +1332,12 @@ echo "configure:1413: checking for ld used by GCC" >&5 esac elif test "$with_gnu_ld" = yes; then echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 -echo "configure:1437: checking for GNU ld" >&5 +echo "configure:1336: checking for GNU ld" >&5 else echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 -echo "configure:1440: checking for non-GNU ld" >&5 +echo "configure:1339: checking for non-GNU ld" >&5 fi -if eval "test \"\${ac_cv_path_LD+set}\" = set"; then +if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -z "$LD"; then @@ -1470,10 +1369,9 @@ else echo "$ac_t""no" 1>&6 fi test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } - echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 -echo "configure:1476: checking if the linker ($LD) is GNU ld" >&5 -if eval "test \"\${ac_cv_prog_gnu_ld+set}\" = set"; then +echo "configure:1374: checking if the linker ($LD) is GNU ld" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. @@ -1488,8 +1386,8 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6 -echo "configure:1492: checking for BSD-compatible nm" >&5 -if eval "test \"\${ac_cv_path_NM+set}\" = set"; then +echo "configure:1390: checking for BSD-compatible nm" >&5 +if eval "test \"`echo '$''{'ac_cv_path_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$NM"; then @@ -1523,10 +1421,9 @@ fi NM="$ac_cv_path_NM" echo "$ac_t""$NM" 1>&6 - echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1529: checking whether ln -s works" >&5 -if eval "test \"\${ac_cv_prog_LN_S+set}\" = set"; then +echo "configure:1426: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftestdata @@ -1546,6 +1443,11 @@ else fi +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + # Check for any special flags to pass to ltconfig. libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" @@ -1566,11 +1468,11 @@ test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" # Some flags need to be propagated to the compiler or linker for good # libtool support. -case "$host" in +case "$lt_target" in *-*-irix6*) # Find out which ABI we are using. - echo '#line 1573 "configure"' > conftest.$ac_ext - if { (eval echo configure:1574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + echo '#line 1475 "configure"' > conftest.$ac_ext + if { (eval echo configure:1476: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then case "`/usr/bin/file conftest.o`" in *32-bit*) LD="${LD-ld} -32" @@ -1591,19 +1493,19 @@ case "$host" in SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6 -echo "configure:1595: checking whether the C compiler needs -belf" >&5 -if eval "test \"\${lt_cv_cc_needs_belf+set}\" = set"; then +echo "configure:1497: 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 cat > conftest.$ac_ext <<EOF -#line 1600 "configure" +#line 1502 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:1607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1509: \"$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 @@ -1681,13 +1583,13 @@ LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ || { echo "configure: error: libtool configure failed" 1>&2; exit 1; } # Reload cache, that may have been modified by ltconfig if test -r "$cache_file"; then echo "loading cache $cache_file" - test -f "$cache_file" && . $cache_file + . $cache_file else echo "creating cache $cache_file" > $cache_file @@ -1713,6 +1615,7 @@ i*86-*-beos*) TARGET=X86; TARGETDIR=x86;; sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;; sparc-sun-*) TARGET=SPARC; TARGETDIR=sparc;; alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; TARGETDIR=alpha;; +ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;; m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;; powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;; powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;; @@ -1770,6 +1673,15 @@ else fi +if test x$TARGET = xIA64; then + IA64_TRUE= + IA64_FALSE='#' +else + IA64_TRUE='#' + IA64_FALSE= +fi + + if test x$TARGET = xM68K; then M68K_TRUE= M68K_FALSE='#' @@ -1797,13 +1709,13 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1801: checking how to run the C preprocessor" >&5 +echo "configure:1713: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then -if eval "test \"\${ac_cv_prog_CPP+set}\" = set"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get @@ -1812,13 +1724,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 1816 "configure" +#line 1728 "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:1822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1734: \"$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 : @@ -1829,13 +1741,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1833 "configure" +#line 1745 "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:1839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1751: \"$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 : @@ -1846,13 +1758,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1850 "configure" +#line 1762 "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:1856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1768: \"$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 : @@ -1877,12 +1789,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1881: checking for ANSI C header files" >&5 -if eval "test \"\${ac_cv_header_stdc+set}\" = set"; then +echo "configure:1793: 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 1886 "configure" +#line 1798 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1890,7 +1802,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1894: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1806: \"$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* @@ -1907,7 +1819,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 1911 "configure" +#line 1823 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1925,7 +1837,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 1929 "configure" +#line 1841 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1946,7 +1858,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1950 "configure" +#line 1862 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1957,7 +1869,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1983,12 +1895,12 @@ fi for ac_func in memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1987: checking for $ac_func" >&5 -if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then +echo "configure:1899: 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 1992 "configure" +#line 1904 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1997,7 +1909,6 @@ else /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); -char (*f)(); int main() { @@ -2007,12 +1918,12 @@ int main() { #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -f = $ac_func; +$ac_func(); #endif ; return 0; } EOF -if { (eval echo configure:2016: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1927: \"$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 @@ -2039,19 +1950,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:2043: checking for working alloca.h" >&5 -if eval "test \"\${ac_cv_header_alloca_h+set}\" = set"; then +echo "configure:1954: 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 2048 "configure" +#line 1959 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1966: \"$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 @@ -2072,12 +1983,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2076: checking for alloca" >&5 -if eval "test \"\${ac_cv_func_alloca_works+set}\" = set"; then +echo "configure:1987: 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 2081 "configure" +#line 1992 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -2105,7 +2016,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:2109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2020: \"$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 @@ -2137,12 +2048,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2141: checking whether alloca needs Cray hooks" >&5 -if eval "test \"\${ac_cv_os_cray+set}\" = set"; then +echo "configure:2052: 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 2146 "configure" +#line 2057 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -2167,12 +2078,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:2171: checking for $ac_func" >&5 -if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then +echo "configure:2082: 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 2176 "configure" +#line 2087 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2181,7 +2092,6 @@ else /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); -char (*f)(); int main() { @@ -2191,12 +2101,12 @@ int main() { #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else -f = $ac_func; +$ac_func(); #endif ; return 0; } EOF -if { (eval echo configure:2200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2110: \"$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 @@ -2223,15 +2133,15 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2227: checking stack direction for C alloca" >&5 -if eval "test \"\${ac_cv_c_stack_direction+set}\" = set"; then +echo "configure:2137: 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 if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 2235 "configure" +#line 2145 "configure" #include "confdefs.h" find_stack_direction () { @@ -2250,7 +2160,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:2254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2164: \"$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 @@ -2273,15 +2183,15 @@ fi echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:2277: checking size of short" >&5 -if eval "test \"\${ac_cv_sizeof_short+set}\" = set"; then +echo "configure:2187: checking size of short" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2285 "configure" +#line 2195 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -2292,7 +2202,7 @@ main() exit(0); } EOF -if { (eval echo configure:2296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -2312,15 +2222,15 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:2316: checking size of int" >&5 -if eval "test \"\${ac_cv_sizeof_int+set}\" = set"; then +echo "configure:2226: checking size of int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2324 "configure" +#line 2234 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -2331,7 +2241,7 @@ main() exit(0); } EOF -if { (eval echo configure:2335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -2351,15 +2261,15 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:2355: checking size of long" >&5 -if eval "test \"\${ac_cv_sizeof_long+set}\" = set"; then +echo "configure:2265: checking size of long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2363 "configure" +#line 2273 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -2370,7 +2280,7 @@ main() exit(0); } EOF -if { (eval echo configure:2374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -2390,15 +2300,15 @@ EOF echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:2394: checking size of long long" >&5 -if eval "test \"\${ac_cv_sizeof_long_long+set}\" = set"; then +echo "configure:2304: checking size of long long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2402 "configure" +#line 2312 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -2409,7 +2319,7 @@ main() exit(0); } EOF -if { (eval echo configure:2413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else @@ -2429,15 +2339,15 @@ EOF echo $ac_n "checking size of float""... $ac_c" 1>&6 -echo "configure:2433: checking size of float" >&5 -if eval "test \"\${ac_cv_sizeof_float+set}\" = set"; then +echo "configure:2343: checking size of float" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2441 "configure" +#line 2351 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -2448,7 +2358,7 @@ main() exit(0); } EOF -if { (eval echo configure:2452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_float=`cat conftestval` else @@ -2468,15 +2378,15 @@ EOF echo $ac_n "checking size of double""... $ac_c" 1>&6 -echo "configure:2472: checking size of double" >&5 -if eval "test \"\${ac_cv_sizeof_double+set}\" = set"; then +echo "configure:2382: 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 if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2480 "configure" +#line 2390 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -2487,7 +2397,7 @@ main() exit(0); } EOF -if { (eval echo configure:2491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_double=`cat conftestval` else @@ -2507,15 +2417,15 @@ EOF echo $ac_n "checking size of long double""... $ac_c" 1>&6 -echo "configure:2511: checking size of long double" >&5 -if eval "test \"\${ac_cv_sizeof_long_double+set}\" = set"; then +echo "configure:2421: 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 if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2519 "configure" +#line 2429 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -2526,7 +2436,7 @@ main() exit(0); } EOF -if { (eval echo configure:2530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_double=`cat conftestval` else @@ -2547,15 +2457,15 @@ EOF echo $ac_n "checking size of void *""... $ac_c" 1>&6 -echo "configure:2551: checking size of void *" >&5 -if eval "test \"\${ac_cv_sizeof_void_p+set}\" = set"; then +echo "configure:2461: checking size of void *" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2559 "configure" +#line 2469 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -2566,7 +2476,7 @@ main() exit(0); } EOF -if { (eval echo configure:2570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_void_p=`cat conftestval` else @@ -2586,14 +2496,14 @@ EOF echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:2590: checking whether byte ordering is bigendian" >&5 -if eval "test \"\${ac_cv_c_bigendian+set}\" = set"; then +echo "configure:2500: 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 2597 "configure" +#line 2507 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -2604,11 +2514,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2518: \"$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 2612 "configure" +#line 2522 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -2619,7 +2529,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2623: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2533: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -2639,7 +2549,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2643 "configure" +#line 2553 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -2652,7 +2562,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:2656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2566: \"$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 @@ -2821,7 +2731,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13.1" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -2879,9 +2789,6 @@ s%@AUTOCONF@%$AUTOCONF%g s%@AUTOMAKE@%$AUTOMAKE%g s%@AUTOHEADER@%$AUTOHEADER%g s%@MAKEINFO@%$MAKEINFO%g -s%@install_sh@%$install_sh%g -s%@AMTAR@%$AMTAR%g -s%@AMTARFLAGS@%$AMTARFLAGS%g s%@SET_MAKE@%$SET_MAKE%g s%@EXEEXT@%$EXEEXT%g s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g @@ -2894,8 +2801,6 @@ s%@build_cpu@%$build_cpu%g s%@build_vendor@%$build_vendor%g s%@build_os@%$build_os%g s%@RANLIB@%$RANLIB%g -s%@LD@%$LD%g -s%@NM@%$NM%g s%@LN_S@%$LN_S%g s%@LIBTOOL@%$LIBTOOL%g s%@MIPS_GCC_TRUE@%$MIPS_GCC_TRUE%g @@ -2908,6 +2813,8 @@ s%@X86_TRUE@%$X86_TRUE%g s%@X86_FALSE@%$X86_FALSE%g s%@ALPHA_TRUE@%$ALPHA_TRUE%g s%@ALPHA_FALSE@%$ALPHA_FALSE%g +s%@IA64_TRUE@%$IA64_TRUE%g +s%@IA64_FALSE@%$IA64_FALSE%g s%@M68K_TRUE@%$M68K_TRUE%g s%@M68K_FALSE@%$M68K_FALSE%g s%@POWERPC_TRUE@%$POWERPC_TRUE%g @@ -3147,5 +3054,5 @@ exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || $SHELL $CONFIG_STATUS || exit 1 +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 diff --git a/libffi/configure.in b/libffi/configure.in index a8d6eda89c0..dbbd1434af2 100644 --- a/libffi/configure.in +++ b/libffi/configure.in @@ -27,6 +27,7 @@ i*86-*-beos*) TARGET=X86; TARGETDIR=x86;; sparc-sun-4*) TARGET=SPARC; TARGETDIR=sparc;; sparc-sun-*) TARGET=SPARC; TARGETDIR=sparc;; alpha*-*-linux* | alpha*-*-osf*) TARGET=ALPHA; TARGETDIR=alpha;; +ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;; m68k-*-linux*) TARGET=M68K; TARGETDIR=m68k;; powerpc-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;; powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;; @@ -42,6 +43,7 @@ AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA) +AM_CONDITIONAL(IA64, test x$TARGET = xIA64) AM_CONDITIONAL(M68K, test x$TARGET = xM68K) AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC) AM_CONDITIONAL(ARM, test x$TARGET = xARM) diff --git a/libffi/include/ffi.h.in b/libffi/include/ffi.h.in index 8eefb6dbcd0..655cc1c6cbf 100644 --- a/libffi/include/ffi.h.in +++ b/libffi/include/ffi.h.in @@ -1,7 +1,7 @@ /* -----------------------------------------------------------------*-C-*- libffi @VERSION@ - Copyright (c) 1996-1999 Cygnus Solutions - $Id: ffi.h.in,v 1.2 1999/08/09 02:52:58 green Exp $ + $Id: ffi.h.in,v 1.3 1999/09/01 23:16:34 tromey Exp $ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -24,6 +24,32 @@ ----------------------------------------------------------------------- */ +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://sourceware.cygnus.com/ml/java-discuss/1999-q3/msg00138.html + + and + + http://sourceware.cygnus.com/ml/java-discuss/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + #ifndef LIBFFI_H #define LIBFFI_H @@ -138,7 +164,9 @@ extern "C" { /* ---- Generic type definitions ----------------------------------------- */ -#define ALIGN(v, a) (((((unsigned) (v))-1) | ((a)-1))+1) +#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ typedef enum ffi_abi { @@ -159,6 +187,12 @@ typedef enum ffi_abi { FFI_DEFAULT_ABI = FFI_SYSV, #endif + /* ---- Intel ia64 ---------------- */ +#ifdef IA64 + FFI_UNIX, /* Linux and all Unix variants use the same conventions */ + FFI_DEFAULT_ABI = FFI_UNIX, +#endif + /* ---- Mips --------------------- */ #ifdef MIPS FFI_O32, @@ -268,6 +302,7 @@ typedef struct { typedef union { SINT_ARG sint; UINT_ARG uint; + float flt; char data[SIZEOF_ARG]; void* ptr; } ffi_raw; @@ -281,8 +316,22 @@ void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); size_t ffi_raw_size (ffi_cif *cif); +#if !NO_JAVA_RAW_API +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ +void ffi_java_raw_call (/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, + /*@dependent@*/ ffi_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +#endif /* !NO_JAVA_RAW_API */ #endif /* !FFI_NO_RAW_API */ @@ -294,6 +343,21 @@ size_t ffi_raw_size (ffi_cif *cif); #define FFI_TRAMPOLINE_SIZE 10 #define FFI_NATIVE_RAW_API 1 /* and has native raw api support */ +#elif defined(IA64) + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 24 /* Really the following struct, which */ + /* can be interpreted as a C function */ + /* decriptor: */ + +struct ffi_ia64_trampoline_struct { + void * code_pointer; /* Pointer to ffi_closure_UNIX */ + void * fake_gp; /* Pointer to closure, installed as gp */ + void * real_gp; /* Real gp value, reinstalled by */ + /* ffi_closure_UNIX. */ +}; +#define FFI_NATIVE_RAW_API 0 + #else #define FFI_CLOSURES 0 @@ -347,6 +411,14 @@ ffi_prep_raw_closure (ffi_raw_closure*, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data); +#ifndef NO_JAVA_RAW_API +ffi_status +ffi_prep_java_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); +#endif + #endif /* !FFI_NO_RAW_API */ #endif /* FFI_CLOSURES */ diff --git a/libffi/src/ffitest.c b/libffi/src/ffitest.c index 17d5d392c0b..3dd0989783c 100644 --- a/libffi/src/ffitest.c +++ b/libffi/src/ffitest.c @@ -196,6 +196,16 @@ static test_structure_5 struct5(test_structure_5 ts1, test_structure_5 ts2) return ts1; } +/* Take an int and a float argument, together with int userdata, and */ +/* return the sum. */ +static void closure_test_fn(ffi_cif* cif,void* resp,void** args, void* userdata) +{ + *(int*)resp = + *(int *)args[0] + (int)(*(float *)args[1]) + (int)(long)userdata; +} + +typedef int (*closure_test_type)(int, float); + int main(/*@unused@*/ int argc, /*@unused@*/ char *argv[]) { ffi_cif cif; @@ -214,7 +224,7 @@ int main(/*@unused@*/ int argc, /*@unused@*/ char *argv[]) signed int si1; signed int si2; -#if defined(ALPHA) || (defined(MIPS) && (_MIPS_SIM == _ABIN32)) +#if defined(ALPHA) || defined(IA64) || (defined(MIPS) && (_MIPS_SIM == _ABIN32)) long long rint; #else int rint; @@ -691,6 +701,27 @@ int main(/*@unused@*/ int argc, /*@unused@*/ char *argv[]) free (ts5_result); } +# if FFI_CLOSURES + /* A simple closure test */ + { + ffi_closure cl; + ffi_type * cl_arg_types[3]; + + cl_arg_types[0] = &ffi_type_sint; + cl_arg_types[1] = &ffi_type_float; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure(&cl, &cif, closure_test_fn, + (void *) 3 /* userdata */) + == FFI_OK); + CHECK((*((closure_test_type)(&cl)))(1, 2.0) == 6); + } +# endif + /* If we arrived here, all is good */ (void) puts("\nLooks good. No surprises.\n"); diff --git a/libffi/src/ia64/ffi.c b/libffi/src/ia64/ffi.c new file mode 100644 index 00000000000..bb4fbb73a72 --- /dev/null +++ b/libffi/src/ia64/ffi.c @@ -0,0 +1,670 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 1998 Cygnus Solutions + Copyright (c) 2000 Hewlett Packard Company + + IA64 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 CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include <ffi.h> +#include <ffi_common.h> + +#include <stdlib.h> + +#include "ia64_flags.h" + +/* Memory image of fp register contents. Should eventually be an fp */ +/* type long enough to hold an entire register. For now we use double. */ +typedef double float80; + +/* The stack layout at call to ffi_prep_regs. Other_args will remain */ +/* on the stack for the actual call. Everything else we be transferred */ +/* to registers and popped by the assembly code. */ + +struct ia64_args { + long scratch[2]; /* Two scratch words at top of stack. */ + /* Allows sp to passed as arg pointer. */ + void * r8_contents; /* Value to be passed in r8 */ + long spare; /* Not used. */ + float80 fp_regs[8]; /* Contents of 8 floating point argument */ + /* registers. */ + long out_regs[8]; /* Contents of the 8 out registers used */ + /* for integer parameters. */ + long other_args[0]; /* Arguments passed on stack, variable size */ + /* Treated as continuation of out_regs. */ +}; + +static size_t float_type_size(unsigned short tp) +{ + switch(tp) { + case FFI_TYPE_FLOAT: + return sizeof(float); + case FFI_TYPE_DOUBLE: + return sizeof(double); +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + return sizeof(long double); +#endif + default: + FFI_ASSERT(0); + } +} + +/* + * Is type a struct containing at most n floats, doubles, or extended + * doubles, all of the same fp type? + * If so, set *element_type to the fp type. + */ +static bool is_homogeneous_fp_aggregate(ffi_type * type, int n, + unsigned short * element_type) +{ + ffi_type **ptr; + unsigned short element, struct_element; + + int type_set = 0; + + FFI_ASSERT(type != NULL); + + FFI_ASSERT(type->elements != NULL); + + ptr = &(type->elements[0]); + + while ((*ptr) != NULL) + { + switch((*ptr) -> type) { + case FFI_TYPE_FLOAT: + if (type_set && element != FFI_TYPE_FLOAT) return 0; + if (--n < 0) return FALSE; + type_set = 1; + element = FFI_TYPE_FLOAT; + break; + case FFI_TYPE_DOUBLE: + if (type_set && element != FFI_TYPE_DOUBLE) return 0; + if (--n < 0) return FALSE; + type_set = 1; + element = FFI_TYPE_DOUBLE; + break; + case FFI_TYPE_STRUCT: + if (!is_homogeneous_fp_aggregate(type, n, &struct_element)) + return FALSE; + if (type_set && struct_element != element) return FALSE; + n -= (type -> size)/float_type_size(element); + element = struct_element; + if (n < 0) return FALSE; + break; + /* case FFI_TYPE_LONGDOUBLE: + Not yet implemented. */ + default: + return FALSE; + } + ptr++; + } + *element_type = element; + return TRUE; + +} + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments. Returns nonzero + if fp registers are used for arguments. */ + +static bool +ffi_prep_args(struct ia64_args *stack, extended_cif *ecif, int bytes) +{ + register long i, avn; + register void **p_argv; + register long *argp = stack -> out_regs; + register float80 *fp_argp = stack -> fp_regs; + register ffi_type **p_arg; + + /* For big return structs, r8 needs to contain the target address. */ + /* Since r8 is otherwise dead, we set it unconditionally. */ + stack -> r8_contents = ecif -> rvalue; + i = 0; + avn = ecif->cif->nargs; + p_arg = ecif->cif->arg_types; + p_argv = ecif->avalue; + while (i < avn) + { + size_t z; /* z is in units of arg slots or words, not bytes. */ + + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + z = 1; + *(SINT64 *) argp = *(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + z = 1; + *(UINT64 *) argp = *(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + z = 1; + *(SINT64 *) argp = *(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + z = 1; + *(UINT64 *) argp = *(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_SINT32: + z = 1; + *(SINT64 *) argp = *(SINT32 *)(* p_argv); + break; + + case FFI_TYPE_UINT32: + z = 1; + *(UINT64 *) argp = *(UINT32 *)(* p_argv); + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_POINTER: + z = 1; + *(UINT64 *) argp = *(UINT64 *)(* p_argv); + break; + + case FFI_TYPE_FLOAT: + z = 1; + if (fp_argp - stack->fp_regs < 8) + { + /* Note the conversion -- all the fp regs are loaded as + doubles. */ + *fp_argp++ = *(float *)(* p_argv); + } + /* Also put it into the integer registers or memory: */ + *(UINT64 *) argp = *(UINT32 *)(* p_argv); + break; + + case FFI_TYPE_DOUBLE: + z = 1; + if (fp_argp - stack->fp_regs < 8) + *fp_argp++ = *(double *)(* p_argv); + /* Also put it into the integer registers or memory: */ + *(double *) argp = *(double *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + { + size_t sz = (*p_arg)->size; + unsigned short element_type; + z = ((*p_arg)->size + SIZEOF_ARG - 1)/SIZEOF_ARG; + if (is_homogeneous_fp_aggregate(*p_arg, 8, &element_type)) { + int i; + int nelements = sz/float_type_size(element_type); + for (i = 0; i < nelements; ++i) { + switch (element_type) { + case FFI_TYPE_FLOAT: + if (fp_argp - stack->fp_regs < 8) + *fp_argp++ = ((float *)(* p_argv))[i]; + break; + case FFI_TYPE_DOUBLE: + if (fp_argp - stack->fp_regs < 8) + *fp_argp++ = ((double *)(* p_argv))[i]; + break; + default: + /* Extended precision not yet implemented. */ + abort(); + } + } + } + /* And pass it in integer registers as a struct, with */ + /* its actual field sizes packed into registers. */ + memcpy(argp, *p_argv, (*p_arg)->size); + } + break; + + default: + FFI_ASSERT(0); + } + + argp += z; + i++, p_arg++, p_argv++; + } + return (fp_argp != stack -> fp_regs); +} + +/* Perform machine dependent cif processing */ +ffi_status +ffi_prep_cif_machdep(ffi_cif *cif) +{ + long i, avn; + bool is_simple = TRUE; + long simple_flag = FFI_SIMPLE_V; + /* Adjust cif->bytes to include space for the 2 scratch words, + r8 register contents, spare word, + the 8 fp register contents, and all 8 integer register contents. + This will be removed before the call, though 2 scratch words must + remain. */ + + cif->bytes += 4*sizeof(long) + 8 *sizeof(float80); + if (cif->bytes < sizeof(struct ia64_args)) + cif->bytes = sizeof(struct ia64_args); + + /* The stack must be double word aligned, so round bytes up + appropriately. */ + + cif->bytes = ALIGN(cif->bytes, 2*sizeof(void*)); + + avn = cif->nargs; + if (avn <= 2) { + for (i = 0; i < avn; ++i) { + switch(cif -> arg_types[i] -> type) { + case FFI_TYPE_SINT32: + simple_flag = FFI_ADD_INT_ARG(simple_flag); + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_POINTER: + simple_flag = FFI_ADD_LONG_ARG(simple_flag); + break; + default: + is_simple = FALSE; + } + } + } else { + is_simple = FALSE; + } + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + cif->flags = FFI_TYPE_VOID; + break; + + case FFI_TYPE_STRUCT: + { + size_t sz = cif -> rtype -> size; + unsigned short element_type; + + is_simple = FALSE; + if (is_homogeneous_fp_aggregate(cif -> rtype, 8, &element_type)) { + int nelements = sz/float_type_size(element_type); + if (nelements <= 1) { + if (0 == nelements) { + cif -> flags = FFI_TYPE_VOID; + } else { + cif -> flags = element_type; + } + } else { + switch(element_type) { + case FFI_TYPE_FLOAT: + cif -> flags = FFI_IS_FLOAT_FP_AGGREGATE | nelements; + break; + case FFI_TYPE_DOUBLE: + cif -> flags = FFI_IS_DOUBLE_FP_AGGREGATE | nelements; + break; + default: + /* long double NYI */ + abort(); + } + } + break; + } + if (sz <= 32) { + if (sz <= 8) { + cif->flags = FFI_TYPE_INT; + } else if (sz <= 16) { + cif->flags = FFI_IS_SMALL_STRUCT2; + } else if (sz <= 24) { + cif->flags = FFI_IS_SMALL_STRUCT3; + } else { + cif->flags = FFI_IS_SMALL_STRUCT4; + } + } else { + cif->flags = FFI_TYPE_STRUCT; + } + } + break; + + case FFI_TYPE_FLOAT: + is_simple = FALSE; + cif->flags = FFI_TYPE_FLOAT; + break; + + case FFI_TYPE_DOUBLE: + is_simple = FALSE; + cif->flags = FFI_TYPE_DOUBLE; + break; + + default: + cif->flags = FFI_TYPE_INT; + /* This seems to depend on little endian mode, and the fact that */ + /* the return pointer always points to at least 8 bytes. But */ + /* that also seems to be true for other platforms. */ + break; + } + + if (is_simple) cif -> flags |= simple_flag; + return FFI_OK; +} + +extern int ffi_call_unix(bool (*)(struct ia64_args *, extended_cif *, int), + extended_cif *, unsigned, + unsigned, unsigned *, void (*)()); + +void +ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue) +{ + extended_cif ecif; + long simple = cif -> flags & FFI_SIMPLE; + + /* Should this also check for Unix ABI? */ + /* This is almost, but not quite, machine independent. Note that */ + /* we can get away with not caring about length of the result because */ + /* we assume we are little endian, and the result buffer is large */ + /* enough. */ + /* This needs work for HP/UX. */ + if (simple) { + long (*lfn)() = (long (*)())fn; + long result; + switch(simple) { + case FFI_SIMPLE_V: + result = lfn(); + break; + case FFI_SIMPLE_I: + result = lfn(*(int *)avalue[0]); + break; + case FFI_SIMPLE_L: + result = lfn(*(long *)avalue[0]); + break; + case FFI_SIMPLE_II: + result = lfn(*(int *)avalue[0], *(int *)avalue[1]); + break; + case FFI_SIMPLE_IL: + result = lfn(*(int *)avalue[0], *(long *)avalue[1]); + break; + case FFI_SIMPLE_LI: + result = lfn(*(long *)avalue[0], *(int *)avalue[1]); + break; + case FFI_SIMPLE_LL: + result = lfn(*(long *)avalue[0], *(long *)avalue[1]); + break; + } + if ((cif->flags & ~FFI_SIMPLE) != FFI_TYPE_VOID && 0 != rvalue) { + * (long *)rvalue = result; + } + return; + } + 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_UNIX: + ffi_call_unix(ffi_prep_args, &ecif, cif->bytes, + cif->flags, rvalue, fn); + break; + + default: + FFI_ASSERT(0); + break; + } +} + +/* + * Closures represent a pair consisting of a function pointer, and + * some user data. A closure is invoked by reinterpreting the closure + * as a function pointer, and branching to it. Thus we can make an + * interpreted function callable as a C function: We turn the interpreter + * itself, together with a pointer specifying the interpreted procedure, + * into a closure. + * On X86, the first few words of the closure structure actually contain code, + * which will do the right thing. On most other architectures, this + * would raise some Icache/Dcache coherence issues (which can be solved, but + * often not cheaply). + * For IA64, function pointer are already pairs consisting of a code + * pointer, and a gp pointer. The latter is needed to access global variables. + * Here we set up such a pair as the first two words of the closure (in + * the "trampoline" area), but we replace the gp pointer with a pointer + * to the closure itself. We also add the real gp pointer to the + * closure. This allows the function entry code to both retrieve the + * user data, and to restire the correct gp pointer. + */ + +static void +ffi_prep_incoming_args_UNIX(struct ia64_args *args, void **rvalue, + void **avalue, ffi_cif *cif); + +/* This function is entered with the doctored gp (r1) value. + * This code is extremely gcc specific. There is some argument that + * it should really be written in assembly code, since it depends on + * gcc properties that might change over time. + */ + +/* ffi_closure_UNIX is an assembly routine, which copies the register */ +/* state into s struct ia64_args, and the invokes */ +/* ffi_closure_UNIX_inner. It also recovers the closure pointer */ +/* from its fake gp pointer. */ +void ffi_closure_UNIX(); + +#ifndef __GNUC__ +# error This requires gcc +#endif +void +ffi_closure_UNIX_inner (ffi_closure *closure, struct ia64_args * args) +/* Hopefully declarint this as a varargs function will force all args */ +/* to memory. */ +{ + // this is our return value storage + long double res; + + // our various things... + ffi_cif *cif; + unsigned short rtype; + void *resp; + void **arg_area; + + resp = (void*)&res; + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_UNIX(args, (void**)&resp, arg_area, cif); + + (closure->fun) (cif, resp, arg_area, closure->user_data); + + rtype = cif->flags; + + /* now, do a generic return based on the value of rtype */ + if (rtype == FFI_TYPE_INT) + { + asm volatile ("ld8 r8=[%0]" : : "r" (resp) : "r8"); + } + else if (rtype == FFI_TYPE_FLOAT) + { + asm volatile ("ldfs f8=[%0]" : : "r" (resp) : "f8"); + } + else if (rtype == FFI_TYPE_DOUBLE) + { + asm volatile ("ldfd f8=[%0]" : : "r" (resp) : "f8"); + } + else if (rtype == FFI_IS_SMALL_STRUCT2) + { + asm volatile ("ld8 r8=[%0]; ld8 r9=[%1]" + : : "r" (resp), "r" (resp+8) : "r8","r9"); + } + else if (rtype == FFI_IS_SMALL_STRUCT3) + { + asm volatile ("ld8 r8=[%0]; ld8 r9=[%1]; ld8 r10=[%2]" + : : "r" (resp), "r" (resp+8), "r" (resp+16) + : "r8","r9","r10"); + } + else if (rtype == FFI_IS_SMALL_STRUCT4) + { + asm volatile ("ld8 r8=[%0]; ld8 r9=[%1]; ld8 r10=[%2]; ld8 r11=[%3]" + : : "r" (resp), "r" (resp+8), "r" (resp+16), "r" (resp+24) + : "r8","r9","r10","r11"); + } + else if (rtype != FFI_TYPE_VOID && rtype != FFI_TYPE_STRUCT) + { + /* Can only happen for homogeneous FP aggregates? */ + abort(); + } +} + +static void +ffi_prep_incoming_args_UNIX(struct ia64_args *args, void **rvalue, + void **avalue, ffi_cif *cif) +{ + register unsigned int i; + register unsigned int avn; + register void **p_argv; + register unsigned long *argp = args -> out_regs; + unsigned fp_reg_num = 0; + register ffi_type **p_arg; + + avn = cif->nargs; + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; i != 0; i--, p_arg++) + { + size_t z; /* In units of words or argument slots. */ + + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_POINTER: + z = 1; + *p_argv = (void *)argp; + break; + + case FFI_TYPE_FLOAT: + z = 1; + /* Convert argument back to float in place from the saved value */ + if (fp_reg_num < 8) { + *(float *)argp = args -> fp_regs[fp_reg_num++]; + } else { + *(float *)argp = *(double *)argp; + } + *p_argv = (void *)argp; + break; + + case FFI_TYPE_DOUBLE: + z = 1; + if (fp_reg_num < 8) { + *p_argv = args -> fp_regs + fp_reg_num++; + } else { + *p_argv = (void *)argp; + } + break; + + case FFI_TYPE_STRUCT: + { + size_t sz = (*p_arg)->size; + unsigned short element_type; + z = ((*p_arg)->size + SIZEOF_ARG - 1)/SIZEOF_ARG; + if (is_homogeneous_fp_aggregate(*p_arg, 8, &element_type)) { + int nelements = sz/float_type_size(element_type); + if (nelements + fp_reg_num >= 8) { + /* hard case NYI. */ + abort(); + } + if (element_type == FFI_TYPE_DOUBLE) { + *p_argv = args -> fp_regs + fp_reg_num; + fp_reg_num += nelements; + break; + } + if (element_type == FFI_TYPE_FLOAT) { + int j; + for (j = 0; j < nelements; ++ j) { + ((float *)argp)[j] = args -> fp_regs[fp_reg_num + j]; + } + *p_argv = (void *)argp; + fp_reg_num += nelements; + break; + } + abort(); /* Other fp types NYI */ + } + } + break; + + default: + FFI_ASSERT(0); + } + + argp += z; + p_argv++; + + } + + return; +} + + +/* Fill in a closure to refer to the specified fun and user_data. */ +/* cif specifies the argument and result types for fun. */ +/* the cif must already be prep'ed */ + +/* The layout of a function descriptor. A C function pointer really */ +/* points to one of these. */ +typedef struct ia64_fd_struct { + void *code_pointer; + void *gp; +} ia64_fd; + +ffi_status +ffi_prep_closure (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data) +{ + struct ffi_ia64_trampoline_struct *tramp = + (struct ffi_ia64_trampoline_struct *) (closure -> tramp); + ia64_fd *fd = (ia64_fd *)(void *)ffi_closure_UNIX; + + FFI_ASSERT (cif->abi == FFI_UNIX); + + tramp -> code_pointer = fd -> code_pointer; + tramp -> real_gp = fd -> gp; + tramp -> fake_gp = closure; + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + + diff --git a/libffi/src/ia64/ia64_flags.h b/libffi/src/ia64/ia64_flags.h new file mode 100644 index 00000000000..23dbd3e0237 --- /dev/null +++ b/libffi/src/ia64/ia64_flags.h @@ -0,0 +1,62 @@ +/* ----------------------------------------------------------------------- + ia64_flags.h - Copyright (c) 2000 Hewlett Packard Company + + IA64/unix Foreign Function Interface + + Original author: Hans Boehm, HP Labs + + 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 CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + + +/* Homogeneous Floating Point Aggregates (HFAs) which are returned */ +/* in FP registers. The least significant bits specify the size in */ +/* words. */ +#define FFI_IS_FLOAT_FP_AGGREGATE 0x1000 +#define FFI_IS_DOUBLE_FP_AGGREGATE 0x0800 +#define FLOAT_FP_AGGREGATE_BIT 12 +#define DOUBLE_FP_AGGREGATE_BIT 11 + +/* Small structures containing N words. If N=1, they are returned */ +/* as though they were integers. */ +#define FFI_IS_SMALL_STRUCT2 0x40 /* Struct > 8, <=16 bytes */ +#define FFI_IS_SMALL_STRUCT3 0x41 /* Struct > 16 <= 24 bytes */ +#define FFI_IS_SMALL_STRUCT4 0x42 /* Struct > 24, <=32 bytes */ + +/* Flag values identifying particularly simple cases, which are */ +/* handled specially. We treat functions as simple if they take all */ +/* arguments can be passed as 32 or 64 bit integer quantities, there is */ +/* either no return value or it can be treated as a 64bit integer, and */ +/* if there are at most 2 arguments. */ +/* This is OR'ed with the normal flag values. */ +#define FFI_SIMPLE_V 0x10000 /* () -> X */ +#define FFI_SIMPLE_I 0x20000 /* (int) -> X */ +#define FFI_SIMPLE_L 0x30000 /* (long) -> X */ +#define FFI_SIMPLE_II 0x40000 /* (int,int) -> X */ +#define FFI_SIMPLE_IL 0x50000 /* (int,long) -> X */ +#define FFI_SIMPLE_LI 0x60000 /* (long,int) -> X */ +#define FFI_SIMPLE_LL 0x70000 /* (long,long) -> X */ + +/* Mask for all of the FFI_SIMPLE bits: */ +#define FFI_SIMPLE 0xf0000 + +/* An easy way to build FFI_SIMPLE flags from FFI_SIMPLE_V: */ +#define FFI_ADD_LONG_ARG(flag) (((flag) << 1) | 0x10000) +#define FFI_ADD_INT_ARG(flag) ((flag) << 1) diff --git a/libffi/src/ia64/unix.S b/libffi/src/ia64/unix.S new file mode 100644 index 00000000000..fdaf8be28ad --- /dev/null +++ b/libffi/src/ia64/unix.S @@ -0,0 +1,301 @@ +/* ----------------------------------------------------------------------- + unix.S - Copyright (c) 1998 Cygnus Solutions + Copyright (c) 2000 Hewlett Packard Company + + IA64/unix Foreign Function Interface + + Primary author: Hans Boehm, HP Labs + + Loosely modeled on Cygnus code for other platforms. + + 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 CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include <ffi.h> +#include "ia64_flags.h" + +/* parameters: */ +#define callback in0 +#define ecifp in1 +#define bytes in2 +#define flags in3 +#define raddr in4 +#define fn in5 + +#define FLOAT_SZ 8 /* in-memory size of fp operands */ + +.text + .align 16 + .global ffi_call_unix# + .proc ffi_call_unix# +ffi_call_unix: + alloc loc0=ar.pfs,6,5,8,0 + mov loc1=b0; + sub sp=sp,bytes + mov loc4=r1 /* Save gp */ + ld8 r8=[callback],8 /* code address of callback */ + ;; + mov out0=sp + mov out1=ecifp + mov out2=bytes + ld8 r1=[callback] /* Set up gp for callback. Unnecessary? */ + mov b6=r8 + ;; + br.call.sptk.many b0 = b6 /* call ffi_prep_args */ + cmp.eq p6,p0=0,r8 /* r8 nonzero ==> need fp regs */ + ;; +(p6) add loc2=32+8*FLOAT_SZ,sp +(p6) br.cond.dptk.many fp_done + ;; /* Quiets warning; needed? */ + add loc2=32,sp + add loc3=32+FLOAT_SZ,sp + ;; + ldfd f8=[loc2],2*FLOAT_SZ + ldfd f9=[loc3],2*FLOAT_SZ + ;; + ldfd f10=[loc2],2*FLOAT_SZ + ldfd f11=[loc3],2*FLOAT_SZ + ;; + ldfd f12=[loc2],2*FLOAT_SZ + ldfd f13=[loc3],2*FLOAT_SZ + ;; + ldfd f14=[loc2],2*FLOAT_SZ + ldfd f15=[loc3] +fp_done: + add r9=16,sp /* Pointer to r8_contents */ + /* loc2 points at first integer register value. */ + add loc3=8,loc2 + ;; + ld8 r8=[r9] /* Just in case we return large struct */ + ld8 out0=[loc2],16 + ld8 out1=[loc3],16 + ;; + ld8 out2=[loc2],16 + ld8 out3=[loc3],16 + ;; + ld8 out4=[loc2],16 + ld8 out5=[loc3],16 + ;; + ld8 out6=[loc2],16 + ld8 out7=[loc3] + /* loc2 points at first stack parameter. Set sp to 16 bytes */ + /* below that. */ + add sp=-16,loc2 + + ld8 r8=[fn],8 + ;; + ld8 r1=[fn] /* Set up gp */ + mov b6=r8;; + br.call.sptk.many b0 = b6 /* call ffi_prep_args */ + + /* Handle return value. */ + cmp.eq p6,p0=0,raddr + cmp.eq p7,p0=FFI_TYPE_INT,flags + cmp.eq p10,p0=FFI_IS_SMALL_STRUCT2,flags + cmp.eq p11,p0=FFI_IS_SMALL_STRUCT3,flags + cmp.eq p12,p0=FFI_IS_SMALL_STRUCT4,flags + ;; +(p6) br.cond.dpnt.few done /* Dont copy ret values if raddr = 0 */ +(p7) br.cond.dptk.few copy1 +(p10) br.cond.dpnt.few copy2 +(p11) br.cond.dpnt.few copy3 +(p12) br.cond.dpnt.few copy4 + cmp.eq p8,p0=FFI_TYPE_FLOAT,flags + cmp.eq p9,p0=FFI_TYPE_DOUBLE,flags + tbit.nz p6,p0=flags,FLOAT_FP_AGGREGATE_BIT + tbit.nz p7,p0=flags,DOUBLE_FP_AGGREGATE_BIT + ;; +(p8) stfs [raddr]=f8 +(p9) stfd [raddr]=f8 + ;; +(p6) br.cond.dpnt.few handle_float_hfa +(p7) br.cond.dpnt.few handle_double_hfa + br done + +copy4: + add loc3=24,raddr + ;; + st8 [loc3]=r11 +copy3: + add loc3=16,raddr + ;; + st8 [loc3]=r10 +copy2: + add loc3=8,raddr + ;; + st8 [loc3]=r9 +copy1: + st8 [raddr]=r8 + /* In the big struct case, raddr was passed as an argument. */ + /* In the void case there was nothing to do. */ + +done: + mov r1=loc4 /* Restore gp */ + mov ar.pfs = loc0 + mov b0 = loc1 + br.ret.sptk.many b0 + +handle_double_hfa: + /* Homogeneous floating point array of doubles is returned in */ + /* registers f8-f15. Save one at a time to return area. */ + and flags=0xf,flags /* Retrieve size */ + ;; + cmp.eq p6,p0=2,flags + cmp.eq p7,p0=3,flags + cmp.eq p8,p0=4,flags + cmp.eq p9,p0=5,flags + cmp.eq p10,p0=6,flags + cmp.eq p11,p0=7,flags + cmp.eq p12,p0=8,flags + ;; +(p6) br.cond.dptk.few dhfa2 +(p7) br.cond.dptk.few dhfa3 +(p8) br.cond.dptk.few dhfa4 +(p9) br.cond.dptk.few dhfa5 +(p10) br.cond.dptk.few dhfa6 +(p11) br.cond.dptk.few dhfa7 +dhfa8: add loc3=7*8,raddr + ;; + stfd [loc3]=f15 +dhfa7: add loc3=6*8,raddr + ;; + stfd [loc3]=f14 +dhfa6: add loc3=5*8,raddr + ;; + stfd [loc3]=f13 +dhfa5: add loc3=4*8,raddr + ;; + stfd [loc3]=f12 +dhfa4: add loc3=3*8,raddr + ;; + stfd [loc3]=f11 +dhfa3: add loc3=2*8,raddr + ;; + stfd [loc3]=f10 +dhfa2: add loc3=1*8,raddr + ;; + stfd [loc3]=f9 + stfd [raddr]=f8 + br done + +handle_float_hfa: + /* Homogeneous floating point array of floats is returned in */ + /* registers f8-f15. Save one at a time to return area. */ + and flags=0xf,flags /* Retrieve size */ + ;; + cmp.eq p6,p0=2,flags + cmp.eq p7,p0=3,flags + cmp.eq p8,p0=4,flags + cmp.eq p9,p0=5,flags + cmp.eq p10,p0=6,flags + cmp.eq p11,p0=7,flags + cmp.eq p12,p0=8,flags + ;; +(p6) br.cond.dptk.few shfa2 +(p7) br.cond.dptk.few shfa3 +(p8) br.cond.dptk.few shfa4 +(p9) br.cond.dptk.few shfa5 +(p10) br.cond.dptk.few shfa6 +(p11) br.cond.dptk.few shfa7 +shfa8: add loc3=7*4,raddr + ;; + stfd [loc3]=f15 +shfa7: add loc3=6*4,raddr + ;; + stfd [loc3]=f14 +shfa6: add loc3=5*4,raddr + ;; + stfd [loc3]=f13 +shfa5: add loc3=4*4,raddr + ;; + stfd [loc3]=f12 +shfa4: add loc3=3*4,raddr + ;; + stfd [loc3]=f11 +shfa3: add loc3=2*4,raddr + ;; + stfd [loc3]=f10 +shfa2: add loc3=1*4,raddr + ;; + stfd [loc3]=f9 + stfd [raddr]=f8 + br done + + .endp ffi_call_unix + + +.text + .align 16 + .global ffi_closure_UNIX + .proc ffi_closure_UNIX +ffi_closure_UNIX: + alloc loc0=ar.pfs,8,2,2,0 + mov loc1=b0 + /* Retrieve closure pointer and real gp. */ + mov out0=gp + add gp=16,gp + ;; + ld8 gp=[gp] + /* Reserve a structia64_args on the stack such that arguments */ + /* past the first 8 are automatically placed in the right */ + /* slot. Note that when we start the sp points at 2 8-byte */ + /* scratch words, followed by the extra arguments. */ +# define BASIC_ARGS_SZ (8*FLOAT_SZ+8*8+2*8) +# define FIRST_FP_OFFSET (4*8) + add r14=-(BASIC_ARGS_SZ-FIRST_FP_OFFSET),sp + add r15=-(BASIC_ARGS_SZ-FIRST_FP_OFFSET-FLOAT_SZ),sp + add sp=-BASIC_ARGS_SZ,sp + /* r14 points to fp_regs[0], r15 points to fp_regs[1] */ + ;; + stfd [r14]=f8,2*FLOAT_SZ + stfd [r15]=f9,2*FLOAT_SZ + ;; + stfd [r14]=f10,2*FLOAT_SZ + stfd [r15]=f11,2*FLOAT_SZ + ;; + stfd [r14]=f12,2*FLOAT_SZ + stfd [r15]=f13,2*FLOAT_SZ + ;; + stfd [r14]=f14,FLOAT_SZ+8 + stfd [r15]=f15,2*8 + ;; + /* r14 points to first parameter register area, r15 to second. */ + st8 [r14]=in0,2*8 + st8 [r15]=in1,2*8 + ;; + st8 [r14]=in2,2*8 + st8 [r15]=in3,2*8 + ;; + st8 [r14]=in4,2*8 + st8 [r15]=in5,2*8 + ;; + st8 [r14]=in6,2*8 + st8 [r15]=in7,2*8 + /* Call ffi_closure_UNIX_inner */ + mov out1=sp + br.call.sptk.many b0=ffi_closure_UNIX_inner + ;; + mov b0=loc1 + mov ar.pfs=loc0 + br.ret.sptk.many b0 + .endp ffi_closure_UNIX + + diff --git a/libffi/src/java_raw_api.c b/libffi/src/java_raw_api.c new file mode 100644 index 00000000000..5f85582cfde --- /dev/null +++ b/libffi/src/java_raw_api.c @@ -0,0 +1,271 @@ +/* ----------------------------------------------------------------------- + java_raw_api.c - Copyright (c) 1999 Cygnus Solutions + + Cloned from raw_api.c + + Raw_api.c author: Kresten Krab Thorup <krab@gnu.org> + Java_raw_api.c author: Hans-J. Boehm <hboehm@hpl.hp.com> + + $Id $ + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + 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 CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* This defines a Java- and 64-bit specific variant of the raw API. */ +/* It assumes that "raw" argument blocks look like Java stacks on a */ +/* 64-bit machine. Arguments that can be stored in a single stack */ +/* stack slots (longs, doubles) occupy 128 bits, but only the first */ +/* 64 bits are actually used. */ + +#include <ffi.h> +#include <ffi_common.h> + +#if !defined(NO_JAVA_RAW_API) && !defined(FFI_NO_RAW_API) + +size_t +ffi_java_raw_size (ffi_cif *cif) +{ + size_t result = 0; + int i; + + ffi_type **at = cif->arg_types; + + for (i = cif->nargs-1; i >= 0; i--, at++) + { + switch((*at) -> type) { + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + result += 2 * SIZEOF_ARG; + break; + case FFI_TYPE_STRUCT: + /* No structure parameters in Java. */ + abort(); + default: + result += SIZEOF_ARG; + } + } + + return result; +} + + +void +ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + +#if WORDS_BIGENDIAN + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 1); + break; + + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 2); + break; + +#if SIZEOF_ARG >= 4 + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + *args = (void*) ((char*)(raw++) + SIZEOF_ARG - 4); + break; +#endif + +#if SIZEOF_ARG == 8 + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + *args = (void *)raw; + raw += 2; + break; +#endif + + case FFI_TYPE_POINTER: + *args = (void*) &(raw++)->ptr; + break; + + default: + *args = raw; + raw += ALIGN ((*tp)->size, SIZEOF_ARG) / SIZEOF_ARG; + } + } + +#else /* WORDS_BIGENDIAN */ + +#if !PDP + + /* then assume little endian */ + for (i = 0; i < cif->nargs; i++, tp++, args++) + { +#if SIZEOF_ARG == 8 + switch((*tp)->type) { + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + *args = (void*) raw; + raw += 2; + break; + default: + *args = (void*) raw++; + } +#else /* SIZEOF_ARG != 8 */ + *args = (void*) raw; + raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); +#endif /* SIZEOF_ARG == 8 */ + } + +#else +#error "pdp endian not supported" +#endif /* ! PDP */ + +#endif /* WORDS_BIGENDIAN */ +} + +void +ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: + (raw++)->uint = *(UINT8*) (*args); + break; + + case FFI_TYPE_SINT8: + (raw++)->sint = *(SINT8*) (*args); + break; + + case FFI_TYPE_UINT16: + (raw++)->uint = *(UINT16*) (*args); + break; + + case FFI_TYPE_SINT16: + (raw++)->sint = *(SINT16*) (*args); + break; + +#if SIZEOF_ARG >= 4 + case FFI_TYPE_UINT32: + (raw++)->uint = *(UINT32*) (*args); + break; + + case FFI_TYPE_SINT32: + (raw++)->sint = *(SINT32*) (*args); + break; +#endif + case FFI_TYPE_FLOAT: + (raw++)->flt = *(FLOAT32*) (*args); + break; + +#if SIZEOF_ARG == 8 + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + raw->uint = *(UINT64*) (*args); + raw += 2; + break; +#endif + + case FFI_TYPE_POINTER: + (raw++)->ptr = **(void***) args; + break; + + default: +#if SIZEOF_ARG == 8 + FFI_ASSERT(FALSE); /* Should have covered all cases */ +#else + memcpy ((void*) raw->data, (void*)*args, (*tp)->size); + raw += ALIGN ((*tp)->size, SIZEOF_ARG) / SIZEOF_ARG; +#endif + } + } +} + +#if !FFI_NATIVE_RAW_API + + +/* This is a generic definition of ffi_raw_call, to be used if the + * native system does not provide a machine-specific implementation. + * Having this, allows code to be written for the raw API, without + * the need for system-specific code to handle input in that format; + * these following couple of functions will handle the translation forth + * and back automatically. */ + +void ffi_java_raw_call (/*@dependent@*/ ffi_cif *cif, + void (*fn)(), + /*@out@*/ void *rvalue, + /*@dependent@*/ ffi_raw *raw) +{ + void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); + ffi_java_raw_to_ptrarray (cif, raw, avalue); + ffi_call (cif, fn, rvalue, avalue); +} + +#if FFI_CLOSURES /* base system provides closures */ + +static void +ffi_java_translate_args (ffi_cif *cif, void *rvalue, + void **avalue, void *user_data) +{ + ffi_raw *raw = (ffi_raw*)alloca (ffi_java_raw_size (cif)); + ffi_raw_closure *cl = (ffi_raw_closure*)user_data; + + ffi_java_ptrarray_to_raw (cif, avalue, raw); + (*cl->fun) (cif, rvalue, raw, cl->user_data); +} + +/* Again, here is the generic version of ffi_prep_raw_closure, which + * will install an intermediate "hub" for translation of arguments from + * the pointer-array format, to the raw format */ + +ffi_status +ffi_prep_java_raw_closure (ffi_raw_closure* cl, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data) +{ + ffi_status status; + + status = ffi_prep_closure ((ffi_closure*) cl, + cif, + &ffi_java_translate_args, + (void*)cl); + if (status == FFI_OK) + { + cl->fun = fun; + cl->user_data = user_data; + } + + return status; +} + +#endif /* FFI_CLOSURES */ +#endif /* !FFI_NATIVE_RAW_API */ +#endif /* !FFI_NO_RAW_API */ diff --git a/libffi/src/raw_api.c b/libffi/src/raw_api.c index 55bf9ec4437..45cb0043c4d 100644 --- a/libffi/src/raw_api.c +++ b/libffi/src/raw_api.c @@ -202,13 +202,13 @@ void ffi_raw_call (/*@dependent@*/ ffi_cif *cif, #if FFI_CLOSURES /* base system provides closures */ static void -ffi_translate_args (ffi_cif *cif, void *ravlue, +ffi_translate_args (ffi_cif *cif, void *rvalue, void **avalue, void *user_data) { ffi_raw *raw = (ffi_raw*)alloca (ffi_raw_size (cif)); - ffi_ptrarray_to_raw (cif, avalue, raw); - ffi_raw_closure *cl = (ffi_raw_closure*)user_data; + + ffi_ptrarray_to_raw (cif, avalue, raw); (*cl->fun) (cif, rvalue, raw, cl->user_data); } @@ -226,7 +226,7 @@ ffi_prep_raw_closure (ffi_raw_closure* cl, status = ffi_prep_closure ((ffi_closure*) cl, cif, - &ffi_closure_translate, + &ffi_translate_args, (void*)cl); if (status == FFI_OK) { |