aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Ornstein <andrea.ornstein@st.com>2009-04-20 16:02:21 +0000
committerAndrea Ornstein <andrea.ornstein@st.com>2009-04-20 16:02:21 +0000
commit1fcb61ac43b3d083713780dc1ce1d4b14bd45b20 (patch)
treeeef9ba914cec89f8742be0d72e039750e7d1fe61
parente916c2f6d80dbd955333bed4b12639fcc1ebc52e (diff)
merge from trunk revisions 127002-132392, 8/N
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/st/cli-be@146439 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libffi/ChangeLog324
-rw-r--r--libffi/Makefile.am5
-rw-r--r--libffi/Makefile.in112
-rwxr-xr-xlibffi/configure68
-rw-r--r--libffi/configure.ac18
-rw-r--r--libffi/fficonfig.h.in7
-rw-r--r--libffi/include/Makefile.in6
-rw-r--r--libffi/include/ffi.h.in54
-rw-r--r--libffi/include/ffi_common.h3
-rw-r--r--libffi/src/arm/ffi.c63
-rw-r--r--libffi/src/arm/sysv.S38
-rw-r--r--libffi/src/closures.c3
-rw-r--r--libffi/src/java_raw_api.c48
-rw-r--r--libffi/src/mips/ffi.c375
-rw-r--r--libffi/src/mips/ffitarget.h53
-rw-r--r--libffi/src/mips/n32.S261
-rw-r--r--libffi/src/mips/o32.S39
-rw-r--r--libffi/src/powerpc/ffi.c206
-rw-r--r--libffi/src/powerpc/ffitarget.h16
-rw-r--r--libffi/src/powerpc/linux64.S1
-rw-r--r--libffi/src/powerpc/ppc_closure.S14
-rw-r--r--libffi/src/powerpc/sysv.S10
-rw-r--r--libffi/src/x86/darwin.S149
-rw-r--r--libffi/src/x86/ffi.c16
-rw-r--r--libffi/src/x86/ffitarget.h4
-rw-r--r--libffi/src/x86/sysv.S96
-rw-r--r--libffi/testsuite/Makefile.in6
-rw-r--r--libffi/testsuite/libffi.call/call.exp1
-rw-r--r--libffi/testsuite/libffi.call/closure_fn0.c22
-rw-r--r--libffi/testsuite/libffi.call/closure_fn1.c16
-rw-r--r--libffi/testsuite/libffi.call/closure_fn2.c14
-rw-r--r--libffi/testsuite/libffi.call/closure_fn3.c8
-rw-r--r--libffi/testsuite/libffi.call/closure_fn4.c4
-rw-r--r--libffi/testsuite/libffi.call/closure_fn5.c6
-rw-r--r--libffi/testsuite/libffi.call/closure_fn6.c10
-rw-r--r--libffi/testsuite/libffi.call/cls_12byte.c8
-rw-r--r--libffi/testsuite/libffi.call/cls_16byte.c6
-rw-r--r--libffi/testsuite/libffi.call/cls_18byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_19byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_1_1byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_20byte.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_20byte1.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_24byte.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_2byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_3_1byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_3byte1.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_3byte2.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_4_1byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_4byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_5_1_byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_5byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_64byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_6_1_byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_6byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_7_1_byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_7byte.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_8byte.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_9byte1.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_9byte2.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_align_double.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_align_float.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_align_longdouble.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_align_pointer.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_align_sint16.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_align_sint32.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_align_sint64.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_align_uint16.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_align_uint32.c4
-rw-r--r--libffi/testsuite/libffi.call/cls_align_uint64.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_double.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_float.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_multi_schar.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_multi_sshort.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_multi_sshortchar.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_multi_uchar.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_multi_ushort.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_multi_ushortchar.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_schar.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_sint.c6
-rw-r--r--libffi/testsuite/libffi.call/cls_sshort.c6
-rw-r--r--libffi/testsuite/libffi.call/cls_uchar.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_uint.c6
-rw-r--r--libffi/testsuite/libffi.call/cls_ulonglong.c2
-rw-r--r--libffi/testsuite/libffi.call/cls_ushort.c2
-rw-r--r--libffi/testsuite/libffi.call/ffitest.h11
-rw-r--r--libffi/testsuite/libffi.call/nested_struct.c6
-rw-r--r--libffi/testsuite/libffi.call/nested_struct1.c6
-rw-r--r--libffi/testsuite/libffi.call/nested_struct10.c4
-rw-r--r--libffi/testsuite/libffi.call/nested_struct2.c4
-rw-r--r--libffi/testsuite/libffi.call/nested_struct3.c2
-rw-r--r--libffi/testsuite/libffi.call/nested_struct4.c2
-rw-r--r--libffi/testsuite/libffi.call/nested_struct5.c2
-rw-r--r--libffi/testsuite/libffi.call/nested_struct6.c4
-rw-r--r--libffi/testsuite/libffi.call/nested_struct7.c2
-rw-r--r--libffi/testsuite/libffi.call/nested_struct8.c2
-rw-r--r--libffi/testsuite/libffi.call/nested_struct9.c4
-rw-r--r--libffi/testsuite/libffi.call/problem1.c2
-rw-r--r--libffi/testsuite/libffi.call/return_dbl1.c2
-rw-r--r--libffi/testsuite/libffi.call/return_dbl2.c2
-rw-r--r--libffi/testsuite/libffi.call/return_fl3.c2
-rw-r--r--libffi/testsuite/libffi.call/return_ldl.c34
-rw-r--r--libffi/testsuite/libffi.call/return_ll1.c4
-rw-r--r--libffi/testsuite/libffi.call/return_sc.c2
-rw-r--r--libffi/testsuite/libffi.call/return_sl.c38
-rw-r--r--libffi/testsuite/libffi.call/return_ul.c4
-rw-r--r--libffi/testsuite/libffi.special/unwindtest.cc2
-rw-r--r--libffi/testsuite/libffi.special/unwindtest_ffi_call.cc2
107 files changed, 1797 insertions, 562 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 9c3249e5822..63e99be4fb3 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,327 @@
+2008-02-12 Bjoern Koenig <bkoenig@alpha-tierchen.de>
+ Andreas Tobler <a.tobler@schweiz.org>
+
+ * configure.ac: Add amd64-*-freebsd* target.
+ * configure: Regenerate.
+
+2008-01-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR libffi/34612
+ * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when
+ returning struct.
+
+ * testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer"
+ tests.
+
+2008-01-24 David Edelsohn <edelsohn@gnu.org>
+
+ * configure: Regenerate.
+
+2008-01-06 Andreas Tobler <a.tobler@schweiz.org>
+
+ * src/x86/ffi.c (ffi_prep_cif_machdep): Fix thinko.
+
+2008-01-05 Andreas Tobler <a.tobler@schweiz.org>
+
+ PR testsuite/32843
+ * src/x86/ffi.c (ffi_prep_cif_machdep): Add code for
+ signed/unsigned int8/16 for X86_DARWIN.
+ Updated copyright info.
+ Handle one and two byte structs with special cif->flags.
+ * src/x86/ffitarget.h: Add special types for one and two byte structs.
+ Updated copyright info.
+ * src/x86/darwin.S (ffi_call_SYSV): Rewrite to use a jump table like
+ sysv.S
+ Remove code to pop args from the stack after call.
+ Special-case signed/unsigned for int8/16, one and two byte structs.
+ (ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8,
+ FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32,
+ FFI_TYPE_SINT32.
+ Updated copyright info.
+
+2007-12-08 David Daney <ddaney@avtrex.com>
+
+ * src/mips/n32.S (ffi_call_N32): Replace dadd with ADDU, dsub with
+ SUBU, add with ADDU and use smaller code sequences.
+
+2007-12-07 David Daney <ddaney@avtrex.com>
+
+ * src/mips/ffi.c (ffi_prep_cif_machdep): Handle long double return
+ type.
+
+2007-12-06 David Daney <ddaney@avtrex.com>
+
+ * include/ffi.h.in (FFI_SIZEOF_JAVA_RAW): Define if not already
+ defined.
+ (ffi_java_raw): New typedef.
+ (ffi_java_raw_call, ffi_java_ptrarray_to_raw,
+ ffi_java_raw_to_ptrarray): Change parameter types from ffi_raw to
+ ffi_java_raw.
+ (ffi_java_raw_closure) : Same.
+ (ffi_prep_java_raw_closure, ffi_prep_java_raw_closure_loc): Change
+ parameter types.
+ * src/java_raw_api.c (ffi_java_raw_size): Replace FFI_SIZEOF_ARG with
+ FFI_SIZEOF_JAVA_RAW.
+ (ffi_java_raw_to_ptrarray): Change type of raw to ffi_java_raw.
+ Replace FFI_SIZEOF_ARG with FFI_SIZEOF_JAVA_RAW. Use
+ sizeof(ffi_java_raw) for alignment calculations.
+ (ffi_java_ptrarray_to_raw): Same.
+ (ffi_java_rvalue_to_raw): Add special handling for FFI_TYPE_POINTER
+ if FFI_SIZEOF_JAVA_RAW == 4.
+ (ffi_java_raw_to_rvalue): Same.
+ (ffi_java_raw_call): Change type of raw to ffi_java_raw.
+ (ffi_java_translate_args): Same.
+ (ffi_prep_java_raw_closure_loc, ffi_prep_java_raw_closure): Change
+ parameter types.
+ * src/mips/ffitarget.h (FFI_SIZEOF_JAVA_RAW): Define for N32 ABI.
+
+2007-12-06 David Daney <ddaney@avtrex.com>
+
+ * src/mips/n32.S (ffi_closure_N32): Use 64-bit add instruction on
+ pointer values.
+
+2007-12-01 Andreas Tobler <a.tobler@schweiz.org>
+
+ PR libffi/31937
+ * src/powerpc/ffitarget.h: Introduce new ABI FFI_LINUX_SOFT_FLOAT.
+ Add local FFI_TYPE_UINT128 to handle soft-float long-double-128.
+ * src/powerpc/ffi.c: Distinguish between __NO_FPRS__ and not and
+ set the NUM_FPR_ARG_REGISTERS according to.
+ Add support for potential soft-float support under hard-float
+ architecture.
+ (ffi_prep_args_SYSV): Set NUM_FPR_ARG_REGISTERS to 0 in case of
+ FFI_LINUX_SOFT_FLOAT, handle float, doubles and long-doubles according
+ to the FFI_LINUX_SOFT_FLOAT ABI.
+ (ffi_prep_cif_machdep): Likewise.
+ (ffi_closure_helper_SYSV): Likewise.
+ * src/powerpc/ppc_closure.S: Make sure not to store float/double
+ on archs where __NO_FPRS__ is true.
+ Add FFI_TYPE_UINT128 support.
+ * src/powerpc/sysv.S: Add support for soft-float long-double-128.
+ Adjust copyright notice.
+
+2007-11-25 Andreas Tobler <a.tobler@schweiz.org>
+
+ * src/closures.c: Move defintion of MAYBE_UNUSED from here to ...
+ * include/ffi_common.h: ... here.
+ Update copyright.
+
+2007-11-17 Andreas Tobler <a.tobler@schweiz.org>
+
+ * src/powerpc/sysv.S: Load correct cr to compare if we have long double.
+ * src/powerpc/linux64.S: Likewise.
+ * src/powerpc/ffi.c: Add a comment to show which part goes into cr6.
+ * testsuite/libffi.call/return_ldl.c: New test.
+
+2007-09-04 <aph@redhat.com>
+
+ * src/arm/sysv.S (UNWIND): New.
+ (Whole file): Conditionally compile unwinder directives.
+ * src/arm/sysv.S: Add unwinder directives.
+
+ * src/arm/ffi.c (ffi_prep_args): Align structs by at least 4 bytes.
+ Only treat r0 as a struct address if we're actually returning a
+ struct by address.
+ Only copy the bytes that are actually within a struct.
+ (ffi_prep_cif_machdep): A Composite Type not larger than 4 bytes
+ is returned in r0, not passed by address.
+ (ffi_call): Allocate a word-sized temporary for the case where
+ a composite is returned in r0.
+ (ffi_prep_incoming_args_SYSV): Align as necessary.
+
+2007-08-05 Steven Newbury <s_j_newbury@yahoo.co.uk>
+
+ * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Use __clear_cache instead of
+ directly using the sys_cacheflush syscall.
+
+2007-07-27 Andrew Haley <aph@redhat.com>
+
+ * src/arm/sysv.S (ffi_closure_SYSV): Add soft-float.
+
+2007-09-03 Maciej W. Rozycki <macro@linux-mips.org>
+
+ * Makefile.am: Unify MIPS_IRIX and MIPS_LINUX into MIPS.
+ * configure.ac: Likewise.
+ * Makefile.in: Regenerate.
+ * include/Makefile.in: Likewise.
+ * testsuite/Makefile.in: Likewise.
+ * configure: Likewise.
+
+2007-08-24 David Daney <ddaney@avtrex.com>
+
+ * testsuite/libffi.call/return_sl.c: New test.
+
+2007-08-10 David Daney <ddaney@avtrex.com>
+
+ * testsuite/libffi.call/cls_multi_ushort.c,
+ testsuite/libffi.call/cls_align_uint16.c,
+ testsuite/libffi.call/nested_struct1.c,
+ testsuite/libffi.call/nested_struct3.c,
+ testsuite/libffi.call/cls_7_1_byte.c,
+ testsuite/libffi.call/nested_struct5.c,
+ testsuite/libffi.call/cls_double.c,
+ testsuite/libffi.call/nested_struct7.c,
+ testsuite/libffi.call/cls_sint.c,
+ testsuite/libffi.call/nested_struct9.c,
+ testsuite/libffi.call/cls_20byte1.c,
+ testsuite/libffi.call/cls_multi_sshortchar.c,
+ testsuite/libffi.call/cls_align_sint64.c,
+ testsuite/libffi.call/cls_3byte2.c,
+ testsuite/libffi.call/cls_multi_schar.c,
+ testsuite/libffi.call/cls_multi_uchar.c,
+ testsuite/libffi.call/cls_19byte.c,
+ testsuite/libffi.call/cls_9byte1.c,
+ testsuite/libffi.call/cls_align_float.c,
+ testsuite/libffi.call/closure_fn1.c,
+ testsuite/libffi.call/problem1.c,
+ testsuite/libffi.call/closure_fn3.c,
+ testsuite/libffi.call/cls_sshort.c,
+ testsuite/libffi.call/closure_fn5.c,
+ testsuite/libffi.call/cls_align_double.c,
+ testsuite/libffi.call/nested_struct.c,
+ testsuite/libffi.call/cls_2byte.c,
+ testsuite/libffi.call/nested_struct10.c,
+ testsuite/libffi.call/cls_4byte.c,
+ testsuite/libffi.call/cls_6byte.c,
+ testsuite/libffi.call/cls_8byte.c,
+ testsuite/libffi.call/cls_multi_sshort.c,
+ testsuite/libffi.call/cls_align_sint16.c,
+ testsuite/libffi.call/cls_align_uint32.c,
+ testsuite/libffi.call/cls_20byte.c,
+ testsuite/libffi.call/cls_float.c,
+ testsuite/libffi.call/nested_struct2.c,
+ testsuite/libffi.call/cls_5_1_byte.c,
+ testsuite/libffi.call/nested_struct4.c,
+ testsuite/libffi.call/cls_24byte.c,
+ testsuite/libffi.call/nested_struct6.c,
+ testsuite/libffi.call/cls_64byte.c,
+ testsuite/libffi.call/nested_struct8.c,
+ testsuite/libffi.call/cls_uint.c,
+ testsuite/libffi.call/cls_multi_ushortchar.c,
+ testsuite/libffi.call/cls_schar.c,
+ testsuite/libffi.call/cls_uchar.c,
+ testsuite/libffi.call/cls_align_uint64.c,
+ testsuite/libffi.call/cls_ulonglong.c,
+ testsuite/libffi.call/cls_align_longdouble.c,
+ testsuite/libffi.call/cls_1_1byte.c,
+ testsuite/libffi.call/cls_12byte.c,
+ testsuite/libffi.call/cls_3_1byte.c,
+ testsuite/libffi.call/cls_3byte1.c,
+ testsuite/libffi.call/cls_4_1byte.c,
+ testsuite/libffi.call/cls_6_1_byte.c,
+ testsuite/libffi.call/cls_16byte.c,
+ testsuite/libffi.call/cls_18byte.c,
+ testsuite/libffi.call/closure_fn0.c,
+ testsuite/libffi.call/cls_9byte2.c,
+ testsuite/libffi.call/closure_fn2.c,
+ testsuite/libffi.call/closure_fn4.c,
+ testsuite/libffi.call/cls_ushort.c,
+ testsuite/libffi.call/closure_fn6.c,
+ testsuite/libffi.call/cls_5byte.c,
+ testsuite/libffi.call/cls_align_pointer.c,
+ testsuite/libffi.call/cls_7byte.c,
+ testsuite/libffi.call/cls_align_sint32.c,
+ testsuite/libffi.special/unwindtest_ffi_call.cc,
+ testsuite/libffi.special/unwindtest.cc: Remove xfail for mips64*-*-*.
+
+2007-08-10 David Daney <ddaney@avtrex.com>
+
+ PR libffi/28313
+ * configure.ac: Don't treat mips64 as a special case.
+ * Makefile.am (nodist_libffi_la_SOURCES): Add n32.S.
+ * configure: Regenerate
+ * Makefile.in: Ditto.
+ * fficonfig.h.in: Ditto.
+ * src/mips/ffitarget.h (REG_L, REG_S, SUBU, ADDU, SRL, LI): Indent.
+ (LA, EH_FRAME_ALIGN, FDE_ADDR_BYTES): New preprocessor macros.
+ (FFI_DEFAULT_ABI): Set for n64 case.
+ (FFI_CLOSURES, FFI_TRAMPOLINE_SIZE): Define for n32 and n64 cases.
+ * src/mips/n32.S (ffi_call_N32): Add debug macros and labels for FDE.
+ (ffi_closure_N32): New function.
+ (.eh_frame): New section
+ * src/mips/o32.S: Clean up comments.
+ (ffi_closure_O32): Pass ffi_closure parameter in $12.
+ * src/mips/ffi.c: Use FFI_MIPS_N32 instead of
+ _MIPS_SIM == _ABIN32 throughout.
+ (FFI_MIPS_STOP_HERE): New, use in place of
+ ffi_stop_here.
+ (ffi_prep_args): Use unsigned long to hold pointer values. Rewrite
+ to support n32/n64 ABIs.
+ (calc_n32_struct_flags): Rewrite.
+ (calc_n32_return_struct_flags): Remove unused variable. Reverse
+ position of flag bits.
+ (ffi_prep_cif_machdep): Rewrite n32 portion.
+ (ffi_call): Enable for n64. Add special handling for small structure
+ return values.
+ (ffi_prep_closure_loc): Add n32 and n64 support.
+ (ffi_closure_mips_inner_O32): Add cast to silence warning.
+ (copy_struct_N32, ffi_closure_mips_inner_N32): New functions.
+
+2007-08-08 David Daney <ddaney@avtrex.com>
+
+ * testsuite/libffi.call/ffitest.h (ffi_type_mylong): Remove definition.
+ * testsuite/libffi.call/cls_align_uint16.c (main): Use correct type
+ specifiers.
+ * testsuite/libffi.call/nested_struct1.c (main): Ditto.
+ * testsuite/libffi.call/cls_sint.c (main): Ditto.
+ * testsuite/libffi.call/nested_struct9.c (main): Ditto.
+ * testsuite/libffi.call/cls_20byte1.c (main): Ditto.
+ * testsuite/libffi.call/cls_9byte1.c (main): Ditto.
+ * testsuite/libffi.call/closure_fn1.c (main): Ditto.
+ * testsuite/libffi.call/closure_fn3.c (main): Ditto.
+ * testsuite/libffi.call/return_dbl2.c (main): Ditto.
+ * testsuite/libffi.call/cls_sshort.c (main): Ditto.
+ * testsuite/libffi.call/return_fl3.c (main): Ditto.
+ * testsuite/libffi.call/closure_fn5.c (main): Ditto.
+ * testsuite/libffi.call/nested_struct.c (main): Ditto.
+ * testsuite/libffi.call/nested_struct10.c (main): Ditto.
+ * testsuite/libffi.call/return_ll1.c (main): Ditto.
+ * testsuite/libffi.call/cls_8byte.c (main): Ditto.
+ * testsuite/libffi.call/cls_align_uint32.c (main): Ditto.
+ * testsuite/libffi.call/cls_align_sint16.c (main): Ditto.
+ * testsuite/libffi.call/cls_20byte.c (main): Ditto.
+ * testsuite/libffi.call/nested_struct2.c (main): Ditto.
+ * testsuite/libffi.call/cls_24byte.c (main): Ditto.
+ * testsuite/libffi.call/nested_struct6.c (main): Ditto.
+ * testsuite/libffi.call/cls_uint.c (main): Ditto.
+ * testsuite/libffi.call/cls_12byte.c (main): Ditto.
+ * testsuite/libffi.call/cls_16byte.c (main): Ditto.
+ * testsuite/libffi.call/closure_fn0.c (main): Ditto.
+ * testsuite/libffi.call/cls_9byte2.c (main): Ditto.
+ * testsuite/libffi.call/closure_fn2.c (main): Ditto.
+ * testsuite/libffi.call/return_dbl1.c (main): Ditto.
+ * testsuite/libffi.call/closure_fn4.c (main): Ditto.
+ * testsuite/libffi.call/closure_fn6.c (main): Ditto.
+ * testsuite/libffi.call/cls_align_sint32.c (main): Ditto.
+
+2007-08-07 Andrew Haley <aph@redhat.com>
+
+ * src/x86/sysv.S (ffi_closure_raw_SYSV): Fix typo in previous
+ checkin.
+
+2007-08-06 Andrew Haley <aph@redhat.com>
+
+ PR testsuite/32843
+ * src/x86/sysv.S (ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8,
+ FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32,
+ FFI_TYPE_SINT32.
+
+2007-08-02 David Daney <ddaney@avtrex.com>
+
+ * testsuite/libffi.call/return_ul.c (main): Define return type as
+ ffi_arg. Use proper printf conversion specifier.
+
+2007-07-30 Andrew Haley <aph@redhat.com>
+
+ PR testsuite/32843
+ * src/x86/ffi.c (ffi_prep_cif_machdep): in x86 case, add code for
+ signed/unsigned int8/16.
+ * src/x86/sysv.S (ffi_call_SYSV): Rewrite to:
+ Use a jump table.
+ Remove code to pop args from the stack after call.
+ Special-case signed/unsigned int8/16.
+ * testsuite/libffi.call/return_sc.c (main): Revert.
+
2007-07-26 Richard Guenther <rguenther@suse.de>
PR testsuite/32843
diff --git a/libffi/Makefile.am b/libffi/Makefile.am
index 3000c9c2df7..a9962686bcf 100644
--- a/libffi/Makefile.am
+++ b/libffi/Makefile.am
@@ -84,12 +84,9 @@ libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \
nodist_libffi_la_SOURCES =
-if MIPS_IRIX
+if MIPS
nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S
endif
-if MIPS_LINUX
-nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S
-endif
if X86
nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S
endif
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index fc5539e992b..50722e54ef2 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -37,29 +37,28 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@MIPS_IRIX_TRUE@am__append_1 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
-@MIPS_LINUX_TRUE@am__append_2 = src/mips/ffi.c src/mips/o32.S
-@X86_TRUE@am__append_3 = src/x86/ffi.c src/x86/sysv.S
-@X86_WIN32_TRUE@am__append_4 = src/x86/ffi.c src/x86/win32.S
-@X86_DARWIN_TRUE@am__append_5 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
-@SPARC_TRUE@am__append_6 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
-@ALPHA_TRUE@am__append_7 = src/alpha/ffi.c src/alpha/osf.S
-@IA64_TRUE@am__append_8 = src/ia64/ffi.c src/ia64/unix.S
-@M32R_TRUE@am__append_9 = src/m32r/sysv.S src/m32r/ffi.c
-@M68K_TRUE@am__append_10 = src/m68k/ffi.c src/m68k/sysv.S
-@POWERPC_TRUE@am__append_11 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
-@POWERPC_AIX_TRUE@am__append_12 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
-@POWERPC_DARWIN_TRUE@am__append_13 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
-@POWERPC_FREEBSD_TRUE@am__append_14 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
-@ARM_TRUE@am__append_15 = src/arm/sysv.S src/arm/ffi.c
-@LIBFFI_CRIS_TRUE@am__append_16 = src/cris/sysv.S src/cris/ffi.c
-@FRV_TRUE@am__append_17 = src/frv/eabi.S src/frv/ffi.c
-@S390_TRUE@am__append_18 = src/s390/sysv.S src/s390/ffi.c
-@X86_64_TRUE@am__append_19 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
-@SH_TRUE@am__append_20 = src/sh/sysv.S src/sh/ffi.c
-@SH64_TRUE@am__append_21 = src/sh64/sysv.S src/sh64/ffi.c
-@PA_LINUX_TRUE@am__append_22 = src/pa/linux.S src/pa/ffi.c
-@PA_HPUX_TRUE@am__append_23 = src/pa/hpux32.S src/pa/ffi.c
+@MIPS_TRUE@am__append_1 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S
+@X86_TRUE@am__append_2 = src/x86/ffi.c src/x86/sysv.S
+@X86_WIN32_TRUE@am__append_3 = src/x86/ffi.c src/x86/win32.S
+@X86_DARWIN_TRUE@am__append_4 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S
+@SPARC_TRUE@am__append_5 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S
+@ALPHA_TRUE@am__append_6 = src/alpha/ffi.c src/alpha/osf.S
+@IA64_TRUE@am__append_7 = src/ia64/ffi.c src/ia64/unix.S
+@M32R_TRUE@am__append_8 = src/m32r/sysv.S src/m32r/ffi.c
+@M68K_TRUE@am__append_9 = src/m68k/ffi.c src/m68k/sysv.S
+@POWERPC_TRUE@am__append_10 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S
+@POWERPC_AIX_TRUE@am__append_11 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S
+@POWERPC_DARWIN_TRUE@am__append_12 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
+@POWERPC_FREEBSD_TRUE@am__append_13 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
+@ARM_TRUE@am__append_14 = src/arm/sysv.S src/arm/ffi.c
+@LIBFFI_CRIS_TRUE@am__append_15 = src/cris/sysv.S src/cris/ffi.c
+@FRV_TRUE@am__append_16 = src/frv/eabi.S src/frv/ffi.c
+@S390_TRUE@am__append_17 = src/s390/sysv.S src/s390/ffi.c
+@X86_64_TRUE@am__append_18 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
+@SH_TRUE@am__append_19 = src/sh/sysv.S src/sh/ffi.c
+@SH64_TRUE@am__append_20 = src/sh64/sysv.S src/sh64/ffi.c
+@PA_LINUX_TRUE@am__append_21 = src/pa/linux.S src/pa/ffi.c
+@PA_HPUX_TRUE@am__append_22 = src/pa/hpux32.S src/pa/ffi.c
DIST_COMMON = README $(am__configure_deps) $(srcdir)/../compile \
$(srcdir)/../config.guess $(srcdir)/../config.sub \
$(srcdir)/../depcomp $(srcdir)/../install-sh \
@@ -95,42 +94,41 @@ libffi_la_LIBADD =
am__dirstamp = $(am__leading_dot)dirstamp
am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
src/raw_api.lo src/java_raw_api.lo src/closures.lo
-@MIPS_IRIX_TRUE@am__objects_1 = src/mips/ffi.lo src/mips/o32.lo \
-@MIPS_IRIX_TRUE@ src/mips/n32.lo
-@MIPS_LINUX_TRUE@am__objects_2 = src/mips/ffi.lo src/mips/o32.lo
-@X86_TRUE@am__objects_3 = src/x86/ffi.lo src/x86/sysv.lo
-@X86_WIN32_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/win32.lo
-@X86_DARWIN_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/darwin.lo \
+@MIPS_TRUE@am__objects_1 = src/mips/ffi.lo src/mips/o32.lo \
+@MIPS_TRUE@ src/mips/n32.lo
+@X86_TRUE@am__objects_2 = src/x86/ffi.lo src/x86/sysv.lo
+@X86_WIN32_TRUE@am__objects_3 = src/x86/ffi.lo src/x86/win32.lo
+@X86_DARWIN_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/darwin.lo \
@X86_DARWIN_TRUE@ src/x86/ffi64.lo src/x86/darwin64.lo
-@SPARC_TRUE@am__objects_6 = src/sparc/ffi.lo src/sparc/v8.lo \
+@SPARC_TRUE@am__objects_5 = src/sparc/ffi.lo src/sparc/v8.lo \
@SPARC_TRUE@ src/sparc/v9.lo
-@ALPHA_TRUE@am__objects_7 = src/alpha/ffi.lo src/alpha/osf.lo
-@IA64_TRUE@am__objects_8 = src/ia64/ffi.lo src/ia64/unix.lo
-@M32R_TRUE@am__objects_9 = src/m32r/sysv.lo src/m32r/ffi.lo
-@M68K_TRUE@am__objects_10 = src/m68k/ffi.lo src/m68k/sysv.lo
-@POWERPC_TRUE@am__objects_11 = src/powerpc/ffi.lo src/powerpc/sysv.lo \
+@ALPHA_TRUE@am__objects_6 = src/alpha/ffi.lo src/alpha/osf.lo
+@IA64_TRUE@am__objects_7 = src/ia64/ffi.lo src/ia64/unix.lo
+@M32R_TRUE@am__objects_8 = src/m32r/sysv.lo src/m32r/ffi.lo
+@M68K_TRUE@am__objects_9 = src/m68k/ffi.lo src/m68k/sysv.lo
+@POWERPC_TRUE@am__objects_10 = src/powerpc/ffi.lo src/powerpc/sysv.lo \
@POWERPC_TRUE@ src/powerpc/ppc_closure.lo \
@POWERPC_TRUE@ src/powerpc/linux64.lo \
@POWERPC_TRUE@ src/powerpc/linux64_closure.lo
-@POWERPC_AIX_TRUE@am__objects_12 = src/powerpc/ffi_darwin.lo \
+@POWERPC_AIX_TRUE@am__objects_11 = src/powerpc/ffi_darwin.lo \
@POWERPC_AIX_TRUE@ src/powerpc/aix.lo \
@POWERPC_AIX_TRUE@ src/powerpc/aix_closure.lo
-@POWERPC_DARWIN_TRUE@am__objects_13 = src/powerpc/ffi_darwin.lo \
+@POWERPC_DARWIN_TRUE@am__objects_12 = src/powerpc/ffi_darwin.lo \
@POWERPC_DARWIN_TRUE@ src/powerpc/darwin.lo \
@POWERPC_DARWIN_TRUE@ src/powerpc/darwin_closure.lo
-@POWERPC_FREEBSD_TRUE@am__objects_14 = src/powerpc/ffi.lo \
+@POWERPC_FREEBSD_TRUE@am__objects_13 = src/powerpc/ffi.lo \
@POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \
@POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo
-@ARM_TRUE@am__objects_15 = src/arm/sysv.lo src/arm/ffi.lo
-@LIBFFI_CRIS_TRUE@am__objects_16 = src/cris/sysv.lo src/cris/ffi.lo
-@FRV_TRUE@am__objects_17 = src/frv/eabi.lo src/frv/ffi.lo
-@S390_TRUE@am__objects_18 = src/s390/sysv.lo src/s390/ffi.lo
-@X86_64_TRUE@am__objects_19 = src/x86/ffi64.lo src/x86/unix64.lo \
+@ARM_TRUE@am__objects_14 = src/arm/sysv.lo src/arm/ffi.lo
+@LIBFFI_CRIS_TRUE@am__objects_15 = src/cris/sysv.lo src/cris/ffi.lo
+@FRV_TRUE@am__objects_16 = src/frv/eabi.lo src/frv/ffi.lo
+@S390_TRUE@am__objects_17 = src/s390/sysv.lo src/s390/ffi.lo
+@X86_64_TRUE@am__objects_18 = src/x86/ffi64.lo src/x86/unix64.lo \
@X86_64_TRUE@ src/x86/ffi.lo src/x86/sysv.lo
-@SH_TRUE@am__objects_20 = src/sh/sysv.lo src/sh/ffi.lo
-@SH64_TRUE@am__objects_21 = src/sh64/sysv.lo src/sh64/ffi.lo
-@PA_LINUX_TRUE@am__objects_22 = src/pa/linux.lo src/pa/ffi.lo
-@PA_HPUX_TRUE@am__objects_23 = src/pa/hpux32.lo src/pa/ffi.lo
+@SH_TRUE@am__objects_19 = src/sh/sysv.lo src/sh/ffi.lo
+@SH64_TRUE@am__objects_20 = src/sh64/sysv.lo src/sh64/ffi.lo
+@PA_LINUX_TRUE@am__objects_21 = src/pa/linux.lo src/pa/ffi.lo
+@PA_HPUX_TRUE@am__objects_22 = src/pa/hpux32.lo src/pa/ffi.lo
nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_3) $(am__objects_4) $(am__objects_5) \
$(am__objects_6) $(am__objects_7) $(am__objects_8) \
@@ -138,22 +136,22 @@ nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_12) $(am__objects_13) $(am__objects_14) \
$(am__objects_15) $(am__objects_16) $(am__objects_17) \
$(am__objects_18) $(am__objects_19) $(am__objects_20) \
- $(am__objects_21) $(am__objects_22) $(am__objects_23)
+ $(am__objects_21) $(am__objects_22)
libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \
$(nodist_libffi_la_OBJECTS)
libffi_convenience_la_LIBADD =
-am__objects_24 = src/debug.lo src/prep_cif.lo src/types.lo \
+am__objects_23 = src/debug.lo src/prep_cif.lo src/types.lo \
src/raw_api.lo src/java_raw_api.lo src/closures.lo
-am_libffi_convenience_la_OBJECTS = $(am__objects_24)
-am__objects_25 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+am_libffi_convenience_la_OBJECTS = $(am__objects_23)
+am__objects_24 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
$(am__objects_4) $(am__objects_5) $(am__objects_6) \
$(am__objects_7) $(am__objects_8) $(am__objects_9) \
$(am__objects_10) $(am__objects_11) $(am__objects_12) \
$(am__objects_13) $(am__objects_14) $(am__objects_15) \
$(am__objects_16) $(am__objects_17) $(am__objects_18) \
$(am__objects_19) $(am__objects_20) $(am__objects_21) \
- $(am__objects_22) $(am__objects_23)
-nodist_libffi_convenience_la_OBJECTS = $(am__objects_25)
+ $(am__objects_22)
+nodist_libffi_convenience_la_OBJECTS = $(am__objects_24)
libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \
$(nodist_libffi_convenience_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
@@ -258,10 +256,8 @@ MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MIPS_IRIX_FALSE = @MIPS_IRIX_FALSE@
-MIPS_IRIX_TRUE = @MIPS_IRIX_TRUE@
-MIPS_LINUX_FALSE = @MIPS_LINUX_FALSE@
-MIPS_LINUX_TRUE = @MIPS_LINUX_TRUE@
+MIPS_FALSE = @MIPS_FALSE@
+MIPS_TRUE = @MIPS_TRUE@
NM = @NM@
OBJEXT = @OBJEXT@
PA64_HPUX_FALSE = @PA64_HPUX_FALSE@
@@ -439,7 +435,7 @@ nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) \
$(am__append_12) $(am__append_13) $(am__append_14) \
$(am__append_15) $(am__append_16) $(am__append_17) \
$(am__append_18) $(am__append_19) $(am__append_20) \
- $(am__append_21) $(am__append_22) $(am__append_23)
+ $(am__append_21) $(am__append_22)
libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
AM_CFLAGS = -Wall -g -fexceptions
diff --git a/libffi/configure b/libffi/configure
index 404475f353c..975a1bcbb32 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -459,7 +459,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CCAS CCASFLAGS LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S AR ac_ct_AR RANLIB ac_ct_RANLIB lt_ECHO CPP CPPFLAGS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT TESTSUBDIR_TRUE TESTSUBDIR_FALSE AM_RUNTESTFLAGS MIPS_IRIX_TRUE MIPS_IRIX_FALSE MIPS_LINUX_TRUE MIPS_LINUX_FALSE SPARC_TRUE SPARC_FALSE X86_TRUE X86_FALSE X86_WIN32_TRUE X86_WIN32_FALSE X86_DARWIN_TRUE X86_DARWIN_FALSE ALPHA_TRUE ALPHA_FALSE IA64_TRUE IA64_FALSE M32R_TRUE M32R_FALSE M68K_TRUE M68K_FALSE POWERPC_TRUE POWERPC_FALSE POWERPC_AIX_TRUE POWERPC_AIX_FALSE POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE POWERPC_FREEBSD_TRUE POWERPC_FREEBSD_FALSE ARM_TRUE ARM_FALSE LIBFFI_CRIS_TRUE LIBFFI_CRIS_FALSE FRV_TRUE FRV_FALSE S390_TRUE S390_FALSE X86_64_TRUE X86_64_FALSE SH_TRUE SH_FALSE SH64_TRUE SH64_FALSE PA_LINUX_TRUE PA_LINUX_FALSE PA_HPUX_TRUE PA_HPUX_FALSE PA64_HPUX_TRUE PA64_HPUX_FALSE ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR toolexecdir toolexeclibdir LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CCAS CCASFLAGS LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S AR ac_ct_AR RANLIB ac_ct_RANLIB lt_ECHO CPP CPPFLAGS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT TESTSUBDIR_TRUE TESTSUBDIR_FALSE AM_RUNTESTFLAGS MIPS_TRUE MIPS_FALSE SPARC_TRUE SPARC_FALSE X86_TRUE X86_FALSE X86_WIN32_TRUE X86_WIN32_FALSE X86_DARWIN_TRUE X86_DARWIN_FALSE ALPHA_TRUE ALPHA_FALSE IA64_TRUE IA64_FALSE M32R_TRUE M32R_FALSE M68K_TRUE M68K_FALSE POWERPC_TRUE POWERPC_FALSE POWERPC_AIX_TRUE POWERPC_AIX_FALSE POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE POWERPC_FREEBSD_TRUE POWERPC_FREEBSD_FALSE ARM_TRUE ARM_FALSE LIBFFI_CRIS_TRUE LIBFFI_CRIS_FALSE FRV_TRUE FRV_FALSE S390_TRUE S390_FALSE X86_64_TRUE X86_64_FALSE SH_TRUE SH_FALSE SH64_TRUE SH64_FALSE PA_LINUX_TRUE PA_LINUX_FALSE PA_HPUX_TRUE PA_HPUX_FALSE PA64_HPUX_TRUE PA64_HPUX_FALSE ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR toolexecdir toolexeclibdir LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -4080,7 +4080,7 @@ lt_cv_deplibs_check_method='unknown'
# whether `pass_all' will *always* work, you probably want this one.
case $host_os in
-aix4* | aix5*)
+aix[4-9]*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -6599,7 +6599,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
# See if GNU ld supports shared libraries.
case $host_os in
- aix3* | aix4* | aix5*)
+ aix[3-9]*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
@@ -6833,7 +6833,7 @@ _LT_EOF
fi
;;
- aix4* | aix5*)
+ aix[4-9]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
@@ -6853,7 +6853,7 @@ _LT_EOF
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
- case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
@@ -7913,7 +7913,7 @@ aix3*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
-aix4* | aix5*)
+aix[4-9]*)
version_type=linux
need_lib_prefix=no
need_version=no
@@ -9531,7 +9531,7 @@ echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
fi
;;
- aix4* | aix5*)
+ aix[4-9]*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
@@ -10281,6 +10281,10 @@ case "$host" in
TARGET=ARM; TARGETDIR=arm
;;
+ amd64-*-freebsd*)
+ TARGET=X86_64; TARGETDIR=x86
+ ;;
+
cris-*-*)
TARGET=LIBFFI_CRIS; TARGETDIR=cris
;;
@@ -10324,13 +10328,11 @@ case "$host" in
TARGET=M68K; TARGETDIR=m68k
;;
- mips64*-*)
- ;;
mips-sgi-irix5.* | mips-sgi-irix6.*)
- TARGET=MIPS_IRIX; TARGETDIR=mips
+ TARGET=MIPS; TARGETDIR=mips
;;
mips*-*-linux*)
- TARGET=MIPS_LINUX; TARGETDIR=mips
+ TARGET=MIPS; TARGETDIR=mips
;;
powerpc*-*-linux* | powerpc-*-sysv*)
@@ -10387,22 +10389,12 @@ fi
-if test x$TARGET = xMIPS_IRIX; then
- MIPS_IRIX_TRUE=
- MIPS_IRIX_FALSE='#'
+if test x$TARGET = xMIPS; then
+ MIPS_TRUE=
+ MIPS_FALSE='#'
else
- MIPS_IRIX_TRUE='#'
- MIPS_IRIX_FALSE=
-fi
-
-
-
-if test x$TARGET = xMIPS_LINUX; then
- MIPS_LINUX_TRUE=
- MIPS_LINUX_FALSE='#'
-else
- MIPS_LINUX_TRUE='#'
- MIPS_LINUX_FALSE=
+ MIPS_TRUE='#'
+ MIPS_FALSE=
fi
@@ -10626,11 +10618,6 @@ else
fi
-case x$TARGET in
- xMIPS*) TARGET=MIPS ;;
- *) ;;
-esac
-
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
@@ -12814,17 +12801,10 @@ echo "$as_me: error: conditional \"TESTSUBDIR\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${MIPS_IRIX_TRUE}" && test -z "${MIPS_IRIX_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"MIPS_IRIX\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"MIPS_IRIX\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
-if test -z "${MIPS_LINUX_TRUE}" && test -z "${MIPS_LINUX_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"MIPS_LINUX\" was never defined.
+if test -z "${MIPS_TRUE}" && test -z "${MIPS_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"MIPS\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"MIPS_LINUX\" was never defined.
+echo "$as_me: error: conditional \"MIPS\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
@@ -13853,10 +13833,8 @@ s,@MAINT@,$MAINT,;t t
s,@TESTSUBDIR_TRUE@,$TESTSUBDIR_TRUE,;t t
s,@TESTSUBDIR_FALSE@,$TESTSUBDIR_FALSE,;t t
s,@AM_RUNTESTFLAGS@,$AM_RUNTESTFLAGS,;t t
-s,@MIPS_IRIX_TRUE@,$MIPS_IRIX_TRUE,;t t
-s,@MIPS_IRIX_FALSE@,$MIPS_IRIX_FALSE,;t t
-s,@MIPS_LINUX_TRUE@,$MIPS_LINUX_TRUE,;t t
-s,@MIPS_LINUX_FALSE@,$MIPS_LINUX_FALSE,;t t
+s,@MIPS_TRUE@,$MIPS_TRUE,;t t
+s,@MIPS_FALSE@,$MIPS_FALSE,;t t
s,@SPARC_TRUE@,$SPARC_TRUE,;t t
s,@SPARC_FALSE@,$SPARC_FALSE,;t t
s,@X86_TRUE@,$X86_TRUE,;t t
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 6c7a9d26969..5d0830b8039 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -51,6 +51,10 @@ case "$host" in
TARGET=ARM; TARGETDIR=arm
;;
+ amd64-*-freebsd*)
+ TARGET=X86_64; TARGETDIR=x86
+ ;;
+
cris-*-*)
TARGET=LIBFFI_CRIS; TARGETDIR=cris
;;
@@ -94,13 +98,11 @@ case "$host" in
TARGET=M68K; TARGETDIR=m68k
;;
- mips64*-*)
- ;;
mips-sgi-irix5.* | mips-sgi-irix6.*)
- TARGET=MIPS_IRIX; TARGETDIR=mips
+ TARGET=MIPS; TARGETDIR=mips
;;
mips*-*-linux*)
- TARGET=MIPS_LINUX; TARGETDIR=mips
+ TARGET=MIPS; TARGETDIR=mips
;;
powerpc*-*-linux* | powerpc-*-sysv*)
@@ -153,8 +155,7 @@ if test $TARGETDIR = unknown; then
AC_MSG_ERROR(["libffi has not been ported to $host."])
fi
-AM_CONDITIONAL(MIPS_IRIX, test x$TARGET = xMIPS_IRIX)
-AM_CONDITIONAL(MIPS_LINUX, test x$TARGET = xMIPS_LINUX)
+AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
AM_CONDITIONAL(X86, test x$TARGET = xX86)
AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32)
@@ -178,11 +179,6 @@ AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX)
AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX)
AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX)
-case x$TARGET in
- xMIPS*) TARGET=MIPS ;;
- *) ;;
-esac
-
AC_HEADER_STDC
AC_CHECK_FUNCS(memcpy)
AC_FUNC_ALLOCA
diff --git a/libffi/fficonfig.h.in b/libffi/fficonfig.h.in
index d32d488ed12..e93cf8ae77b 100644
--- a/libffi/fficonfig.h.in
+++ b/libffi/fficonfig.h.in
@@ -37,6 +37,9 @@
*/
#undef HAVE_AS_SPARC_UA_PCREL
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
/* Define if __attribute__((visibility("hidden"))) is supported. */
#undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
@@ -91,6 +94,10 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
diff --git a/libffi/include/Makefile.in b/libffi/include/Makefile.in
index 1f7d6c05f79..d518c1cfc92 100644
--- a/libffi/include/Makefile.in
+++ b/libffi/include/Makefile.in
@@ -124,10 +124,8 @@ MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MIPS_IRIX_FALSE = @MIPS_IRIX_FALSE@
-MIPS_IRIX_TRUE = @MIPS_IRIX_TRUE@
-MIPS_LINUX_FALSE = @MIPS_LINUX_FALSE@
-MIPS_LINUX_TRUE = @MIPS_LINUX_TRUE@
+MIPS_FALSE = @MIPS_FALSE@
+MIPS_TRUE = @MIPS_TRUE@
NM = @NM@
OBJEXT = @OBJEXT@
PA64_HPUX_FALSE = @PA64_HPUX_FALSE@
diff --git a/libffi/include/ffi.h.in b/libffi/include/ffi.h.in
index bffe7ffc96d..7784b2e395d 100644
--- a/libffi/include/ffi.h.in
+++ b/libffi/include/ffi.h.in
@@ -193,6 +193,10 @@ typedef struct {
# endif
#endif
+#ifndef FFI_SIZEOF_JAVA_RAW
+# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
+#endif
+
typedef union {
ffi_sarg sint;
ffi_arg uint;
@@ -201,6 +205,21 @@ typedef union {
void* ptr;
} ffi_raw;
+#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8
+/* This is a special case for mips64/n32 ABI (and perhaps others) where
+ sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */
+typedef union {
+ signed int sint;
+ unsigned int uint;
+ float flt;
+ char data[FFI_SIZEOF_JAVA_RAW];
+ void* ptr;
+} ffi_java_raw;
+#else
+typedef ffi_raw ffi_java_raw;
+#endif
+
+
void ffi_raw_call (ffi_cif *cif,
void (*fn)(),
void *rvalue,
@@ -217,10 +236,10 @@ size_t ffi_raw_size (ffi_cif *cif);
void ffi_java_raw_call (ffi_cif *cif,
void (*fn)(),
void *rvalue,
- ffi_raw *avalue);
+ ffi_java_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);
+void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
+void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
size_t ffi_java_raw_size (ffi_cif *cif);
/* ---- Definitions for closures ----------------------------------------- */
@@ -271,6 +290,27 @@ typedef struct {
} ffi_raw_closure;
+typedef struct {
+ char tramp[FFI_TRAMPOLINE_SIZE];
+
+ ffi_cif *cif;
+
+#if !FFI_NATIVE_RAW_API
+
+ /* if this is enabled, then a raw closure has the same layout
+ as a regular closure. We use this to install an intermediate
+ handler to do the transaltion, void** -> ffi_raw*. */
+
+ void (*translate_args)(ffi_cif*,void*,void**,void*);
+ void *this_closure;
+
+#endif
+
+ void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*);
+ void *user_data;
+
+} ffi_java_raw_closure;
+
ffi_status
ffi_prep_raw_closure (ffi_raw_closure*,
ffi_cif *cif,
@@ -285,15 +325,15 @@ ffi_prep_raw_closure_loc (ffi_raw_closure*,
void *codeloc);
ffi_status
-ffi_prep_java_raw_closure (ffi_raw_closure*,
+ffi_prep_java_raw_closure (ffi_java_raw_closure*,
ffi_cif *cif,
- void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+ void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data);
ffi_status
-ffi_prep_java_raw_closure_loc (ffi_raw_closure*,
+ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
ffi_cif *cif,
- void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+ void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data,
void *codeloc);
diff --git a/libffi/include/ffi_common.h b/libffi/include/ffi_common.h
index 3620a2e162a..6af4b5f21fa 100644
--- a/libffi/include/ffi_common.h
+++ b/libffi/include/ffi_common.h
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------
ffi_common.h - Copyright (c) 1996 Red Hat, Inc.
+ Copyright (C) 2007 Free Software Foundation, Inc
Common internal definitions and macros. Only necessary for building
libffi.
@@ -18,7 +19,9 @@ extern "C" {
this is positioned. */
#ifdef __GNUC__
# define alloca __builtin_alloca
+# define MAYBE_UNUSED __attribute__((__unused__))
#else
+# define MAYBE_UNUSED
# if HAVE_ALLOCA_H
# include <alloca.h>
# else
diff --git a/libffi/src/arm/ffi.c b/libffi/src/arm/ffi.c
index f3cd50653e4..35b2c3477a4 100644
--- a/libffi/src/arm/ffi.c
+++ b/libffi/src/arm/ffi.c
@@ -40,7 +40,7 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
argp = stack;
- if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) {
+ if ( ecif->cif->flags == FFI_TYPE_STRUCT ) {
*(void **) argp = ecif->rvalue;
argp += 4;
}
@@ -58,6 +58,9 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
argp = (char *) ALIGN(argp, (*p_arg)->alignment);
}
+ if ((*p_arg)->type == FFI_TYPE_STRUCT)
+ argp = (char *) ALIGN(argp, 4);
+
z = (*p_arg)->size;
if (z < sizeof(int))
{
@@ -81,7 +84,7 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
break;
case FFI_TYPE_STRUCT:
- *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
+ memcpy(argp, *p_argv, (*p_arg)->size);
break;
default:
@@ -115,7 +118,6 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
switch (cif->rtype->type)
{
case FFI_TYPE_VOID:
- case FFI_TYPE_STRUCT:
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
cif->flags = (unsigned) cif->rtype->type;
@@ -126,6 +128,17 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
cif->flags = (unsigned) FFI_TYPE_SINT64;
break;
+ case FFI_TYPE_STRUCT:
+ if (cif->rtype->size <= 4)
+ /* A Composite Type not larger than 4 bytes is returned in r0. */
+ cif->flags = (unsigned)FFI_TYPE_INT;
+ else
+ /* A Composite Type larger than 4 bytes, or whose size cannot
+ be determined statically ... is stored in memory at an
+ address passed [in r0]. */
+ cif->flags = (unsigned)FFI_TYPE_STRUCT;
+ break;
+
default:
cif->flags = FFI_TYPE_INT;
break;
@@ -141,21 +154,27 @@ void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
{
extended_cif ecif;
+ int small_struct = (cif->flags == FFI_TYPE_INT
+ && cif->rtype->type == FFI_TYPE_STRUCT);
+
ecif.cif = cif;
ecif.avalue = avalue;
+
+ unsigned int temp;
/* 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))
+ (cif->flags == FFI_TYPE_STRUCT))
{
ecif.rvalue = alloca(cif->rtype->size);
}
+ else if (small_struct)
+ ecif.rvalue = &temp;
else
ecif.rvalue = rvalue;
-
-
+
switch (cif->abi)
{
case FFI_SYSV:
@@ -167,6 +186,8 @@ void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
FFI_ASSERT(0);
break;
}
+ if (small_struct)
+ memcpy (rvalue, &temp, cif->rtype->size);
}
/** private members **/
@@ -228,9 +249,12 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
{
size_t z;
+ size_t alignment = (*p_arg)->alignment;
+ if (alignment < 4)
+ alignment = 4;
/* Align if necessary */
- if ((sizeof(int) - 1) & (unsigned) argp) {
- argp = (char *) ALIGN(argp, sizeof(int));
+ if ((alignment - 1) & (unsigned) argp) {
+ argp = (char *) ALIGN(argp, alignment);
}
z = (*p_arg)->size;
@@ -248,21 +272,16 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
/* How to make a trampoline. */
-#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
-({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
- unsigned int __fun = (unsigned int)(FUN); \
- unsigned int __ctx = (unsigned int)(CTX); \
+#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
+({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
+ unsigned int __fun = (unsigned int)(FUN); \
+ unsigned int __ctx = (unsigned int)(CTX); \
*(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \
- *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \
- *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \
- *(unsigned int*) &__tramp[12] = __ctx; \
- *(unsigned int*) &__tramp[16] = __fun; \
- register unsigned long _beg __asm ("a1") = (unsigned long) (&__tramp[0]); \
- register unsigned long _end __asm ("a2") = (unsigned long) (&__tramp[19]); \
- register unsigned long _flg __asm ("a3") = 0; \
- __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" \
- : "=r" (_beg) \
- : "0" (_beg), "r" (_end), "r" (_flg)); \
+ *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \
+ *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \
+ *(unsigned int*) &__tramp[12] = __ctx; \
+ *(unsigned int*) &__tramp[16] = __fun; \
+ __clear_cache((&__tramp[0]), (&__tramp[19])); \
})
diff --git a/libffi/src/arm/sysv.S b/libffi/src/arm/sysv.S
index 00f43b2000b..12876d12054 100644
--- a/libffi/src/arm/sysv.S
+++ b/libffi/src/arm/sysv.S
@@ -82,6 +82,14 @@
# define call_reg(x) mov lr, pc ; mov pc, x
#endif
+/* Conditionally compile unwinder directives. */
+#ifdef __ARM_EABI__
+#define UNWIND
+#else
+#define UNWIND @
+#endif
+
+
#if defined(__thumb__) && !defined(__THUMB_INTERWORK__)
.macro ARM_FUNC_START name
.text
@@ -92,6 +100,7 @@
bx pc
nop
.arm
+ UNWIND .fnstart
/* A hook to tell gdb that we've switched to ARM mode. Also used to call
directly from other local arm routines. */
_L__\name:
@@ -102,6 +111,7 @@ _L__\name:
.align 0
.arm
ENTRY(\name)
+ UNWIND .fnstart
.endm
#endif
@@ -134,8 +144,11 @@ _L__\name:
ARM_FUNC_START ffi_call_SYSV
@ Save registers
stmfd sp!, {r0-r3, fp, lr}
+ UNWIND .save {r0-r3, fp, lr}
mov fp, sp
+ UNWIND .setfp fp, sp
+
@ Make room for all of the new args.
sub sp, fp, r2
@@ -205,6 +218,7 @@ LSYM(Lepilogue):
RETLDM "r0-r3,fp"
.ffi_call_SYSV_end:
+ UNWIND .fnend
.size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
/*
@@ -216,21 +230,40 @@ LSYM(Lepilogue):
*/
ARM_FUNC_START ffi_closure_SYSV
+ UNWIND .pad #16
add ip, sp, #16
stmfd sp!, {ip, lr}
+ UNWIND .save {r0, lr}
add r2, sp, #8
+ .pad #16
sub sp, sp, #16
str sp, [sp, #8]
add r1, sp, #8
bl ffi_closure_SYSV_inner
cmp r0, #FFI_TYPE_INT
beq .Lretint
+
cmp r0, #FFI_TYPE_FLOAT
+#ifdef __SOFTFP__
+ beq .Lretint
+#else
beq .Lretfloat
+#endif
+
cmp r0, #FFI_TYPE_DOUBLE
+#ifdef __SOFTFP__
+ beq .Lretlonglong
+#else
beq .Lretdouble
+#endif
+
cmp r0, #FFI_TYPE_LONGDOUBLE
+#ifdef __SOFTFP__
+ beq .Lretlonglong
+#else
beq .Lretlongdouble
+#endif
+
cmp r0, #FFI_TYPE_SINT64
beq .Lretlonglong
.Lclosure_epilogue:
@@ -243,6 +276,8 @@ ARM_FUNC_START ffi_closure_SYSV
ldr r0, [sp]
ldr r1, [sp, #4]
b .Lclosure_epilogue
+
+#ifndef __SOFTFP__
.Lretfloat:
ldfs f0, [sp]
b .Lclosure_epilogue
@@ -252,6 +287,9 @@ ARM_FUNC_START ffi_closure_SYSV
.Lretlongdouble:
ldfd f0, [sp]
b .Lclosure_epilogue
+#endif
+
.ffi_closure_SYSV_end:
+ UNWIND .fnend
.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV)
diff --git a/libffi/src/closures.c b/libffi/src/closures.c
index ec956d04f26..c441b870f70 100644
--- a/libffi/src/closures.c
+++ b/libffi/src/closures.c
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------
closures.c - Copyright (c) 2007 Red Hat, Inc.
+ Copyright (C) 2007 Free Software Foundation, Inc
Code to allocate and deallocate memory for closures.
@@ -149,8 +150,6 @@ selinux_enabled_check (void)
#endif
-#define MAYBE_UNUSED __attribute__((__unused__))
-
/* Declare all functions defined in dlmalloc.c as static. */
static void *dlmalloc(size_t);
static void dlfree(void*);
diff --git a/libffi/src/java_raw_api.c b/libffi/src/java_raw_api.c
index 9c00d37ed05..4fef115e0a6 100644
--- a/libffi/src/java_raw_api.c
+++ b/libffi/src/java_raw_api.c
@@ -54,13 +54,13 @@ ffi_java_raw_size (ffi_cif *cif)
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE:
- result += 2 * FFI_SIZEOF_ARG;
+ result += 2 * FFI_SIZEOF_JAVA_RAW;
break;
case FFI_TYPE_STRUCT:
/* No structure parameters in Java. */
abort();
default:
- result += FFI_SIZEOF_ARG;
+ result += FFI_SIZEOF_JAVA_RAW;
}
}
@@ -69,7 +69,7 @@ ffi_java_raw_size (ffi_cif *cif)
void
-ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
+ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args)
{
unsigned i;
ffi_type **tp = cif->arg_types;
@@ -90,7 +90,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
*args = (void*) ((char*)(raw++) + 2);
break;
-#if FFI_SIZEOF_ARG == 8
+#if FFI_SIZEOF_JAVA_RAW == 8
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE:
@@ -105,7 +105,8 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
default:
*args = raw;
- raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
+ raw +=
+ ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
}
}
@@ -116,7 +117,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
/* then assume little endian */
for (i = 0; i < cif->nargs; i++, tp++, args++)
{
-#if FFI_SIZEOF_ARG == 8
+#if FFI_SIZEOF_JAVA_RAW == 8
switch((*tp)->type) {
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
@@ -127,10 +128,11 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
default:
*args = (void*) raw++;
}
-#else /* FFI_SIZEOF_ARG != 8 */
+#else /* FFI_SIZEOF_JAVA_RAW != 8 */
*args = (void*) raw;
- raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*);
-#endif /* FFI_SIZEOF_ARG == 8 */
+ raw +=
+ ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
+#endif /* FFI_SIZEOF_JAVA_RAW == 8 */
}
#else
@@ -141,7 +143,7 @@ ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args)
}
void
-ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
+ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw)
{
unsigned i;
ffi_type **tp = cif->arg_types;
@@ -202,7 +204,7 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
(raw++)->flt = *(FLOAT32*) (*args);
break;
-#if FFI_SIZEOF_ARG == 8
+#if FFI_SIZEOF_JAVA_RAW == 8
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
case FFI_TYPE_DOUBLE:
@@ -216,11 +218,12 @@ ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw)
break;
default:
-#if FFI_SIZEOF_ARG == 8
+#if FFI_SIZEOF_JAVA_RAW == 8
FFI_ASSERT(0); /* Should have covered all cases */
#else
memcpy ((void*) raw->data, (void*)*args, (*tp)->size);
- raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
+ raw +=
+ ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
#endif
}
}
@@ -244,6 +247,9 @@ ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue)
case FFI_TYPE_SINT16:
case FFI_TYPE_SINT32:
case FFI_TYPE_INT:
+#if FFI_SIZEOF_JAVA_RAW == 4
+ case FFI_TYPE_POINTER:
+#endif
*(SINT64 *)rvalue <<= 32;
break;
@@ -269,6 +275,9 @@ ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue)
case FFI_TYPE_SINT16:
case FFI_TYPE_SINT32:
case FFI_TYPE_INT:
+#if FFI_SIZEOF_JAVA_RAW == 4
+ case FFI_TYPE_POINTER:
+#endif
*(SINT64 *)rvalue >>= 32;
break;
@@ -285,7 +294,8 @@ ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue)
* these following couple of functions will handle the translation forth
* and back automatically. */
-void ffi_java_raw_call (ffi_cif *cif, void (*fn)(), void *rvalue, ffi_raw *raw)
+void ffi_java_raw_call (ffi_cif *cif, void (*fn)(), void *rvalue,
+ ffi_java_raw *raw)
{
void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
ffi_java_raw_to_ptrarray (cif, raw, avalue);
@@ -299,7 +309,7 @@ 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_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
ffi_raw_closure *cl = (ffi_raw_closure*)user_data;
ffi_java_ptrarray_to_raw (cif, avalue, raw);
@@ -308,9 +318,9 @@ ffi_java_translate_args (ffi_cif *cif, void *rvalue,
}
ffi_status
-ffi_prep_java_raw_closure_loc (ffi_raw_closure* cl,
+ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl,
ffi_cif *cif,
- void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+ void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data,
void *codeloc)
{
@@ -335,9 +345,9 @@ ffi_prep_java_raw_closure_loc (ffi_raw_closure* cl,
* the pointer-array format, to the raw format */
ffi_status
-ffi_prep_java_raw_closure (ffi_raw_closure* cl,
+ffi_prep_java_raw_closure (ffi_java_raw_closure* cl,
ffi_cif *cif,
- void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
+ void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
void *user_data)
{
return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl);
diff --git a/libffi/src/mips/ffi.c b/libffi/src/mips/ffi.c
index 12b8b62bab9..d0ce201a151 100644
--- a/libffi/src/mips/ffi.c
+++ b/libffi/src/mips/ffi.c
@@ -28,13 +28,19 @@
#include <stdlib.h>
-#if _MIPS_SIM == _ABIN32
+#ifdef FFI_DEBUG
+# define FFI_MIPS_STOP_HERE() ffi_stop_here()
+#else
+# define FFI_MIPS_STOP_HERE() do {} while(0)
+#endif
+
+#ifdef FFI_MIPS_N32
#define FIX_ARGP \
FFI_ASSERT(argp <= &stack[bytes]); \
if (argp == &stack[bytes]) \
{ \
argp = stack; \
- ffi_stop_here(); \
+ FFI_MIPS_STOP_HERE(); \
}
#else
#define FIX_ARGP
@@ -54,7 +60,7 @@ static void ffi_prep_args(char *stack,
char *argp;
ffi_type **p_arg;
-#if _MIPS_SIM == _ABIN32
+#ifdef FFI_MIPS_N32
/* If more than 8 double words are used, the remainder go
on the stack. We reorder stuff on the stack here to
support this easily. */
@@ -68,7 +74,7 @@ static void ffi_prep_args(char *stack,
memset(stack, 0, bytes);
-#if _MIPS_SIM == _ABIN32
+#ifdef FFI_MIPS_N32
if ( ecif->cif->rstruct_flag != 0 )
#else
if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT )
@@ -91,7 +97,7 @@ static void ffi_prep_args(char *stack,
if (a < sizeof(ffi_arg))
a = sizeof(ffi_arg);
- if ((a - 1) & (unsigned int) argp)
+ if ((a - 1) & (unsigned long) argp)
{
argp = (char *) ALIGN(argp, a);
FIX_ARGP;
@@ -100,9 +106,15 @@ static void ffi_prep_args(char *stack,
z = (*p_arg)->size;
if (z <= sizeof(ffi_arg))
{
+ int type = (*p_arg)->type;
z = sizeof(ffi_arg);
- switch ((*p_arg)->type)
+ /* The size of a pointer depends on the ABI */
+ if (type == FFI_TYPE_POINTER)
+ type =
+ (ecif->cif->abi == FFI_N64) ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32;
+
+ switch (type)
{
case FFI_TYPE_SINT8:
*(ffi_arg *)argp = *(SINT8 *)(* p_argv);
@@ -125,7 +137,6 @@ static void ffi_prep_args(char *stack,
break;
case FFI_TYPE_UINT32:
- case FFI_TYPE_POINTER:
*(ffi_arg *)argp = *(UINT32 *)(* p_argv);
break;
@@ -134,8 +145,7 @@ static void ffi_prep_args(char *stack,
*(float *) argp = *(float *)(* p_argv);
break;
- /* Handle small structures. */
- case FFI_TYPE_STRUCT:
+ /* Handle structures. */
default:
memcpy(argp, *p_argv, (*p_arg)->size);
break;
@@ -143,12 +153,12 @@ static void ffi_prep_args(char *stack,
}
else
{
-#if _MIPS_SIM == _ABIO32
+#ifdef FFI_MIPS_O32
memcpy(argp, *p_argv, z);
#else
{
- unsigned end = (unsigned) argp+z;
- unsigned cap = (unsigned) stack+bytes;
+ unsigned long end = (unsigned long) argp + z;
+ unsigned long cap = (unsigned long) stack + bytes;
/* Check if the data will fit within the register space.
Handle it if it doesn't. */
@@ -157,12 +167,13 @@ static void ffi_prep_args(char *stack,
memcpy(argp, *p_argv, z);
else
{
- unsigned portion = end - cap;
+ unsigned long portion = cap - (unsigned long)argp;
memcpy(argp, *p_argv, portion);
argp = stack;
- memcpy(argp,
- (void*)((unsigned)(*p_argv)+portion), z - portion);
+ z -= portion;
+ memcpy(argp, (void*)((unsigned long)(*p_argv) + portion),
+ z);
}
}
#endif
@@ -173,7 +184,7 @@ static void ffi_prep_args(char *stack,
}
}
-#if _MIPS_SIM == _ABIN32
+#ifdef FFI_MIPS_N32
/* The n32 spec says that if "a chunk consists solely of a double
float field (but not a double, which is part of a union), it
@@ -181,35 +192,41 @@ static void ffi_prep_args(char *stack,
passed in an integer register". This code traverses structure
definitions and generates the appropriate flags. */
-unsigned calc_n32_struct_flags(ffi_type *arg, unsigned *shift)
+static unsigned
+calc_n32_struct_flags(ffi_type *arg, unsigned *loc, unsigned *arg_reg)
{
unsigned flags = 0;
unsigned index = 0;
ffi_type *e;
- while (e = arg->elements[index])
+ while ((e = arg->elements[index]))
{
+ /* Align this object. */
+ *loc = ALIGN(*loc, e->alignment);
if (e->type == FFI_TYPE_DOUBLE)
{
- flags += (FFI_TYPE_DOUBLE << *shift);
- *shift += FFI_FLAG_BITS;
+ /* Already aligned to FFI_SIZEOF_ARG. */
+ *arg_reg = *loc / FFI_SIZEOF_ARG;
+ if (*arg_reg > 7)
+ break;
+ flags += (FFI_TYPE_DOUBLE << (*arg_reg * FFI_FLAG_BITS));
+ *loc += e->size;
}
- else if (e->type == FFI_TYPE_STRUCT)
- flags += calc_n32_struct_flags(e, shift);
else
- *shift += FFI_FLAG_BITS;
-
+ *loc += e->size;
index++;
}
+ /* Next Argument register at alignment of FFI_SIZEOF_ARG. */
+ *arg_reg = ALIGN(*loc, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
return flags;
}
-unsigned calc_n32_return_struct_flags(ffi_type *arg)
+static unsigned
+calc_n32_return_struct_flags(ffi_type *arg)
{
unsigned flags = 0;
- unsigned index = 0;
unsigned small = FFI_TYPE_SMALLSTRUCT;
ffi_type *e;
@@ -228,16 +245,16 @@ unsigned calc_n32_return_struct_flags(ffi_type *arg)
e = arg->elements[0];
if (e->type == FFI_TYPE_DOUBLE)
- flags = FFI_TYPE_DOUBLE << FFI_FLAG_BITS;
+ flags = FFI_TYPE_DOUBLE;
else if (e->type == FFI_TYPE_FLOAT)
- flags = FFI_TYPE_FLOAT << FFI_FLAG_BITS;
+ flags = FFI_TYPE_FLOAT;
if (flags && (e = arg->elements[1]))
{
if (e->type == FFI_TYPE_DOUBLE)
- flags += FFI_TYPE_DOUBLE;
+ flags += FFI_TYPE_DOUBLE << FFI_FLAG_BITS;
else if (e->type == FFI_TYPE_FLOAT)
- flags += FFI_TYPE_FLOAT;
+ flags += FFI_TYPE_FLOAT << FFI_FLAG_BITS;
else
return small;
@@ -262,7 +279,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
{
cif->flags = 0;
-#if _MIPS_SIM == _ABIO32
+#ifdef FFI_MIPS_O32
/* Set the flags necessary for O32 processing. FFI_O32_SOFT_FLOAT
* does not have special handling for floating point args.
*/
@@ -350,10 +367,11 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
}
#endif
-#if _MIPS_SIM == _ABIN32
+#ifdef FFI_MIPS_N32
/* Set the flags necessary for N32 processing */
{
- unsigned shift = 0;
+ unsigned arg_reg = 0;
+ unsigned loc = 0;
unsigned count = (cif->nargs < 8) ? cif->nargs : 8;
unsigned index = 0;
@@ -368,7 +386,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
/* This means that the structure is being passed as
a hidden argument */
- shift = FFI_FLAG_BITS;
+ arg_reg = 1;
count = (cif->nargs < 7) ? cif->nargs : 7;
cif->rstruct_flag = !0;
@@ -379,23 +397,37 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
else
cif->rstruct_flag = 0;
- while (count-- > 0)
+ while (count-- > 0 && arg_reg < 8)
{
switch ((cif->arg_types)[index]->type)
{
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
- cif->flags += ((cif->arg_types)[index]->type << shift);
- shift += FFI_FLAG_BITS;
+ cif->flags +=
+ ((cif->arg_types)[index]->type << (arg_reg * FFI_FLAG_BITS));
+ arg_reg++;
break;
+ case FFI_TYPE_LONGDOUBLE:
+ /* Align it. */
+ arg_reg = ALIGN(arg_reg, 2);
+ /* Treat it as two adjacent doubles. */
+ cif->flags +=
+ (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
+ arg_reg++;
+ cif->flags +=
+ (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS));
+ arg_reg++;
+ break;
case FFI_TYPE_STRUCT:
+ loc = arg_reg * FFI_SIZEOF_ARG;
cif->flags += calc_n32_struct_flags((cif->arg_types)[index],
- &shift);
+ &loc, &arg_reg);
break;
default:
- shift += FFI_FLAG_BITS;
+ arg_reg++;
+ break;
}
index++;
@@ -430,7 +462,13 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
case FFI_TYPE_DOUBLE:
cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 8);
break;
-
+ case FFI_TYPE_LONGDOUBLE:
+ /* Long double is returned as if it were a struct containing
+ two doubles. */
+ cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8);
+ cif->flags += (FFI_TYPE_DOUBLE + (FFI_TYPE_DOUBLE << FFI_FLAG_BITS))
+ << (4 + (FFI_FLAG_BITS * 8));
+ break;
default:
cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8);
break;
@@ -469,7 +507,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
switch (cif->abi)
{
-#if _MIPS_SIM == _ABIO32
+#ifdef FFI_MIPS_O32
case FFI_O32:
case FFI_O32_SOFT_FLOAT:
ffi_call_O32(ffi_prep_args, &ecif, cif->bytes,
@@ -477,10 +515,25 @@ void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
break;
#endif
-#if _MIPS_SIM == _ABIN32
+#ifdef FFI_MIPS_N32
case FFI_N32:
- ffi_call_N32(ffi_prep_args, &ecif, cif->bytes,
- cif->flags, ecif.rvalue, fn);
+ case FFI_N64:
+ {
+ int copy_rvalue = 0;
+ void *rvalue_copy = ecif.rvalue;
+ if (cif->rtype->type == FFI_TYPE_STRUCT && cif->rtype->size < 16)
+ {
+ /* For structures smaller than 16 bytes we clobber memory
+ in 8 byte increments. Make a copy so we don't clobber
+ the callers memory outside of the struct bounds. */
+ rvalue_copy = alloca(16);
+ copy_rvalue = 1;
+ }
+ ffi_call_N32(ffi_prep_args, &ecif, cif->bytes,
+ cif->flags, rvalue_copy, fn);
+ if (copy_rvalue)
+ memcpy(ecif.rvalue, rvalue_copy, cif->rtype->size);
+ }
break;
#endif
@@ -490,9 +543,11 @@ void ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
}
}
-#if FFI_CLOSURES /* N32 not implemented yet, FFI_CLOSURES not defined */
+#if FFI_CLOSURES
#if defined(FFI_MIPS_O32)
extern void ffi_closure_O32(void);
+#else
+extern void ffi_closure_N32(void);
#endif /* FFI_MIPS_O32 */
ffi_status
@@ -503,23 +558,58 @@ ffi_prep_closure_loc (ffi_closure *closure,
void *codeloc)
{
unsigned int *tramp = (unsigned int *) &closure->tramp[0];
- unsigned int fn;
- unsigned int ctx = (unsigned int) codeloc;
+ void * fn;
char *clear_location = (char *) codeloc;
#if defined(FFI_MIPS_O32)
FFI_ASSERT(cif->abi == FFI_O32 || cif->abi == FFI_O32_SOFT_FLOAT);
- fn = (unsigned int) ffi_closure_O32;
+ fn = ffi_closure_O32;
#else /* FFI_MIPS_N32 */
- FFI_ASSERT(cif->abi == FFI_N32);
- FFI_ASSERT(!"not implemented");
+ FFI_ASSERT(cif->abi == FFI_N32 || cif->abi == FFI_N64);
+ fn = ffi_closure_N32;
#endif /* FFI_MIPS_O32 */
- tramp[0] = 0x3c190000 | (fn >> 16); /* lui $25,high(fn) */
- tramp[1] = 0x37390000 | (fn & 0xffff); /* ori $25,low(fn) */
- tramp[2] = 0x3c080000 | (ctx >> 16); /* lui $8,high(ctx) */
- tramp[3] = 0x03200008; /* jr $25 */
- tramp[4] = 0x35080000 | (ctx & 0xffff); /* ori $8,low(ctx) */
+#if defined(FFI_MIPS_O32) || (_MIPS_SIM ==_ABIN32)
+ /* lui $25,high(fn) */
+ tramp[0] = 0x3c190000 | ((unsigned)fn >> 16);
+ /* ori $25,low(fn) */
+ tramp[1] = 0x37390000 | ((unsigned)fn & 0xffff);
+ /* lui $12,high(codeloc) */
+ tramp[2] = 0x3c0c0000 | ((unsigned)codeloc >> 16);
+ /* jr $25 */
+ tramp[3] = 0x03200008;
+ /* ori $12,low(codeloc) */
+ tramp[4] = 0x358c0000 | ((unsigned)codeloc & 0xffff);
+#else
+ /* N64 has a somewhat larger trampoline. */
+ /* lui $25,high(fn) */
+ tramp[0] = 0x3c190000 | ((unsigned long)fn >> 48);
+ /* lui $12,high(codeloc) */
+ tramp[1] = 0x3c0c0000 | ((unsigned long)codeloc >> 48);
+ /* ori $25,mid-high(fn) */
+ tramp[2] = 0x37390000 | (((unsigned long)fn >> 32 ) & 0xffff);
+ /* ori $12,mid-high(codeloc) */
+ tramp[3] = 0x358c0000 | (((unsigned long)codeloc >> 32) & 0xffff);
+ /* dsll $25,$25,16 */
+ tramp[4] = 0x0019cc38;
+ /* dsll $12,$12,16 */
+ tramp[5] = 0x000c6438;
+ /* ori $25,mid-low(fn) */
+ tramp[6] = 0x37390000 | (((unsigned long)fn >> 16 ) & 0xffff);
+ /* ori $12,mid-low(codeloc) */
+ tramp[7] = 0x358c0000 | (((unsigned long)codeloc >> 16) & 0xffff);
+ /* dsll $25,$25,16 */
+ tramp[8] = 0x0019cc38;
+ /* dsll $12,$12,16 */
+ tramp[9] = 0x000c6438;
+ /* ori $25,low(fn) */
+ tramp[10] = 0x37390000 | ((unsigned long)fn & 0xffff);
+ /* jr $25 */
+ tramp[11] = 0x03200008;
+ /* ori $12,low(codeloc) */
+ tramp[12] = 0x358c0000 | ((unsigned long)codeloc & 0xffff);
+
+#endif
closure->cif = cif;
closure->fun = fun;
@@ -567,7 +657,7 @@ ffi_closure_mips_inner_O32 (ffi_closure *closure,
if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_STRUCT)
{
- rvalue = (void *) ar[0];
+ rvalue = (void *)(UINT32)ar[0];
argn = 1;
}
@@ -645,4 +735,177 @@ ffi_closure_mips_inner_O32 (ffi_closure *closure,
}
}
+#if defined(FFI_MIPS_N32)
+
+static void
+copy_struct_N32(char *target, unsigned offset, ffi_abi abi, ffi_type *type,
+ int argn, unsigned arg_offset, ffi_arg *ar,
+ ffi_arg *fpr)
+{
+ ffi_type **elt_typep = type->elements;
+ while(*elt_typep)
+ {
+ ffi_type *elt_type = *elt_typep;
+ unsigned o;
+ char *tp;
+ char *argp;
+ char *fpp;
+
+ o = ALIGN(offset, elt_type->alignment);
+ arg_offset += o - offset;
+ offset = o;
+ argn += arg_offset / sizeof(ffi_arg);
+ arg_offset = arg_offset % sizeof(ffi_arg);
+
+ argp = (char *)(ar + argn);
+ fpp = (char *)(argn >= 8 ? ar + argn : fpr + argn);
+
+ tp = target + offset;
+
+ if (elt_type->type == FFI_TYPE_DOUBLE)
+ *(double *)tp = *(double *)fpp;
+ else
+ memcpy(tp, argp + arg_offset, elt_type->size);
+
+ offset += elt_type->size;
+ arg_offset += elt_type->size;
+ elt_typep++;
+ argn += arg_offset / sizeof(ffi_arg);
+ arg_offset = arg_offset % sizeof(ffi_arg);
+ }
+}
+
+/*
+ * Decodes the arguments to a function, which will be stored on the
+ * stack. AR is the pointer to the beginning of the integer
+ * arguments. FPR is a pointer to the area where floating point
+ * registers have been saved.
+ *
+ * RVALUE is the location where the function return value will be
+ * stored. CLOSURE is the prepared closure to invoke.
+ *
+ * This function should only be called from assembly, which is in
+ * turn called from a trampoline.
+ *
+ * Returns the function return flags.
+ *
+ */
+int
+ffi_closure_mips_inner_N32 (ffi_closure *closure,
+ void *rvalue, ffi_arg *ar,
+ ffi_arg *fpr)
+{
+ ffi_cif *cif;
+ void **avaluep;
+ ffi_arg *avalue;
+ ffi_type **arg_types;
+ int i, avn, argn;
+
+ cif = closure->cif;
+ avalue = alloca (cif->nargs * sizeof (ffi_arg));
+ avaluep = alloca (cif->nargs * sizeof (ffi_arg));
+
+ argn = 0;
+
+ if (cif->rstruct_flag)
+ {
+#if _MIPS_SIM==_ABIN32
+ rvalue = (void *)(UINT32)ar[0];
+#else /* N64 */
+ rvalue = (void *)ar[0];
+#endif
+ argn = 1;
+ }
+
+ i = 0;
+ avn = cif->nargs;
+ arg_types = cif->arg_types;
+
+ while (i < avn)
+ {
+ if (arg_types[i]->type == FFI_TYPE_FLOAT
+ || arg_types[i]->type == FFI_TYPE_DOUBLE)
+ {
+ ffi_arg *argp = argn >= 8 ? ar + argn : fpr + argn;
+#ifdef __MIPSEB__
+ if (arg_types[i]->type == FFI_TYPE_FLOAT && argn < 8)
+ avaluep[i] = ((char *) argp) + sizeof (float);
+ else
+#endif
+ avaluep[i] = (char *) argp;
+ }
+ else
+ {
+ unsigned type = arg_types[i]->type;
+
+ if (arg_types[i]->alignment > sizeof(ffi_arg))
+ argn = ALIGN(argn, arg_types[i]->alignment / sizeof(ffi_arg));
+
+ ffi_arg *argp = ar + argn;
+
+ /* The size of a pointer depends on the ABI */
+ if (type == FFI_TYPE_POINTER)
+ type = (cif->abi == FFI_N64) ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32;
+
+ switch (type)
+ {
+ case FFI_TYPE_SINT8:
+ avaluep[i] = &avalue[i];
+ *(SINT8 *) &avalue[i] = (SINT8) *argp;
+ break;
+
+ case FFI_TYPE_UINT8:
+ avaluep[i] = &avalue[i];
+ *(UINT8 *) &avalue[i] = (UINT8) *argp;
+ break;
+
+ case FFI_TYPE_SINT16:
+ avaluep[i] = &avalue[i];
+ *(SINT16 *) &avalue[i] = (SINT16) *argp;
+ break;
+
+ case FFI_TYPE_UINT16:
+ avaluep[i] = &avalue[i];
+ *(UINT16 *) &avalue[i] = (UINT16) *argp;
+ break;
+
+ case FFI_TYPE_SINT32:
+ avaluep[i] = &avalue[i];
+ *(SINT32 *) &avalue[i] = (SINT32) *argp;
+ break;
+
+ case FFI_TYPE_UINT32:
+ avaluep[i] = &avalue[i];
+ *(UINT32 *) &avalue[i] = (UINT32) *argp;
+ break;
+
+ case FFI_TYPE_STRUCT:
+ if (argn < 8)
+ {
+ /* Allocate space for the struct as at least part of
+ it was passed in registers. */
+ avaluep[i] = alloca(arg_types[i]->size);
+ copy_struct_N32(avaluep[i], 0, cif->abi, arg_types[i],
+ argn, 0, ar, fpr);
+
+ break;
+ }
+ /* Else fall through. */
+ default:
+ avaluep[i] = (char *) argp;
+ break;
+ }
+ }
+ argn += ALIGN(arg_types[i]->size, sizeof(ffi_arg)) / sizeof(ffi_arg);
+ i++;
+ }
+
+ /* Invoke the closure. */
+ (closure->fun) (cif, rvalue, avaluep, closure->user_data);
+
+ return cif->flags >> (FFI_FLAG_BITS * 8);
+}
+
+#endif /* FFI_MIPS_N32 */
+
#endif /* FFI_CLOSURES */
diff --git a/libffi/src/mips/ffitarget.h b/libffi/src/mips/ffitarget.h
index e610745698f..ccfc82b9d48 100644
--- a/libffi/src/mips/ffitarget.h
+++ b/libffi/src/mips/ffitarget.h
@@ -42,10 +42,13 @@
#ifdef FFI_MIPS_O32
/* O32 stack frames have 32bit integer args */
-#define FFI_SIZEOF_ARG 4
+# define FFI_SIZEOF_ARG 4
#else
/* N32 and N64 frames have 64bit integer args */
-#define FFI_SIZEOF_ARG 8
+# define FFI_SIZEOF_ARG 8
+# if _MIPS_SIM == _ABIN32
+# define FFI_SIZEOF_JAVA_RAW 4
+# endif
#endif
#define FFI_FLAG_BITS 2
@@ -104,19 +107,28 @@
#define ra $31
#ifdef FFI_MIPS_O32
-#define REG_L lw
-#define REG_S sw
-#define SUBU subu
-#define ADDU addu
-#define SRL srl
-#define LI li
+# define REG_L lw
+# define REG_S sw
+# define SUBU subu
+# define ADDU addu
+# define SRL srl
+# define LI li
#else /* !FFI_MIPS_O32 */
-#define REG_L ld
-#define REG_S sd
-#define SUBU dsubu
-#define ADDU daddu
-#define SRL dsrl
-#define LI dli
+# define REG_L ld
+# define REG_S sd
+# define SUBU dsubu
+# define ADDU daddu
+# define SRL dsrl
+# define LI dli
+# if (_MIPS_SIM==_ABI64)
+# define LA dla
+# define EH_FRAME_ALIGN 3
+# define FDE_ADDR_BYTES .8byte
+# else
+# define LA la
+# define EH_FRAME_ALIGN 2
+# define FDE_ADDR_BYTES .4byte
+# endif /* _MIPS_SIM==_ABI64 */
#endif /* !FFI_MIPS_O32 */
#else /* !LIBFFI_ASM */
#ifdef FFI_MIPS_O32
@@ -143,7 +155,11 @@ typedef enum ffi_abi {
FFI_DEFAULT_ABI = FFI_O32,
#endif
#else
+# if _MIPS_SIM==_ABI64
+ FFI_DEFAULT_ABI = FFI_N64,
+# else
FFI_DEFAULT_ABI = FFI_N32,
+# endif
#endif
FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
@@ -158,8 +174,13 @@ typedef enum ffi_abi {
#define FFI_CLOSURES 1
#define FFI_TRAMPOLINE_SIZE 20
#else
-/* N32/N64 not implemented yet. */
-#define FFI_CLOSURES 0
+/* N32/N64. */
+# define FFI_CLOSURES 1
+#if _MIPS_SIM==_ABI64
+#define FFI_TRAMPOLINE_SIZE 52
+#else
+#define FFI_TRAMPOLINE_SIZE 20
+#endif
#endif /* FFI_MIPS_O32 */
#define FFI_NATIVE_RAW_API 0
diff --git a/libffi/src/mips/n32.S b/libffi/src/mips/n32.S
index 358cfd7e409..2f9edb48a9b 100644
--- a/libffi/src/mips/n32.S
+++ b/libffi/src/mips/n32.S
@@ -45,13 +45,19 @@
.globl ffi_call_N32
.ent ffi_call_N32
ffi_call_N32:
+.LFB3:
+ .frame $fp, SIZEOF_FRAME, ra
+ .mask 0xc0000000,-FFI_SIZEOF_ARG
+ .fmask 0x00000000,0
# Prologue
SUBU $sp, SIZEOF_FRAME # Frame size
+.LCFI0:
REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer
REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address
+.LCFI1:
move $fp, $sp
-
+.LCFI3:
move t9, callback # callback function pointer
REG_S bytes, 2*FFI_SIZEOF_ARG($fp) # bytes
REG_S flags, 3*FFI_SIZEOF_ARG($fp) # flags
@@ -72,14 +78,12 @@ sixteen:
SUBU $sp, $sp, v0 # move the stack pointer to reflect the
# arg space
- ADDU a0, $sp, 0 # 4 * FFI_SIZEOF_ARG
+ move a0, $sp # 4 * FFI_SIZEOF_ARG
ADDU a3, $fp, 3 * FFI_SIZEOF_ARG
# Call ffi_prep_args
jal t9
- # ADDU $sp, $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
-
# Copy the stack pointer to t9
move t9, $sp
@@ -90,18 +94,16 @@ sixteen:
REG_L t6, 2*FFI_SIZEOF_ARG($fp)
# Is it bigger than 8 * FFI_SIZEOF_ARG?
- dadd t7, $0, 8 * FFI_SIZEOF_ARG
- dsub t8, t6, t7
+ daddiu t8, t6, -(8 * FFI_SIZEOF_ARG)
bltz t8, loadregs
- add t9, t9, t8
+ ADDU t9, t9, t8
loadregs:
- REG_L t4, 3*FFI_SIZEOF_ARG($fp) # load the flags word
- add t6, t4, 0 # and copy it into t6
+ REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
- and t4, ((1<<FFI_FLAG_BITS)-1)
+ and t4, t6, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg1_floatp
REG_L a0, 0*FFI_SIZEOF_ARG(t9)
b arg1_next
@@ -113,8 +115,7 @@ arg1_doublep:
l.d $f12, 0*FFI_SIZEOF_ARG(t9)
arg1_next:
- add t4, t6, 0
- SRL t4, 1*FFI_FLAG_BITS
+ SRL t4, t6, 1*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg2_floatp
REG_L a1, 1*FFI_SIZEOF_ARG(t9)
@@ -127,8 +128,7 @@ arg2_doublep:
l.d $f13, 1*FFI_SIZEOF_ARG(t9)
arg2_next:
- add t4, t6, 0
- SRL t4, 2*FFI_FLAG_BITS
+ SRL t4, t6, 2*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg3_floatp
REG_L a2, 2*FFI_SIZEOF_ARG(t9)
@@ -141,8 +141,7 @@ arg3_doublep:
l.d $f14, 2*FFI_SIZEOF_ARG(t9)
arg3_next:
- add t4, t6, 0
- SRL t4, 3*FFI_FLAG_BITS
+ SRL t4, t6, 3*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg4_floatp
REG_L a3, 3*FFI_SIZEOF_ARG(t9)
@@ -155,8 +154,7 @@ arg4_doublep:
l.d $f15, 3*FFI_SIZEOF_ARG(t9)
arg4_next:
- add t4, t6, 0
- SRL t4, 4*FFI_FLAG_BITS
+ SRL t4, t6, 4*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg5_floatp
REG_L a4, 4*FFI_SIZEOF_ARG(t9)
@@ -169,8 +167,7 @@ arg5_doublep:
l.d $f16, 4*FFI_SIZEOF_ARG(t9)
arg5_next:
- add t4, t6, 0
- SRL t4, 5*FFI_FLAG_BITS
+ SRL t4, t6, 5*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg6_floatp
REG_L a5, 5*FFI_SIZEOF_ARG(t9)
@@ -183,8 +180,7 @@ arg6_doublep:
l.d $f17, 5*FFI_SIZEOF_ARG(t9)
arg6_next:
- add t4, t6, 0
- SRL t4, 6*FFI_FLAG_BITS
+ SRL t4, t6, 6*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg7_floatp
REG_L a6, 6*FFI_SIZEOF_ARG(t9)
@@ -197,8 +193,7 @@ arg7_doublep:
l.d $f18, 6*FFI_SIZEOF_ARG(t9)
arg7_next:
- add t4, t6, 0
- SRL t4, 7*FFI_FLAG_BITS
+ SRL t4, t6, 7*FFI_FLAG_BITS
and t4, ((1<<FFI_FLAG_BITS)-1)
bnez t4, arg8_floatp
REG_L a7, 7*FFI_SIZEOF_ARG(t9)
@@ -315,6 +310,224 @@ epilogue:
ADDU $sp, SIZEOF_FRAME # Fix stack pointer
j ra
+.LFE3:
.end ffi_call_N32
+
+/* ffi_closure_N32. Expects address of the passed-in ffi_closure in t0
+ ($12). Stores any arguments passed in registers onto the stack,
+ then calls ffi_closure_mips_inner_N32, which then decodes
+ them.
+
+ Stack layout:
+
+ 20 - Start of parameters, original sp
+ 19 - Called function a7 save
+ 18 - Called function a6 save
+ 17 - Called function a5 save
+ 16 - Called function a4 save
+ 15 - Called function a3 save
+ 14 - Called function a2 save
+ 13 - Called function a1 save
+ 12 - Called function a0 save
+ 11 - Called function f19
+ 10 - Called function f18
+ 9 - Called function f17
+ 8 - Called function f16
+ 7 - Called function f15
+ 6 - Called function f14
+ 5 - Called function f13
+ 4 - Called function f12
+ 3 - return value high (v1 or $f2)
+ 2 - return value low (v0 or $f0)
+ 1 - ra save
+ 0 - gp save our sp points here
+ */
+
+#define SIZEOF_FRAME2 (20 * FFI_SIZEOF_ARG)
+
+#define A7_OFF2 (19 * FFI_SIZEOF_ARG)
+#define A6_OFF2 (18 * FFI_SIZEOF_ARG)
+#define A5_OFF2 (17 * FFI_SIZEOF_ARG)
+#define A4_OFF2 (16 * FFI_SIZEOF_ARG)
+#define A3_OFF2 (15 * FFI_SIZEOF_ARG)
+#define A2_OFF2 (14 * FFI_SIZEOF_ARG)
+#define A1_OFF2 (13 * FFI_SIZEOF_ARG)
+#define A0_OFF2 (12 * FFI_SIZEOF_ARG)
+
+#define F19_OFF2 (11 * FFI_SIZEOF_ARG)
+#define F18_OFF2 (10 * FFI_SIZEOF_ARG)
+#define F17_OFF2 (9 * FFI_SIZEOF_ARG)
+#define F16_OFF2 (8 * FFI_SIZEOF_ARG)
+#define F15_OFF2 (7 * FFI_SIZEOF_ARG)
+#define F14_OFF2 (6 * FFI_SIZEOF_ARG)
+#define F13_OFF2 (5 * FFI_SIZEOF_ARG)
+#define F12_OFF2 (4 * FFI_SIZEOF_ARG)
+
+#define V1_OFF2 (3 * FFI_SIZEOF_ARG)
+#define V0_OFF2 (2 * FFI_SIZEOF_ARG)
+
+#define RA_OFF2 (1 * FFI_SIZEOF_ARG)
+#define GP_OFF2 (0 * FFI_SIZEOF_ARG)
+
+ .align 2
+ .globl ffi_closure_N32
+ .ent ffi_closure_N32
+ffi_closure_N32:
+.LFB2:
+ .frame $sp, SIZEOF_FRAME2, ra
+ .mask 0x90000000,-(SIZEOF_FRAME2 - RA_OFF2)
+ .fmask 0x00000000,0
+ SUBU $sp, SIZEOF_FRAME2
+.LCFI5:
+ .cpsetup t9, GP_OFF2, ffi_closure_N32
+ REG_S ra, RA_OFF2($sp) # Save return address
+.LCFI6:
+ # Store all possible argument registers. If there are more than
+ # fit in registers, then they were stored on the stack.
+ REG_S a0, A0_OFF2($sp)
+ REG_S a1, A1_OFF2($sp)
+ REG_S a2, A2_OFF2($sp)
+ REG_S a3, A3_OFF2($sp)
+ REG_S a4, A4_OFF2($sp)
+ REG_S a5, A5_OFF2($sp)
+ REG_S a6, A6_OFF2($sp)
+ REG_S a7, A7_OFF2($sp)
+
+ # Store all possible float/double registers.
+ s.d $f12, F12_OFF2($sp)
+ s.d $f13, F13_OFF2($sp)
+ s.d $f14, F14_OFF2($sp)
+ s.d $f15, F15_OFF2($sp)
+ s.d $f16, F16_OFF2($sp)
+ s.d $f17, F17_OFF2($sp)
+ s.d $f18, F18_OFF2($sp)
+ s.d $f19, F19_OFF2($sp)
+
+ # Call ffi_closure_mips_inner_N32 to do the real work.
+ LA t9, ffi_closure_mips_inner_N32
+ move a0, $12 # Pointer to the ffi_closure
+ ADDU a1, $sp, V0_OFF2
+ ADDU a2, $sp, A0_OFF2
+ ADDU a3, $sp, F12_OFF2
+ jalr t9
+
+ # Return flags are in v0
+ bne v0, FFI_TYPE_INT, cls_retfloat
+ REG_L v0, V0_OFF2($sp)
+ b cls_epilogue
+
+cls_retfloat:
+ bne v0, FFI_TYPE_FLOAT, cls_retdouble
+ l.s $f0, V0_OFF2($sp)
+ b cls_epilogue
+
+cls_retdouble:
+ bne v0, FFI_TYPE_DOUBLE, cls_retstruct_d
+ l.d $f0, V0_OFF2($sp)
+ b cls_epilogue
+
+cls_retstruct_d:
+ bne v0, FFI_TYPE_STRUCT_D, cls_retstruct_f
+ l.d $f0, V0_OFF2($sp)
+ b cls_epilogue
+
+cls_retstruct_f:
+ bne v0, FFI_TYPE_STRUCT_F, cls_retstruct_d_d
+ l.s $f0, V0_OFF2($sp)
+ b cls_epilogue
+
+cls_retstruct_d_d:
+ bne v0, FFI_TYPE_STRUCT_DD, cls_retstruct_f_f
+ l.d $f0, V0_OFF2($sp)
+ l.d $f2, V1_OFF2($sp)
+ b cls_epilogue
+
+cls_retstruct_f_f:
+ bne v0, FFI_TYPE_STRUCT_FF, cls_retstruct_d_f
+ l.s $f0, V0_OFF2($sp)
+ l.s $f2, V1_OFF2($sp)
+ b cls_epilogue
+
+cls_retstruct_d_f:
+ bne v0, FFI_TYPE_STRUCT_DF, cls_retstruct_f_d
+ l.d $f0, V0_OFF2($sp)
+ l.s $f2, V1_OFF2($sp)
+ b cls_epilogue
+
+cls_retstruct_f_d:
+ bne v0, FFI_TYPE_STRUCT_FD, cls_retstruct_small2
+ l.s $f0, V0_OFF2($sp)
+ l.d $f2, V1_OFF2($sp)
+ b cls_epilogue
+
+cls_retstruct_small2:
+ REG_L v0, V0_OFF2($sp)
+ REG_L v1, V1_OFF2($sp)
+
+ # Epilogue
+cls_epilogue:
+ REG_L ra, RA_OFF2($sp) # Restore return address
+ .cpreturn
+ ADDU $sp, SIZEOF_FRAME2
+ j ra
+.LFE2:
+ .end ffi_closure_N32
+
+ .section .eh_frame,"aw",@progbits
+.Lframe1:
+ .4byte .LECIE1-.LSCIE1 # length
+.LSCIE1:
+ .4byte 0x0 # CIE
+ .byte 0x1 # Version 1
+ .ascii "\000" # Augmentation
+ .uleb128 0x1 # Code alignment 1
+ .sleb128 -4 # Data alignment -4
+ .byte 0x1f # Return Address $31
+ .byte 0xc # DW_CFA_def_cfa
+ .uleb128 0x1d # in $sp
+ .uleb128 0x0 # offset 0
+ .align EH_FRAME_ALIGN
+.LECIE1:
+
+.LSFDE1:
+ .4byte .LEFDE1-.LASFDE1 # length.
+.LASFDE1:
+ .4byte .LASFDE1-.Lframe1 # CIE_pointer.
+ FDE_ADDR_BYTES .LFB3 # initial_location.
+ FDE_ADDR_BYTES .LFE3-.LFB3 # address_range.
+ .byte 0x4 # DW_CFA_advance_loc4
+ .4byte .LCFI0-.LFB3 # to .LCFI0
+ .byte 0xe # DW_CFA_def_cfa_offset
+ .uleb128 SIZEOF_FRAME # adjust stack.by SIZEOF_FRAME
+ .byte 0x4 # DW_CFA_advance_loc4
+ .4byte .LCFI1-.LCFI0 # to .LCFI1
+ .byte 0x9e # DW_CFA_offset of $fp
+ .uleb128 2*FFI_SIZEOF_ARG/4 #
+ .byte 0x9f # DW_CFA_offset of ra
+ .uleb128 1*FFI_SIZEOF_ARG/4 #
+ .byte 0x4 # DW_CFA_advance_loc4
+ .4byte .LCFI3-.LCFI1 # to .LCFI3
+ .byte 0xd # DW_CFA_def_cfa_register
+ .uleb128 0x1e # in $fp
+ .align EH_FRAME_ALIGN
+.LEFDE1:
+.LSFDE3:
+ .4byte .LEFDE3-.LASFDE3 # length
+.LASFDE3:
+ .4byte .LASFDE3-.Lframe1 # CIE_pointer.
+ FDE_ADDR_BYTES .LFB2 # initial_location.
+ FDE_ADDR_BYTES .LFE2-.LFB2 # address_range.
+ .byte 0x4 # DW_CFA_advance_loc4
+ .4byte .LCFI5-.LFB2 # to .LCFI5
+ .byte 0xe # DW_CFA_def_cfa_offset
+ .uleb128 SIZEOF_FRAME2 # adjust stack.by SIZEOF_FRAME
+ .byte 0x4 # DW_CFA_advance_loc4
+ .4byte .LCFI6-.LCFI5 # to .LCFI6
+ .byte 0x9c # DW_CFA_offset of $gp ($28)
+ .uleb128 (SIZEOF_FRAME2 - GP_OFF2)/4
+ .byte 0x9f # DW_CFA_offset of ra ($31)
+ .uleb128 (SIZEOF_FRAME2 - RA_OFF2)/4
+ .align EH_FRAME_ALIGN
+.LEFDE3:
#endif
diff --git a/libffi/src/mips/o32.S b/libffi/src/mips/o32.S
index 63f3d146357..f6363cb6c54 100644
--- a/libffi/src/mips/o32.S
+++ b/libffi/src/mips/o32.S
@@ -183,27 +183,30 @@ $LFE0:
/* ffi_closure_O32. Expects address of the passed-in ffi_closure
- in t0. Stores any arguments passed in registers onto the
+ in t4 ($12). Stores any arguments passed in registers onto the
stack, then calls ffi_closure_mips_inner_O32, which
then decodes them.
Stack layout:
- 14 - Start of parameters, original sp
- 13 - ra save
- 12 - fp save
- 11 - $16 (s0) save
- 10 - cprestore
- 9 - return value high (v1)
- 8 - return value low (v0)
- 7 - f14 (le high, be low)
- 6 - f14 (le low, be high)
- 5 - f12 (le high, be low)
- 4 - f12 (le low, be high)
- 3 - Called function a3 save
- 2 - Called function a2 save
- 1 - Called function a1 save
- 0 - Called function a0 save our sp, fp point here
+ 3 - a3 save
+ 2 - a2 save
+ 1 - a1 save
+ 0 - a0 save, original sp
+ -1 - ra save
+ -2 - fp save
+ -3 - $16 (s0) save
+ -4 - cprestore
+ -5 - return value high (v1)
+ -6 - return value low (v0)
+ -7 - f14 (le high, be low)
+ -8 - f14 (le low, be high)
+ -9 - f12 (le high, be low)
+ -10 - f12 (le low, be high)
+ -11 - Called function a3 save
+ -12 - Called function a2 save
+ -13 - Called function a1 save
+ -14 - Called function a0 save, our sp and fp point here
*/
#define SIZEOF_FRAME2 (14 * FFI_SIZEOF_ARG)
@@ -251,7 +254,7 @@ $LCFI7:
REG_S a3, A3_OFF2($fp)
# Load ABI enum to s0
- REG_L $16, 20($8) # cif pointer follows tramp.
+ REG_L $16, 20($12) # cif pointer follows tramp.
REG_L $16, 0($16) # abi is first member.
li $13, 1 # FFI_O32
@@ -263,7 +266,7 @@ $LCFI7:
1:
# Call ffi_closure_mips_inner_O32 to do the work.
la t9, ffi_closure_mips_inner_O32
- move a0, $8 # Pointer to the ffi_closure
+ move a0, $12 # Pointer to the ffi_closure
addu a1, $fp, V0_OFF2
addu a2, $fp, A0_OFF2
addu a3, $fp, FA_0_0_OFF2
diff --git a/libffi/src/powerpc/ffi.c b/libffi/src/powerpc/ffi.c
index fe5550d5889..e6b869f8737 100644
--- a/libffi/src/powerpc/ffi.c
+++ b/libffi/src/powerpc/ffi.c
@@ -40,7 +40,8 @@ enum {
FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */
FLAG_RETURNS_FP = 1 << (31-29),
FLAG_RETURNS_64BITS = 1 << (31-28),
- FLAG_RETURNS_128BITS = 1 << (31-27),
+
+ FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */
FLAG_ARG_NEEDS_COPY = 1 << (31- 7),
FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */
@@ -49,10 +50,13 @@ enum {
};
/* About the SYSV ABI. */
-enum {
- NUM_GPR_ARG_REGISTERS = 8,
- NUM_FPR_ARG_REGISTERS = 8
-};
+unsigned int NUM_GPR_ARG_REGISTERS = 8;
+#ifndef __NO_FPRS__
+unsigned int NUM_FPR_ARG_REGISTERS = 8;
+#else
+unsigned int NUM_FPR_ARG_REGISTERS = 0;
+#endif
+
enum { ASM_NEEDS_REGISTERS = 4 };
/* ffi_prep_args_SYSV is called by the assembly routine once stack space
@@ -115,7 +119,7 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
/* 'next_arg' grows up as we put parameters in it. */
valp next_arg;
- int i;
+ int i, ii MAYBE_UNUSED;
ffi_type **ptr;
double double_tmp;
union {
@@ -133,6 +137,9 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
size_t struct_copy_size;
unsigned gprvalue;
+ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT)
+ NUM_FPR_ARG_REGISTERS = 0;
+
stacktop.c = (char *) stack + bytes;
gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS;
intarg_count = 0;
@@ -164,6 +171,9 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
switch ((*ptr)->type)
{
case FFI_TYPE_FLOAT:
+ /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */
+ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT)
+ goto soft_float_prep;
double_tmp = **p_argv.f;
if (fparg_count >= NUM_FPR_ARG_REGISTERS)
{
@@ -177,6 +187,9 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
break;
case FFI_TYPE_DOUBLE:
+ /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */
+ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT)
+ goto soft_double_prep;
double_tmp = **p_argv.d;
if (fparg_count >= NUM_FPR_ARG_REGISTERS)
@@ -198,38 +211,75 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
- if (ecif->cif->abi != FFI_LINUX)
+ if ((ecif->cif->abi != FFI_LINUX)
+ && (ecif->cif->abi != FFI_LINUX_SOFT_FLOAT))
goto do_struct;
- double_tmp = (*p_argv.d)[0];
-
- if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1)
+ /* The soft float ABI for long doubles works like this,
+ a long double is passed in four consecutive gprs if available.
+ A maximum of 2 long doubles can be passed in gprs.
+ If we do not have 4 gprs left, the long double is passed on the
+ stack, 4-byte aligned. */
+ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT)
{
- if (intarg_count >= NUM_GPR_ARG_REGISTERS
- && intarg_count % 2 != 0)
+ unsigned int int_tmp = (*p_argv.ui)[0];
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3)
{
- intarg_count++;
+ if (intarg_count < NUM_GPR_ARG_REGISTERS)
+ intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count;
+ *next_arg.u = int_tmp;
next_arg.u++;
+ for (ii = 1; ii < 4; ii++)
+ {
+ int_tmp = (*p_argv.ui)[ii];
+ *next_arg.u = int_tmp;
+ next_arg.u++;
+ }
}
- *next_arg.d = double_tmp;
- next_arg.u += 2;
- double_tmp = (*p_argv.d)[1];
- *next_arg.d = double_tmp;
- next_arg.u += 2;
+ else
+ {
+ *gpr_base.u++ = int_tmp;
+ for (ii = 1; ii < 4; ii++)
+ {
+ int_tmp = (*p_argv.ui)[ii];
+ *gpr_base.u++ = int_tmp;
+ }
+ }
+ intarg_count +=4;
}
else
{
- *fpr_base.d++ = double_tmp;
- double_tmp = (*p_argv.d)[1];
- *fpr_base.d++ = double_tmp;
- }
+ double_tmp = (*p_argv.d)[0];
- fparg_count += 2;
- FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
+ if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1)
+ {
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS
+ && intarg_count % 2 != 0)
+ {
+ intarg_count++;
+ next_arg.u++;
+ }
+ *next_arg.d = double_tmp;
+ next_arg.u += 2;
+ double_tmp = (*p_argv.d)[1];
+ *next_arg.d = double_tmp;
+ next_arg.u += 2;
+ }
+ else
+ {
+ *fpr_base.d++ = double_tmp;
+ double_tmp = (*p_argv.d)[1];
+ *fpr_base.d++ = double_tmp;
+ }
+
+ fparg_count += 2;
+ FFI_ASSERT (flags & FLAG_FP_ARGUMENTS);
+ }
break;
#endif
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
+ soft_double_prep:
if (intarg_count == NUM_GPR_ARG_REGISTERS-1)
intarg_count++;
if (intarg_count >= NUM_GPR_ARG_REGISTERS)
@@ -292,6 +342,8 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
case FFI_TYPE_UINT32:
case FFI_TYPE_SINT32:
case FFI_TYPE_POINTER:
+ soft_float_prep:
+
gprvalue = **p_argv.ui;
putgpr:
@@ -545,6 +597,9 @@ ffi_prep_cif_machdep (ffi_cif *cif)
unsigned type = cif->rtype->type;
unsigned size = cif->rtype->size;
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT)
+ NUM_FPR_ARG_REGISTERS = 0;
+
if (cif->abi != FFI_LINUX64)
{
/* All the machine-independent calculation of cif->bytes will be wrong.
@@ -581,14 +636,16 @@ ffi_prep_cif_machdep (ffi_cif *cif)
For LINUX64:
- integer values in gpr3;
- Structures/Unions by reference;
- - Single/double FP values in fpr1, long double in fpr1,fpr2. */
+ - Single/double FP values in fpr1, long double in fpr1,fpr2.
+ - soft-float float/doubles are treated as UINT32/UINT64 respectivley.
+ - soft-float long doubles are returned in gpr3-gpr6. */
switch (type)
{
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
- if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64)
+ if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64
+ && cif->abi != FFI_LINUX_SOFT_FLOAT)
goto byref;
-
flags |= FLAG_RETURNS_128BITS;
/* Fall through. */
#endif
@@ -596,7 +653,9 @@ ffi_prep_cif_machdep (ffi_cif *cif)
flags |= FLAG_RETURNS_64BITS;
/* Fall through. */
case FFI_TYPE_FLOAT:
- flags |= FLAG_RETURNS_FP;
+ /* With FFI_LINUX_SOFT_FLOAT no fp registers are used. */
+ if (cif->abi != FFI_LINUX_SOFT_FLOAT)
+ flags |= FLAG_RETURNS_FP;
break;
case FFI_TYPE_UINT64:
@@ -659,18 +718,36 @@ ffi_prep_cif_machdep (ffi_cif *cif)
switch ((*ptr)->type)
{
case FFI_TYPE_FLOAT:
+ /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT)
+ goto soft_float_cif;
fparg_count++;
/* floating singles are not 8-aligned on stack */
break;
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
- if (cif->abi != FFI_LINUX)
+ if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT)
goto do_struct;
- fparg_count++;
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT)
+ {
+ if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3
+ || intarg_count < NUM_GPR_ARG_REGISTERS)
+ /* A long double in FFI_LINUX_SOFT_FLOAT can use only
+ a set of four consecutive gprs. If we have not enough,
+ we have to adjust the intarg_count value. */
+ intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count;
+ intarg_count += 4;
+ break;
+ }
+ else
+ fparg_count++;
/* Fall thru */
#endif
case FFI_TYPE_DOUBLE:
+ /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT)
+ goto soft_double_cif;
fparg_count++;
/* If this FP arg is going on the stack, it must be
8-byte-aligned. */
@@ -682,6 +759,7 @@ ffi_prep_cif_machdep (ffi_cif *cif)
case FFI_TYPE_UINT64:
case FFI_TYPE_SINT64:
+ soft_double_cif:
/* 'long long' arguments are passed as two words, but
either both words must fit in registers or both go
on the stack. If they go on the stack, they must
@@ -709,6 +787,7 @@ ffi_prep_cif_machdep (ffi_cif *cif)
/* Fall through (allocate space for the pointer). */
default:
+ soft_float_cif:
/* Everything else is passed as a 4-byte word in a GPR, either
the object itself or a pointer to it. */
intarg_count++;
@@ -722,8 +801,13 @@ ffi_prep_cif_machdep (ffi_cif *cif)
{
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
- fparg_count += 2;
- intarg_count += 2;
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT)
+ intarg_count += 4;
+ else
+ {
+ fparg_count += 2;
+ intarg_count += 2;
+ }
break;
#endif
case FFI_TYPE_FLOAT:
@@ -817,6 +901,7 @@ ffi_call(ffi_cif *cif, void (*fn)(), void *rvalue, void **avalue)
case FFI_SYSV:
case FFI_GCC_SYSV:
case FFI_LINUX:
+ case FFI_LINUX_SOFT_FLOAT:
ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn);
break;
#else
@@ -941,7 +1026,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
&& !((cif->abi == FFI_SYSV) && (size <= 8)))
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|| (cif->rtype->type == FFI_TYPE_LONGDOUBLE
- && cif->abi != FFI_LINUX)
+ && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT)
#endif
)
{
@@ -994,6 +1079,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
case FFI_TYPE_SINT32:
case FFI_TYPE_UINT32:
case FFI_TYPE_POINTER:
+ soft_float_closure:
/* there are 8 gpr registers used to pass values */
if (ng < 8)
{
@@ -1029,6 +1115,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
case FFI_TYPE_SINT64:
case FFI_TYPE_UINT64:
+ soft_double_closure:
/* passing long long ints are complex, they must
* be passed in suitable register pairs such as
* (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10)
@@ -1060,6 +1147,9 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
break;
case FFI_TYPE_FLOAT:
+ /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT)
+ goto soft_float_closure;
/* unfortunately float values are stored as doubles
* in the ffi_closure_SYSV code (since we don't check
* the type in that routine).
@@ -1088,6 +1178,9 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
break;
case FFI_TYPE_DOUBLE:
+ /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT)
+ goto soft_double_closure;
/* On the outgoing stack all values are aligned to 8 */
/* there are 8 64bit floating point registers */
@@ -1108,9 +1201,24 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
case FFI_TYPE_LONGDOUBLE:
- if (cif->abi != FFI_LINUX)
+ if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT)
goto do_struct;
-
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT)
+ { /* Test if for the whole long double, 4 gprs are available.
+ otherwise the stuff ends up on the stack. */
+ if (ng < 5)
+ {
+ avalue[i] = pgr;
+ pgr += 4;
+ ng += 4;
+ }
+ else
+ {
+ avalue[i] = pst;
+ pst += 4;
+ }
+ break;
+ }
if (nf < 7)
{
avalue[i] = pfr;
@@ -1146,10 +1254,34 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
return FFI_SYSV_TYPE_SMALL_STRUCT + size;
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
else if (cif->rtype->type == FFI_TYPE_LONGDOUBLE
- && cif->abi != FFI_LINUX)
+ && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT)
return FFI_TYPE_STRUCT;
#endif
- return cif->rtype->type;
+ /* With FFI_LINUX_SOFT_FLOAT floats and doubles are handled like UINT32
+ respectivley UINT64. */
+ if (cif->abi == FFI_LINUX_SOFT_FLOAT)
+ {
+ switch (cif->rtype->type)
+ {
+ case FFI_TYPE_FLOAT:
+ return FFI_TYPE_UINT32;
+ break;
+ case FFI_TYPE_DOUBLE:
+ return FFI_TYPE_UINT64;
+ break;
+#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
+ case FFI_TYPE_LONGDOUBLE:
+ return FFI_TYPE_UINT128;
+ break;
+#endif
+ default:
+ return cif->rtype->type;
+ }
+ }
+ else
+ {
+ return cif->rtype->type;
+ }
}
int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *,
diff --git a/libffi/src/powerpc/ffitarget.h b/libffi/src/powerpc/ffitarget.h
index e7f62950371..e3fa30be6b5 100644
--- a/libffi/src/powerpc/ffitarget.h
+++ b/libffi/src/powerpc/ffitarget.h
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
+ Copyright (C) 2007 Free Software Foundation, Inc
Target configuration macros for PowerPC.
Permission is hereby granted, free of charge, to any person obtaining
@@ -44,13 +45,18 @@ typedef enum ffi_abi {
FFI_GCC_SYSV,
FFI_LINUX64,
FFI_LINUX,
+ FFI_LINUX_SOFT_FLOAT,
# ifdef POWERPC64
FFI_DEFAULT_ABI = FFI_LINUX64,
# else
-# if __LDBL_MANT_DIG__ == 106
+# if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106))
FFI_DEFAULT_ABI = FFI_LINUX,
# else
+# ifdef __NO_FPRS__
+ FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT,
+# else
FFI_DEFAULT_ABI = FFI_GCC_SYSV,
+# endif
# endif
# endif
#endif
@@ -83,8 +89,14 @@ typedef enum ffi_abi {
#define FFI_CLOSURES 1
#define FFI_NATIVE_RAW_API 0
+/* For additional types like the below, take care about the order in
+ ppc_closures.S. They must follow after the FFI_TYPE_LAST. */
+
+/* Needed for soft-float long-double-128 support. */
+#define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1)
+
/* Needed for FFI_SYSV small structure returns. */
-#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST)
+#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2)
#if defined(POWERPC64) || defined(POWERPC_AIX)
#define FFI_TRAMPOLINE_SIZE 24
diff --git a/libffi/src/powerpc/linux64.S b/libffi/src/powerpc/linux64.S
index dbfcc7b8f3d..2cfebbf1c57 100644
--- a/libffi/src/powerpc/linux64.S
+++ b/libffi/src/powerpc/linux64.S
@@ -125,6 +125,7 @@ ffi_call_LINUX64:
.Lfp_return_value:
bf 28, .Lfloat_return_value
stfd %f1, 0(%r30)
+ mtcrf 0x02, %r31 /* cr6 */
bf 27, .Ldone_return_value
stfd %f2, 8(%r30)
b .Ldone_return_value
diff --git a/libffi/src/powerpc/ppc_closure.S b/libffi/src/powerpc/ppc_closure.S
index 356a0e32620..c9f5742f5aa 100644
--- a/libffi/src/powerpc/ppc_closure.S
+++ b/libffi/src/powerpc/ppc_closure.S
@@ -28,6 +28,7 @@ ENTRY(ffi_closure_SYSV)
stw %r9, 40(%r1)
stw %r10,44(%r1)
+#ifndef __NO_FPRS__
# next save fpr 1 to fpr 8 (aligned to 8)
stfd %f1, 48(%r1)
stfd %f2, 56(%r1)
@@ -37,6 +38,7 @@ ENTRY(ffi_closure_SYSV)
stfd %f6, 88(%r1)
stfd %f7, 96(%r1)
stfd %f8, 104(%r1)
+#endif
# set up registers for the routine that actually does the work
# get the context pointer from the trampoline
@@ -171,6 +173,12 @@ ENTRY(ffi_closure_SYSV)
addi %r1,%r1,144
blr
+# case FFI_TYPE_UINT128
+ lwz %r3,112+0(%r1)
+ lwz %r4,112+4(%r1)
+ lwz %r5,112+8(%r1)
+ bl .Luint128
+
# The return types below are only used when the ABI type is FFI_SYSV.
# case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct.
lbz %r3,112+0(%r1)
@@ -230,6 +238,12 @@ ENTRY(ffi_closure_SYSV)
addi %r1,%r1,144
blr
+.Luint128:
+ lwz %r6,112+12(%r1)
+ mtlr %r0
+ addi %r1,%r1,144
+ blr
+
END(ffi_closure_SYSV)
.section ".eh_frame",EH_FRAME_FLAGS,@progbits
diff --git a/libffi/src/powerpc/sysv.S b/libffi/src/powerpc/sysv.S
index 9a9a109d1ae..21367145eb9 100644
--- a/libffi/src/powerpc/sysv.S
+++ b/libffi/src/powerpc/sysv.S
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------
- sysv.h - Copyright (c) 1998 Geoffrey Keating
+ sysv.S - Copyright (c) 1998 Geoffrey Keating
+ Copyright (C) 2007 Free Software Foundation, Inc
PowerPC Assembly glue.
@@ -98,13 +99,17 @@ ENTRY(ffi_call_SYSV)
bctrl
/* Now, deal with the return value. */
- mtcrf 0x01,%r31
+ mtcrf 0x01,%r31 /* cr7 */
bt- 31,L(small_struct_return_value)
bt- 30,L(done_return_value)
bt- 29,L(fp_return_value)
stw %r3,0(%r30)
bf+ 28,L(done_return_value)
stw %r4,4(%r30)
+ mtcrf 0x02,%r31 /* cr6 */
+ bf 27,L(done_return_value)
+ stw %r5,8(%r30)
+ stw %r6,12(%r30)
/* Fall through... */
L(done_return_value):
@@ -121,6 +126,7 @@ L(done_return_value):
L(fp_return_value):
bf 28,L(float_return_value)
stfd %f1,0(%r30)
+ mtcrf 0x02,%r31 /* cr6 */
bf 27,L(done_return_value)
stfd %f2,8(%r30)
b L(done_return_value)
diff --git a/libffi/src/x86/darwin.S b/libffi/src/x86/darwin.S
index aec9b8212a7..eeee8020383 100644
--- a/libffi/src/x86/darwin.S
+++ b/libffi/src/x86/darwin.S
@@ -1,7 +1,8 @@
/* -----------------------------------------------------------------------
- sysv.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc.
-
- X86 Foreign Function Interface
+ darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ X86 Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -60,16 +61,15 @@ _ffi_call_SYSV:
call *28(%ebp)
- /* Remove the space we pushed for the args */
- movl 16(%ebp),%ecx
- addl %ecx,%esp
-
/* Load %ecx with the return type code */
movl 20(%ebp),%ecx
+ /* Protect %esi. We're going to pop it in the epilogue. */
+ pushl %esi
+
/* If the return value pointer is NULL, assume no return value. */
cmpl $0,24(%ebp)
- jne retint
+ jne 0f
/* Even if there is no space for the return value, we are
obliged to handle floating-point values. */
@@ -77,79 +77,102 @@ _ffi_call_SYSV:
jne noretval
fstp %st(0)
- jmp epilogue
-
-retint:
- cmpl $FFI_TYPE_INT,%ecx
- jne retfloat
- /* Load %ecx with the pointer to storage for the return value */
- movl 24(%ebp),%ecx
- movl %eax,0(%ecx)
jmp epilogue
+0:
+ .align 4
+ call 1f
+.Lstore_table:
+ .long noretval-.Lstore_table /* FFI_TYPE_VOID */
+ .long retint-.Lstore_table /* FFI_TYPE_INT */
+ .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */
+ .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */
+ .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */
+ .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */
+ .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */
+ .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */
+ .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */
+ .long retint-.Lstore_table /* FFI_TYPE_UINT32 */
+ .long retint-.Lstore_table /* FFI_TYPE_SINT32 */
+ .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */
+ .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */
+ .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */
+ .long retint-.Lstore_table /* FFI_TYPE_POINTER */
+ .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */
+ .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */
+1:
+ pop %esi
+ add (%esi, %ecx, 4), %esi
+ jmp *%esi
+
+ /* Sign/zero extend as appropriate. */
+retsint8:
+ movsbl %al, %eax
+ jmp retint
+
+retsint16:
+ movswl %ax, %eax
+ jmp retint
+
+retuint8:
+ movzbl %al, %eax
+ jmp retint
+
+retuint16:
+ movzwl %ax, %eax
+ jmp retint
retfloat:
- cmpl $FFI_TYPE_FLOAT,%ecx
- jne retdouble
/* Load %ecx with the pointer to storage for the return value */
- movl 24(%ebp),%ecx
+ movl 24(%ebp),%ecx
fstps (%ecx)
jmp epilogue
retdouble:
- cmpl $FFI_TYPE_DOUBLE,%ecx
- jne retlongdouble
/* Load %ecx with the pointer to storage for the return value */
- movl 24(%ebp),%ecx
+ movl 24(%ebp),%ecx
fstpl (%ecx)
jmp epilogue
retlongdouble:
- cmpl $FFI_TYPE_LONGDOUBLE,%ecx
- jne retint64
/* Load %ecx with the pointer to storage for the return value */
- movl 24(%ebp),%ecx
+ movl 24(%ebp),%ecx
fstpt (%ecx)
jmp epilogue
-
-retint64:
- cmpl $FFI_TYPE_SINT64,%ecx
- jne retstruct1b
+
+retint64:
/* Load %ecx with the pointer to storage for the return value */
- movl 24(%ebp),%ecx
+ movl 24(%ebp),%ecx
movl %eax,0(%ecx)
movl %edx,4(%ecx)
jmp epilogue
-
-retstruct1b:
- cmpl $FFI_TYPE_SINT8,%ecx
- jne retstruct2b
+
+retstruct1b:
/* Load %ecx with the pointer to storage for the return value */
- movl 24(%ebp),%ecx
+ movl 24(%ebp),%ecx
movb %al,0(%ecx)
jmp epilogue
-retstruct2b:
- cmpl $FFI_TYPE_SINT16,%ecx
- jne retstruct
+retstruct2b:
/* Load %ecx with the pointer to storage for the return value */
- movl 24(%ebp),%ecx
+ movl 24(%ebp),%ecx
movw %ax,0(%ecx)
jmp epilogue
+retint:
+ /* Load %ecx with the pointer to storage for the return value */
+ movl 24(%ebp),%ecx
+ movl %eax,0(%ecx)
+
retstruct:
- cmpl $FFI_TYPE_STRUCT,%ecx
- jne noretval
/* Nothing to do! */
- addl $4,%esp
- popl %ebp
- ret
noretval:
epilogue:
- addl $8,%esp
- movl %ebp,%esp
- popl %ebp
- ret
+ popl %esi
+ movl %ebp,%esp
+ popl %ebp
+ ret
+
.LFE1:
.ffi_call_SYSV_end:
@@ -177,7 +200,15 @@ _ffi_closure_SYSV:
movl -12(%ebp), %ecx
cmpl $FFI_TYPE_INT, %eax
je .Lcls_retint
- cmpl $FFI_TYPE_FLOAT, %eax
+
+ /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16,
+ FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */
+ cmpl $FFI_TYPE_UINT64, %eax
+ jge 0f
+ cmpl $FFI_TYPE_UINT8, %eax
+ jge .Lcls_retint
+
+0: cmpl $FFI_TYPE_FLOAT, %eax
je .Lcls_retfloat
cmpl $FFI_TYPE_DOUBLE, %eax
je .Lcls_retdouble
@@ -185,10 +216,10 @@ _ffi_closure_SYSV:
je .Lcls_retldouble
cmpl $FFI_TYPE_SINT64, %eax
je .Lcls_retllong
- cmpl $FFI_TYPE_SINT8, %eax
- je .Lcls_retstruct1
- cmpl $FFI_TYPE_SINT16, %eax
- je .Lcls_retstruct2
+ cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax
+ je .Lcls_retstruct1b
+ cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax
+ je .Lcls_retstruct2b
cmpl $FFI_TYPE_STRUCT, %eax
je .Lcls_retstruct
.Lcls_epilogue:
@@ -211,10 +242,10 @@ _ffi_closure_SYSV:
movl (%ecx), %eax
movl 4(%ecx), %edx
jmp .Lcls_epilogue
-.Lcls_retstruct1:
+.Lcls_retstruct1b:
movsbl (%ecx), %eax
jmp .Lcls_epilogue
-.Lcls_retstruct2:
+.Lcls_retstruct2b:
movswl (%ecx), %eax
jmp .Lcls_epilogue
.Lcls_retstruct:
@@ -256,6 +287,14 @@ _ffi_closure_raw_SYSV:
movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */
cmpl $FFI_TYPE_INT, %eax
je .Lrcls_retint
+
+ /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16,
+ FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */
+ cmpl $FFI_TYPE_UINT64, %eax
+ jge 0f
+ cmpl $FFI_TYPE_UINT8, %eax
+ jge .Lrcls_retint
+0:
cmpl $FFI_TYPE_FLOAT, %eax
je .Lrcls_retfloat
cmpl $FFI_TYPE_DOUBLE, %eax
diff --git a/libffi/src/x86/ffi.c b/libffi/src/x86/ffi.c
index b6d42a889d3..a4d4798b83b 100644
--- a/libffi/src/x86/ffi.c
+++ b/libffi/src/x86/ffi.c
@@ -3,8 +3,9 @@
Copyright (c) 2002 Ranjit Mathew
Copyright (c) 2002 Bo Thorsen
Copyright (c) 2002 Roger Sayle
-
- x86 Foreign Function Interface
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
+ x86 Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -122,6 +123,13 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
#ifdef X86
case FFI_TYPE_STRUCT:
#endif
+#if defined(X86) || defined(X86_DARWIN)
+ case FFI_TYPE_UINT8:
+ case FFI_TYPE_UINT16:
+ case FFI_TYPE_SINT8:
+ case FFI_TYPE_SINT16:
+#endif
+
case FFI_TYPE_SINT64:
case FFI_TYPE_FLOAT:
case FFI_TYPE_DOUBLE:
@@ -137,11 +145,11 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
case FFI_TYPE_STRUCT:
if (cif->rtype->size == 1)
{
- cif->flags = FFI_TYPE_SINT8; /* same as char size */
+ cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */
}
else if (cif->rtype->size == 2)
{
- cif->flags = FFI_TYPE_SINT16; /* same as short size */
+ cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */
}
else if (cif->rtype->size == 4)
{
diff --git a/libffi/src/x86/ffitarget.h b/libffi/src/x86/ffitarget.h
index c44490f5054..3a1427c3c9b 100644
--- a/libffi/src/x86/ffitarget.h
+++ b/libffi/src/x86/ffitarget.h
@@ -1,5 +1,7 @@
/* -----------------------------------------------------------------*-C-*-
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+
Target configuration macros for x86 and x86-64.
Permission is hereby granted, free of charge, to any person obtaining
@@ -68,6 +70,8 @@ typedef enum ffi_abi {
/* ---- Definitions for closures ----------------------------------------- */
#define FFI_CLOSURES 1
+#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
+#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)
#if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
#define FFI_TRAMPOLINE_SIZE 24
diff --git a/libffi/src/x86/sysv.S b/libffi/src/x86/sysv.S
index 46759f43498..a0daf1dca94 100644
--- a/libffi/src/x86/sysv.S
+++ b/libffi/src/x86/sysv.S
@@ -59,16 +59,15 @@ ffi_call_SYSV:
call *28(%ebp)
- /* Remove the space we pushed for the args */
- movl 16(%ebp),%ecx
- addl %ecx,%esp
-
/* Load %ecx with the return type code */
movl 20(%ebp),%ecx
+ /* Protect %esi. We're going to pop it in the epilogue. */
+ pushl %esi
+
/* If the return value pointer is NULL, assume no return value. */
cmpl $0,24(%ebp)
- jne retint
+ jne 0f
/* Even if there is no space for the return value, we are
obliged to handle floating-point values. */
@@ -78,51 +77,84 @@ ffi_call_SYSV:
jmp epilogue
-retint:
- cmpl $FFI_TYPE_INT,%ecx
- jne retfloat
- /* Load %ecx with the pointer to storage for the return value */
- movl 24(%ebp),%ecx
- movl %eax,0(%ecx)
- jmp epilogue
+0:
+ call 1f
+
+.Lstore_table:
+ .long noretval-.Lstore_table /* FFI_TYPE_VOID */
+ .long retint-.Lstore_table /* FFI_TYPE_INT */
+ .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */
+ .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */
+ .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */
+ .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */
+ .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */
+ .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */
+ .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */
+ .long retint-.Lstore_table /* FFI_TYPE_UINT32 */
+ .long retint-.Lstore_table /* FFI_TYPE_SINT32 */
+ .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */
+ .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */
+ .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */
+ .long retint-.Lstore_table /* FFI_TYPE_POINTER */
+
+1:
+ pop %esi
+ add (%esi, %ecx, 4), %esi
+ jmp *%esi
+
+ /* Sign/zero extend as appropriate. */
+retsint8:
+ movsbl %al, %eax
+ jmp retint
+
+retsint16:
+ movswl %ax, %eax
+ jmp retint
+
+retuint8:
+ movzbl %al, %eax
+ jmp retint
+
+retuint16:
+ movzwl %ax, %eax
+ jmp retint
retfloat:
- cmpl $FFI_TYPE_FLOAT,%ecx
- jne retdouble
/* Load %ecx with the pointer to storage for the return value */
movl 24(%ebp),%ecx
fstps (%ecx)
jmp epilogue
retdouble:
- cmpl $FFI_TYPE_DOUBLE,%ecx
- jne retlongdouble
/* Load %ecx with the pointer to storage for the return value */
movl 24(%ebp),%ecx
fstpl (%ecx)
jmp epilogue
retlongdouble:
- cmpl $FFI_TYPE_LONGDOUBLE,%ecx
- jne retint64
/* Load %ecx with the pointer to storage for the return value */
movl 24(%ebp),%ecx
fstpt (%ecx)
jmp epilogue
retint64:
- cmpl $FFI_TYPE_SINT64,%ecx
- jne retstruct
/* Load %ecx with the pointer to storage for the return value */
movl 24(%ebp),%ecx
movl %eax,0(%ecx)
movl %edx,4(%ecx)
+ jmp epilogue
+retint:
+ /* Load %ecx with the pointer to storage for the return value */
+ movl 24(%ebp),%ecx
+ movl %eax,0(%ecx)
+
retstruct:
/* Nothing to do! */
noretval:
epilogue:
+ popl %esi
movl %ebp,%esp
popl %ebp
ret
@@ -162,7 +194,15 @@ ffi_closure_SYSV:
movl -12(%ebp), %ecx
cmpl $FFI_TYPE_INT, %eax
je .Lcls_retint
- cmpl $FFI_TYPE_FLOAT, %eax
+
+ /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16,
+ FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */
+ cmpl $FFI_TYPE_UINT64, %eax
+ jge 0f
+ cmpl $FFI_TYPE_UINT8, %eax
+ jge .Lcls_retint
+
+0: cmpl $FFI_TYPE_FLOAT, %eax
je .Lcls_retfloat
cmpl $FFI_TYPE_DOUBLE, %eax
je .Lcls_retdouble
@@ -170,6 +210,8 @@ ffi_closure_SYSV:
je .Lcls_retldouble
cmpl $FFI_TYPE_SINT64, %eax
je .Lcls_retllong
+ cmpl $FFI_TYPE_STRUCT, %eax
+ je .Lcls_retstruct
.Lcls_epilogue:
movl %ebp, %esp
popl %ebp
@@ -190,6 +232,10 @@ ffi_closure_SYSV:
movl (%ecx), %eax
movl 4(%ecx), %edx
jmp .Lcls_epilogue
+.Lcls_retstruct:
+ movl %ebp, %esp
+ popl %ebp
+ ret $4
.LFE2:
.size ffi_closure_SYSV, .-ffi_closure_SYSV
@@ -226,6 +272,14 @@ ffi_closure_raw_SYSV:
movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */
cmpl $FFI_TYPE_INT, %eax
je .Lrcls_retint
+
+ /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16,
+ FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */
+ cmpl $FFI_TYPE_UINT64, %eax
+ jge 0f
+ cmpl $FFI_TYPE_UINT8, %eax
+ jge .Lrcls_retint
+0:
cmpl $FFI_TYPE_FLOAT, %eax
je .Lrcls_retfloat
cmpl $FFI_TYPE_DOUBLE, %eax
diff --git a/libffi/testsuite/Makefile.in b/libffi/testsuite/Makefile.in
index 258a9d94acb..e919e039b2f 100644
--- a/libffi/testsuite/Makefile.in
+++ b/libffi/testsuite/Makefile.in
@@ -113,10 +113,8 @@ MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MIPS_IRIX_FALSE = @MIPS_IRIX_FALSE@
-MIPS_IRIX_TRUE = @MIPS_IRIX_TRUE@
-MIPS_LINUX_FALSE = @MIPS_LINUX_FALSE@
-MIPS_LINUX_TRUE = @MIPS_LINUX_TRUE@
+MIPS_FALSE = @MIPS_FALSE@
+MIPS_TRUE = @MIPS_TRUE@
NM = @NM@
OBJEXT = @OBJEXT@
PA64_HPUX_FALSE = @PA64_HPUX_FALSE@
diff --git a/libffi/testsuite/libffi.call/call.exp b/libffi/testsuite/libffi.call/call.exp
index bd4d2e8cc25..25e01099975 100644
--- a/libffi/testsuite/libffi.call/call.exp
+++ b/libffi/testsuite/libffi.call/call.exp
@@ -27,6 +27,7 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" ""
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" ""
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" ""
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" ""
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" ""
dg-finish
diff --git a/libffi/testsuite/libffi.call/closure_fn0.c b/libffi/testsuite/libffi.call/closure_fn0.c
index 929b0dd39ce..e4875270a0c 100644
--- a/libffi/testsuite/libffi.call/closure_fn0.c
+++ b/libffi/testsuite/libffi.call/closure_fn0.c
@@ -9,7 +9,7 @@
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void
@@ -63,21 +63,21 @@ int main (void)
#endif
cl_arg_types[0] = &ffi_type_uint64;
- cl_arg_types[1] = &ffi_type_uint;
+ cl_arg_types[1] = &ffi_type_sint;
cl_arg_types[2] = &ffi_type_uint64;
- cl_arg_types[3] = &ffi_type_uint;
+ cl_arg_types[3] = &ffi_type_sint;
cl_arg_types[4] = &ffi_type_sshort;
cl_arg_types[5] = &ffi_type_uint64;
- cl_arg_types[6] = &ffi_type_uint;
- cl_arg_types[7] = &ffi_type_uint;
+ cl_arg_types[6] = &ffi_type_sint;
+ cl_arg_types[7] = &ffi_type_sint;
cl_arg_types[8] = &ffi_type_double;
- cl_arg_types[9] = &ffi_type_uint;
- cl_arg_types[10] = &ffi_type_uint;
+ cl_arg_types[9] = &ffi_type_sint;
+ cl_arg_types[10] = &ffi_type_sint;
cl_arg_types[11] = &ffi_type_float;
- cl_arg_types[12] = &ffi_type_uint;
- cl_arg_types[13] = &ffi_type_uint;
- cl_arg_types[14] = &ffi_type_uint;
- cl_arg_types[15] = &ffi_type_uint;
+ cl_arg_types[12] = &ffi_type_sint;
+ cl_arg_types[13] = &ffi_type_sint;
+ cl_arg_types[14] = &ffi_type_sint;
+ cl_arg_types[15] = &ffi_type_sint;
cl_arg_types[16] = NULL;
/* Initialize the cif */
diff --git a/libffi/testsuite/libffi.call/closure_fn1.c b/libffi/testsuite/libffi.call/closure_fn1.c
index e12917bbab0..db26c4246e4 100644
--- a/libffi/testsuite/libffi.call/closure_fn1.c
+++ b/libffi/testsuite/libffi.call/closure_fn1.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
@@ -61,15 +61,15 @@ int main (void)
cl_arg_types[4] = &ffi_type_sshort;
cl_arg_types[5] = &ffi_type_float;
cl_arg_types[6] = &ffi_type_float;
- cl_arg_types[7] = &ffi_type_uint;
+ cl_arg_types[7] = &ffi_type_sint;
cl_arg_types[8] = &ffi_type_double;
- cl_arg_types[9] = &ffi_type_uint;
- cl_arg_types[10] = &ffi_type_uint;
+ cl_arg_types[9] = &ffi_type_sint;
+ cl_arg_types[10] = &ffi_type_sint;
cl_arg_types[11] = &ffi_type_float;
- cl_arg_types[12] = &ffi_type_uint;
- cl_arg_types[13] = &ffi_type_uint;
- cl_arg_types[14] = &ffi_type_uint;
- cl_arg_types[15] = &ffi_type_uint;
+ cl_arg_types[12] = &ffi_type_sint;
+ cl_arg_types[13] = &ffi_type_sint;
+ cl_arg_types[14] = &ffi_type_sint;
+ cl_arg_types[15] = &ffi_type_sint;
cl_arg_types[16] = NULL;
/* Initialize the cif */
diff --git a/libffi/testsuite/libffi.call/closure_fn2.c b/libffi/testsuite/libffi.call/closure_fn2.c
index 498173ce6b8..cbf73856113 100644
--- a/libffi/testsuite/libffi.call/closure_fn2.c
+++ b/libffi/testsuite/libffi.call/closure_fn2.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void closure_test_fn2(ffi_cif* cif __UNUSED__, void* resp, void** args,
@@ -61,15 +61,15 @@ int main (void)
cl_arg_types[4] = &ffi_type_sshort;
cl_arg_types[5] = &ffi_type_double;
cl_arg_types[6] = &ffi_type_double;
- cl_arg_types[7] = &ffi_type_uint;
+ cl_arg_types[7] = &ffi_type_sint;
cl_arg_types[8] = &ffi_type_double;
- cl_arg_types[9] = &ffi_type_uint;
- cl_arg_types[10] = &ffi_type_uint;
+ cl_arg_types[9] = &ffi_type_sint;
+ cl_arg_types[10] = &ffi_type_sint;
cl_arg_types[11] = &ffi_type_float;
- cl_arg_types[12] = &ffi_type_uint;
+ cl_arg_types[12] = &ffi_type_sint;
cl_arg_types[13] = &ffi_type_float;
- cl_arg_types[14] = &ffi_type_uint;
- cl_arg_types[15] = &ffi_type_uint;
+ cl_arg_types[14] = &ffi_type_sint;
+ cl_arg_types[15] = &ffi_type_sint;
cl_arg_types[16] = NULL;
/* Initialize the cif */
diff --git a/libffi/testsuite/libffi.call/closure_fn3.c b/libffi/testsuite/libffi.call/closure_fn3.c
index cd95dc4f044..1fb32a86db6 100644
--- a/libffi/testsuite/libffi.call/closure_fn3.c
+++ b/libffi/testsuite/libffi.call/closure_fn3.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void closure_test_fn3(ffi_cif* cif __UNUSED__, void* resp, void** args,
@@ -64,13 +64,13 @@ int main (void)
cl_arg_types[6] = &ffi_type_float;
cl_arg_types[7] = &ffi_type_float;
cl_arg_types[8] = &ffi_type_double;
- cl_arg_types[9] = &ffi_type_uint;
+ cl_arg_types[9] = &ffi_type_sint;
cl_arg_types[10] = &ffi_type_float;
cl_arg_types[11] = &ffi_type_float;
- cl_arg_types[12] = &ffi_type_uint;
+ cl_arg_types[12] = &ffi_type_sint;
cl_arg_types[13] = &ffi_type_float;
cl_arg_types[14] = &ffi_type_float;
- cl_arg_types[15] = &ffi_type_uint;
+ cl_arg_types[15] = &ffi_type_sint;
cl_arg_types[16] = NULL;
/* Initialize the cif */
diff --git a/libffi/testsuite/libffi.call/closure_fn4.c b/libffi/testsuite/libffi.call/closure_fn4.c
index 65ff2be1058..74506f31a0e 100644
--- a/libffi/testsuite/libffi.call/closure_fn4.c
+++ b/libffi/testsuite/libffi.call/closure_fn4.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20031026 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
@@ -76,7 +76,7 @@ int main (void)
for (i = 0; i < 15; i++) {
cl_arg_types[i] = &ffi_type_uint64;
}
- cl_arg_types[15] = &ffi_type_uint;
+ cl_arg_types[15] = &ffi_type_sint;
cl_arg_types[16] = NULL;
/* Initialize the cif */
diff --git a/libffi/testsuite/libffi.call/closure_fn5.c b/libffi/testsuite/libffi.call/closure_fn5.c
index 2ad0aed21c2..c64ee8dfd66 100644
--- a/libffi/testsuite/libffi.call/closure_fn5.c
+++ b/libffi/testsuite/libffi.call/closure_fn5.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20031026 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void
@@ -74,11 +74,11 @@ int main (void)
for (i = 0; i < 10; i++) {
cl_arg_types[i] = &ffi_type_uint64;
}
- cl_arg_types[10] = &ffi_type_uint;
+ cl_arg_types[10] = &ffi_type_sint;
for (i = 11; i < 15; i++) {
cl_arg_types[i] = &ffi_type_uint64;
}
- cl_arg_types[15] = &ffi_type_uint;
+ cl_arg_types[15] = &ffi_type_sint;
cl_arg_types[16] = NULL;
/* Initialize the cif */
diff --git a/libffi/testsuite/libffi.call/closure_fn6.c b/libffi/testsuite/libffi.call/closure_fn6.c
index e701a1f6e86..16c52fdf20e 100644
--- a/libffi/testsuite/libffi.call/closure_fn6.c
+++ b/libffi/testsuite/libffi.call/closure_fn6.c
@@ -5,7 +5,7 @@
PR: PR23404
Originator: <andreast@gcc.gnu.org> 20050830 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void
@@ -67,16 +67,16 @@ int main (void)
cl_arg_types[1] = &ffi_type_uint64;
cl_arg_types[2] = &ffi_type_uint64;
cl_arg_types[3] = &ffi_type_uint64;
- cl_arg_types[4] = &ffi_type_uint;
+ cl_arg_types[4] = &ffi_type_sint;
cl_arg_types[5] = &ffi_type_double;
cl_arg_types[6] = &ffi_type_double;
cl_arg_types[7] = &ffi_type_float;
cl_arg_types[8] = &ffi_type_double;
cl_arg_types[9] = &ffi_type_double;
- cl_arg_types[10] = &ffi_type_uint;
+ cl_arg_types[10] = &ffi_type_sint;
cl_arg_types[11] = &ffi_type_float;
- cl_arg_types[12] = &ffi_type_uint;
- cl_arg_types[13] = &ffi_type_uint;
+ cl_arg_types[12] = &ffi_type_sint;
+ cl_arg_types[13] = &ffi_type_sint;
cl_arg_types[14] = &ffi_type_double;
cl_arg_types[15] = &ffi_type_double;
cl_arg_types[16] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_12byte.c b/libffi/testsuite/libffi.call/cls_12byte.c
index e436721e752..92530d5ff57 100644
--- a/libffi/testsuite/libffi.call/cls_12byte.c
+++ b/libffi/testsuite/libffi.call/cls_12byte.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_12byte {
@@ -66,9 +66,9 @@ int main (void)
struct cls_struct_12byte j_dbl = { 1, 5, 3 };
struct cls_struct_12byte res_dbl;
- cls_struct_fields[0] = &ffi_type_uint32;
- cls_struct_fields[1] = &ffi_type_uint32;
- cls_struct_fields[2] = &ffi_type_uint32;
+ cls_struct_fields[0] = &ffi_type_sint;
+ cls_struct_fields[1] = &ffi_type_sint;
+ cls_struct_fields[2] = &ffi_type_sint;
cls_struct_fields[3] = NULL;
dbl_arg_types[0] = &cls_struct_type;
diff --git a/libffi/testsuite/libffi.call/cls_16byte.c b/libffi/testsuite/libffi.call/cls_16byte.c
index 466aa877ca4..f3c314a8760 100644
--- a/libffi/testsuite/libffi.call/cls_16byte.c
+++ b/libffi/testsuite/libffi.call/cls_16byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_16byte {
@@ -67,9 +67,9 @@ int main (void)
struct cls_struct_16byte j_dbl = { 1, 9.0, 3 };
struct cls_struct_16byte res_dbl;
- cls_struct_fields[0] = &ffi_type_uint32;
+ cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_double;
- cls_struct_fields[2] = &ffi_type_uint32;
+ cls_struct_fields[2] = &ffi_type_sint;
cls_struct_fields[3] = NULL;
dbl_arg_types[0] = &cls_struct_type;
diff --git a/libffi/testsuite/libffi.call/cls_18byte.c b/libffi/testsuite/libffi.call/cls_18byte.c
index 9a48750512e..90165804695 100644
--- a/libffi/testsuite/libffi.call/cls_18byte.c
+++ b/libffi/testsuite/libffi.call/cls_18byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030915 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_18byte {
diff --git a/libffi/testsuite/libffi.call/cls_19byte.c b/libffi/testsuite/libffi.call/cls_19byte.c
index 78319723a12..8af583467b1 100644
--- a/libffi/testsuite/libffi.call/cls_19byte.c
+++ b/libffi/testsuite/libffi.call/cls_19byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030915 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_19byte {
diff --git a/libffi/testsuite/libffi.call/cls_1_1byte.c b/libffi/testsuite/libffi.call/cls_1_1byte.c
index 5ebd2c8880d..0fcc8c6d54c 100644
--- a/libffi/testsuite/libffi.call/cls_1_1byte.c
+++ b/libffi/testsuite/libffi.call/cls_1_1byte.c
@@ -8,7 +8,7 @@
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_1_1byte {
diff --git a/libffi/testsuite/libffi.call/cls_20byte.c b/libffi/testsuite/libffi.call/cls_20byte.c
index b12d4b17bbf..fa5f81a88c8 100644
--- a/libffi/testsuite/libffi.call/cls_20byte.c
+++ b/libffi/testsuite/libffi.call/cls_20byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_20byte {
@@ -69,7 +69,7 @@ int main (void)
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
- cls_struct_fields[2] = &ffi_type_uint32;
+ cls_struct_fields[2] = &ffi_type_sint;
cls_struct_fields[3] = NULL;
dbl_arg_types[0] = &cls_struct_type;
diff --git a/libffi/testsuite/libffi.call/cls_20byte1.c b/libffi/testsuite/libffi.call/cls_20byte1.c
index 978a51a970d..072bafcafb5 100644
--- a/libffi/testsuite/libffi.call/cls_20byte1.c
+++ b/libffi/testsuite/libffi.call/cls_20byte1.c
@@ -7,7 +7,7 @@
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_20byte {
@@ -69,7 +69,7 @@ int main (void)
struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 };
struct cls_struct_20byte res_dbl;
- cls_struct_fields[0] = &ffi_type_uint32;
+ cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = &ffi_type_double;
cls_struct_fields[3] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_24byte.c b/libffi/testsuite/libffi.call/cls_24byte.c
index 9aa0c065097..22e169058c5 100644
--- a/libffi/testsuite/libffi.call/cls_24byte.c
+++ b/libffi/testsuite/libffi.call/cls_24byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_24byte {
@@ -82,7 +82,7 @@ int main (void)
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_double;
- cls_struct_fields[2] = &ffi_type_uint32;
+ cls_struct_fields[2] = &ffi_type_sint;
cls_struct_fields[3] = &ffi_type_float;
cls_struct_fields[4] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_2byte.c b/libffi/testsuite/libffi.call/cls_2byte.c
index 2c01ee5b340..5b91a09a2cc 100644
--- a/libffi/testsuite/libffi.call/cls_2byte.c
+++ b/libffi/testsuite/libffi.call/cls_2byte.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_2byte {
diff --git a/libffi/testsuite/libffi.call/cls_3_1byte.c b/libffi/testsuite/libffi.call/cls_3_1byte.c
index bcb5de761f4..93fe911d2da 100644
--- a/libffi/testsuite/libffi.call/cls_3_1byte.c
+++ b/libffi/testsuite/libffi.call/cls_3_1byte.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030902 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_3_1byte {
diff --git a/libffi/testsuite/libffi.call/cls_3byte1.c b/libffi/testsuite/libffi.call/cls_3byte1.c
index 53e6b87303b..b7726917094 100644
--- a/libffi/testsuite/libffi.call/cls_3byte1.c
+++ b/libffi/testsuite/libffi.call/cls_3byte1.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_3byte {
diff --git a/libffi/testsuite/libffi.call/cls_3byte2.c b/libffi/testsuite/libffi.call/cls_3byte2.c
index f5f2a4fea11..51128cc18ef 100644
--- a/libffi/testsuite/libffi.call/cls_3byte2.c
+++ b/libffi/testsuite/libffi.call/cls_3byte2.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_3byte_1 {
diff --git a/libffi/testsuite/libffi.call/cls_4_1byte.c b/libffi/testsuite/libffi.call/cls_4_1byte.c
index 3a3233897dd..a378d194f42 100644
--- a/libffi/testsuite/libffi.call/cls_4_1byte.c
+++ b/libffi/testsuite/libffi.call/cls_4_1byte.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030902 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_4_1byte {
diff --git a/libffi/testsuite/libffi.call/cls_4byte.c b/libffi/testsuite/libffi.call/cls_4byte.c
index 08321f411cb..b2c951dbeb5 100644
--- a/libffi/testsuite/libffi.call/cls_4byte.c
+++ b/libffi/testsuite/libffi.call/cls_4byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
diff --git a/libffi/testsuite/libffi.call/cls_5_1_byte.c b/libffi/testsuite/libffi.call/cls_5_1_byte.c
index d7745d82ebf..40d2e64eec8 100644
--- a/libffi/testsuite/libffi.call/cls_5_1_byte.c
+++ b/libffi/testsuite/libffi.call/cls_5_1_byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20050708 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_5byte {
diff --git a/libffi/testsuite/libffi.call/cls_5byte.c b/libffi/testsuite/libffi.call/cls_5byte.c
index adf2a4fe6c8..0307e51f6b9 100644
--- a/libffi/testsuite/libffi.call/cls_5byte.c
+++ b/libffi/testsuite/libffi.call/cls_5byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_5byte {
diff --git a/libffi/testsuite/libffi.call/cls_64byte.c b/libffi/testsuite/libffi.call/cls_64byte.c
index a6a4f6950c5..1329c6f26ab 100644
--- a/libffi/testsuite/libffi.call/cls_64byte.c
+++ b/libffi/testsuite/libffi.call/cls_64byte.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_64byte {
diff --git a/libffi/testsuite/libffi.call/cls_6_1_byte.c b/libffi/testsuite/libffi.call/cls_6_1_byte.c
index dd90ce3163d..7ddb586ea1a 100644
--- a/libffi/testsuite/libffi.call/cls_6_1_byte.c
+++ b/libffi/testsuite/libffi.call/cls_6_1_byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20050708 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_6byte {
diff --git a/libffi/testsuite/libffi.call/cls_6byte.c b/libffi/testsuite/libffi.call/cls_6byte.c
index afcb2d217d1..24fd63baa37 100644
--- a/libffi/testsuite/libffi.call/cls_6byte.c
+++ b/libffi/testsuite/libffi.call/cls_6byte.c
@@ -6,7 +6,7 @@
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_6byte {
diff --git a/libffi/testsuite/libffi.call/cls_7_1_byte.c b/libffi/testsuite/libffi.call/cls_7_1_byte.c
index 628855e3d53..0cf1371a77a 100644
--- a/libffi/testsuite/libffi.call/cls_7_1_byte.c
+++ b/libffi/testsuite/libffi.call/cls_7_1_byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20050708 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_7byte {
diff --git a/libffi/testsuite/libffi.call/cls_7byte.c b/libffi/testsuite/libffi.call/cls_7byte.c
index 11932cb00d7..77858625fa9 100644
--- a/libffi/testsuite/libffi.call/cls_7byte.c
+++ b/libffi/testsuite/libffi.call/cls_7byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_7byte {
diff --git a/libffi/testsuite/libffi.call/cls_8byte.c b/libffi/testsuite/libffi.call/cls_8byte.c
index 46ef1a73c3b..75326b8f70e 100644
--- a/libffi/testsuite/libffi.call/cls_8byte.c
+++ b/libffi/testsuite/libffi.call/cls_8byte.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_8byte {
@@ -66,7 +66,7 @@ int main (void)
struct cls_struct_8byte f_dbl = { 4, 5.0 };
struct cls_struct_8byte res_dbl;
- cls_struct_fields[0] = &ffi_type_uint32;
+ cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_float;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_9byte1.c b/libffi/testsuite/libffi.call/cls_9byte1.c
index 6070fbe998d..0b3de9daa93 100644
--- a/libffi/testsuite/libffi.call/cls_9byte1.c
+++ b/libffi/testsuite/libffi.call/cls_9byte1.c
@@ -7,7 +7,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030914 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_9byte {
@@ -67,7 +67,7 @@ int main (void)
struct cls_struct_9byte j_dbl = { 1, 9.0};
struct cls_struct_9byte res_dbl;
- cls_struct_fields[0] = &ffi_type_uint32;
+ cls_struct_fields[0] = &ffi_type_sint;
cls_struct_fields[1] = &ffi_type_double;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_9byte2.c b/libffi/testsuite/libffi.call/cls_9byte2.c
index c4c8935db84..8cafc8af6c8 100644
--- a/libffi/testsuite/libffi.call/cls_9byte2.c
+++ b/libffi/testsuite/libffi.call/cls_9byte2.c
@@ -7,7 +7,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030914 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_9byte {
@@ -68,7 +68,7 @@ int main (void)
struct cls_struct_9byte res_dbl;
cls_struct_fields[0] = &ffi_type_double;
- cls_struct_fields[1] = &ffi_type_uint32;
+ cls_struct_fields[1] = &ffi_type_sint;
cls_struct_fields[2] = NULL;
dbl_arg_types[0] = &cls_struct_type;
diff --git a/libffi/testsuite/libffi.call/cls_align_double.c b/libffi/testsuite/libffi.call/cls_align_double.c
index 478075c6a97..5ba230154a4 100644
--- a/libffi/testsuite/libffi.call/cls_align_double.c
+++ b/libffi/testsuite/libffi.call/cls_align_double.c
@@ -6,7 +6,7 @@
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_align {
diff --git a/libffi/testsuite/libffi.call/cls_align_float.c b/libffi/testsuite/libffi.call/cls_align_float.c
index 9e01af1ad6f..996e1ab965b 100644
--- a/libffi/testsuite/libffi.call/cls_align_float.c
+++ b/libffi/testsuite/libffi.call/cls_align_float.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_align {
diff --git a/libffi/testsuite/libffi.call/cls_align_longdouble.c b/libffi/testsuite/libffi.call/cls_align_longdouble.c
index 7057f7bb970..cb603950da8 100644
--- a/libffi/testsuite/libffi.call/cls_align_longdouble.c
+++ b/libffi/testsuite/libffi.call/cls_align_longdouble.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
diff --git a/libffi/testsuite/libffi.call/cls_align_pointer.c b/libffi/testsuite/libffi.call/cls_align_pointer.c
index d3c1926d651..441edcb1027 100644
--- a/libffi/testsuite/libffi.call/cls_align_pointer.c
+++ b/libffi/testsuite/libffi.call/cls_align_pointer.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_align {
diff --git a/libffi/testsuite/libffi.call/cls_align_sint16.c b/libffi/testsuite/libffi.call/cls_align_sint16.c
index fe2cb04fd91..fe4fe092215 100644
--- a/libffi/testsuite/libffi.call/cls_align_sint16.c
+++ b/libffi/testsuite/libffi.call/cls_align_sint16.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_align {
@@ -68,7 +68,7 @@ int main (void)
struct cls_struct_align res_dbl;
cls_struct_fields[0] = &ffi_type_uchar;
- cls_struct_fields[1] = &ffi_type_sint16;
+ cls_struct_fields[1] = &ffi_type_sshort;
cls_struct_fields[2] = &ffi_type_uchar;
cls_struct_fields[3] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_align_sint32.c b/libffi/testsuite/libffi.call/cls_align_sint32.c
index a9a17f3eda5..c059da80975 100644
--- a/libffi/testsuite/libffi.call/cls_align_sint32.c
+++ b/libffi/testsuite/libffi.call/cls_align_sint32.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_align {
@@ -68,7 +68,7 @@ int main (void)
struct cls_struct_align res_dbl;
cls_struct_fields[0] = &ffi_type_uchar;
- cls_struct_fields[1] = &ffi_type_sint32;
+ cls_struct_fields[1] = &ffi_type_sint;
cls_struct_fields[2] = &ffi_type_uchar;
cls_struct_fields[3] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_align_sint64.c b/libffi/testsuite/libffi.call/cls_align_sint64.c
index 7dfb469f024..f5e9746cab0 100644
--- a/libffi/testsuite/libffi.call/cls_align_sint64.c
+++ b/libffi/testsuite/libffi.call/cls_align_sint64.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_align {
diff --git a/libffi/testsuite/libffi.call/cls_align_uint16.c b/libffi/testsuite/libffi.call/cls_align_uint16.c
index 2e383adf7f7..c861bee344d 100644
--- a/libffi/testsuite/libffi.call/cls_align_uint16.c
+++ b/libffi/testsuite/libffi.call/cls_align_uint16.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_align {
@@ -68,7 +68,7 @@ int main (void)
struct cls_struct_align res_dbl;
cls_struct_fields[0] = &ffi_type_uchar;
- cls_struct_fields[1] = &ffi_type_uint16;
+ cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
cls_struct_fields[3] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_align_uint32.c b/libffi/testsuite/libffi.call/cls_align_uint32.c
index dadb458def4..d680d8a9f8c 100644
--- a/libffi/testsuite/libffi.call/cls_align_uint32.c
+++ b/libffi/testsuite/libffi.call/cls_align_uint32.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_align {
@@ -68,7 +68,7 @@ int main (void)
struct cls_struct_align res_dbl;
cls_struct_fields[0] = &ffi_type_uchar;
- cls_struct_fields[1] = &ffi_type_uint32;
+ cls_struct_fields[1] = &ffi_type_uint;
cls_struct_fields[2] = &ffi_type_uchar;
cls_struct_fields[3] = NULL;
diff --git a/libffi/testsuite/libffi.call/cls_align_uint64.c b/libffi/testsuite/libffi.call/cls_align_uint64.c
index b60bcad75f7..0737ba2305b 100644
--- a/libffi/testsuite/libffi.call/cls_align_uint64.c
+++ b/libffi/testsuite/libffi.call/cls_align_uint64.c
@@ -5,7 +5,7 @@
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_align {
diff --git a/libffi/testsuite/libffi.call/cls_double.c b/libffi/testsuite/libffi.call/cls_double.c
index 067cb7ac7d7..ee77adde6a0 100644
--- a/libffi/testsuite/libffi.call/cls_double.c
+++ b/libffi/testsuite/libffi.call/cls_double.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
diff --git a/libffi/testsuite/libffi.call/cls_float.c b/libffi/testsuite/libffi.call/cls_float.c
index 1d5f4db278c..8bed628f823 100644
--- a/libffi/testsuite/libffi.call/cls_float.c
+++ b/libffi/testsuite/libffi.call/cls_float.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void cls_ret_float_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
diff --git a/libffi/testsuite/libffi.call/cls_multi_schar.c b/libffi/testsuite/libffi.call/cls_multi_schar.c
index 56e3f1c729c..713c3188d81 100644
--- a/libffi/testsuite/libffi.call/cls_multi_schar.c
+++ b/libffi/testsuite/libffi.call/cls_multi_schar.c
@@ -4,7 +4,7 @@
PR: PR13221.
Originator: <hos@tamanegi.org> 20031129 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
signed char test_func_fn(signed char a1, signed char a2)
diff --git a/libffi/testsuite/libffi.call/cls_multi_sshort.c b/libffi/testsuite/libffi.call/cls_multi_sshort.c
index 662d48b3ed5..852fdf73db7 100644
--- a/libffi/testsuite/libffi.call/cls_multi_sshort.c
+++ b/libffi/testsuite/libffi.call/cls_multi_sshort.c
@@ -4,7 +4,7 @@
PR: PR13221.
Originator: <andreast@gcc.gnu.org> 20031129 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
signed short test_func_fn(signed short a1, signed short a2)
diff --git a/libffi/testsuite/libffi.call/cls_multi_sshortchar.c b/libffi/testsuite/libffi.call/cls_multi_sshortchar.c
index 1d60833fc8f..e4e92ef4480 100644
--- a/libffi/testsuite/libffi.call/cls_multi_sshortchar.c
+++ b/libffi/testsuite/libffi.call/cls_multi_sshortchar.c
@@ -4,7 +4,7 @@
PR: PR13221.
Originator: <andreast@gcc.gnu.org> 20031129 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
signed short test_func_fn(signed char a1, signed short a2,
diff --git a/libffi/testsuite/libffi.call/cls_multi_uchar.c b/libffi/testsuite/libffi.call/cls_multi_uchar.c
index 734fb7b6aa3..2c84aef6134 100644
--- a/libffi/testsuite/libffi.call/cls_multi_uchar.c
+++ b/libffi/testsuite/libffi.call/cls_multi_uchar.c
@@ -4,7 +4,7 @@
PR: PR13221.
Originator: <andreast@gcc.gnu.org> 20031129 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
unsigned char test_func_fn(unsigned char a1, unsigned char a2,
diff --git a/libffi/testsuite/libffi.call/cls_multi_ushort.c b/libffi/testsuite/libffi.call/cls_multi_ushort.c
index 8a2237ac25a..215fef832a8 100644
--- a/libffi/testsuite/libffi.call/cls_multi_ushort.c
+++ b/libffi/testsuite/libffi.call/cls_multi_ushort.c
@@ -4,7 +4,7 @@
PR: PR13221.
Originator: <andreast@gcc.gnu.org> 20031129 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
unsigned short test_func_fn(unsigned short a1, unsigned short a2)
diff --git a/libffi/testsuite/libffi.call/cls_multi_ushortchar.c b/libffi/testsuite/libffi.call/cls_multi_ushortchar.c
index 953fac4b5cf..1cde84abb5e 100644
--- a/libffi/testsuite/libffi.call/cls_multi_ushortchar.c
+++ b/libffi/testsuite/libffi.call/cls_multi_ushortchar.c
@@ -4,7 +4,7 @@
PR: PR13221.
Originator: <andreast@gcc.gnu.org> 20031129 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
unsigned short test_func_fn(unsigned char a1, unsigned short a2,
diff --git a/libffi/testsuite/libffi.call/cls_schar.c b/libffi/testsuite/libffi.call/cls_schar.c
index 2b9af7a6293..bb1f2c64f35 100644
--- a/libffi/testsuite/libffi.call/cls_schar.c
+++ b/libffi/testsuite/libffi.call/cls_schar.c
@@ -6,7 +6,7 @@
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void cls_ret_schar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
diff --git a/libffi/testsuite/libffi.call/cls_sint.c b/libffi/testsuite/libffi.call/cls_sint.c
index 35e5012c020..cf21bf84417 100644
--- a/libffi/testsuite/libffi.call/cls_sint.c
+++ b/libffi/testsuite/libffi.call/cls_sint.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20031108 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void cls_ret_sint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
@@ -32,12 +32,12 @@ int main (void)
pcl = &cl;
#endif
- cl_arg_types[0] = &ffi_type_sint32;
+ cl_arg_types[0] = &ffi_type_sint;
cl_arg_types[1] = NULL;
/* Initialize the cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
- &ffi_type_sint32, cl_arg_types) == FFI_OK);
+ &ffi_type_sint, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure(pcl, &cif, cls_ret_sint_fn, NULL) == FFI_OK);
diff --git a/libffi/testsuite/libffi.call/cls_sshort.c b/libffi/testsuite/libffi.call/cls_sshort.c
index 81c8b95b0ee..8d63413318d 100644
--- a/libffi/testsuite/libffi.call/cls_sshort.c
+++ b/libffi/testsuite/libffi.call/cls_sshort.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20031108 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void cls_ret_sshort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
@@ -32,12 +32,12 @@ int main (void)
pcl = &cl;
#endif
- cl_arg_types[0] = &ffi_type_sint16;
+ cl_arg_types[0] = &ffi_type_sshort;
cl_arg_types[1] = NULL;
/* Initialize the cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
- &ffi_type_sint16, cl_arg_types) == FFI_OK);
+ &ffi_type_sshort, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure(pcl, &cif, cls_ret_sshort_fn, NULL) == FFI_OK);
diff --git a/libffi/testsuite/libffi.call/cls_uchar.c b/libffi/testsuite/libffi.call/cls_uchar.c
index f16d79e651b..ea78ce5840a 100644
--- a/libffi/testsuite/libffi.call/cls_uchar.c
+++ b/libffi/testsuite/libffi.call/cls_uchar.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void cls_ret_uchar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
diff --git a/libffi/testsuite/libffi.call/cls_uint.c b/libffi/testsuite/libffi.call/cls_uint.c
index 0f8189c1085..e31e41aacf2 100644
--- a/libffi/testsuite/libffi.call/cls_uint.c
+++ b/libffi/testsuite/libffi.call/cls_uint.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void cls_ret_uint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
@@ -33,12 +33,12 @@ int main (void)
pcl = &cl;
#endif
- cl_arg_types[0] = &ffi_type_uint32;
+ cl_arg_types[0] = &ffi_type_uint;
cl_arg_types[1] = NULL;
/* Initialize the cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
- &ffi_type_uint32, cl_arg_types) == FFI_OK);
+ &ffi_type_uint, cl_arg_types) == FFI_OK);
CHECK(ffi_prep_closure(pcl, &cif, cls_ret_uint_fn, NULL) == FFI_OK);
diff --git a/libffi/testsuite/libffi.call/cls_ulonglong.c b/libffi/testsuite/libffi.call/cls_ulonglong.c
index 0a9588ab035..1cc0a389332 100644
--- a/libffi/testsuite/libffi.call/cls_ulonglong.c
+++ b/libffi/testsuite/libffi.call/cls_ulonglong.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp,
diff --git a/libffi/testsuite/libffi.call/cls_ushort.c b/libffi/testsuite/libffi.call/cls_ushort.c
index b5f16c8973c..81f984862a3 100644
--- a/libffi/testsuite/libffi.call/cls_ushort.c
+++ b/libffi/testsuite/libffi.call/cls_ushort.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
static void cls_ret_ushort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args,
diff --git a/libffi/testsuite/libffi.call/ffitest.h b/libffi/testsuite/libffi.call/ffitest.h
index 42fce0489f1..e73f758f586 100644
--- a/libffi/testsuite/libffi.call/ffitest.h
+++ b/libffi/testsuite/libffi.call/ffitest.h
@@ -9,17 +9,6 @@
#define CHECK(x) !(x) ? abort() : 0
-/* Define our own long for easier handling on multilib targets. */
-#if LONG_MAX == 2147483647
-#define ffi_type_mylong ffi_type_uint32
-#else
-#if LONG_MAX == 9223372036854775807
-#define ffi_type_mylong ffi_type_uint64
-#else
-#error "Error, size LONG not defined as expected"
-#endif
-#endif
-
/* Define __UNUSED__ that also other compilers than gcc can run the tests. */
#undef __UNUSED__
#if defined(__GNUC__)
diff --git a/libffi/testsuite/libffi.call/nested_struct.c b/libffi/testsuite/libffi.call/nested_struct.c
index 6a9b7c78d8a..adce7ba434f 100644
--- a/libffi/testsuite/libffi.call/nested_struct.c
+++ b/libffi/testsuite/libffi.call/nested_struct.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_16byte1 {
@@ -108,10 +108,10 @@ int main (void)
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_float;
- cls_struct_fields[2] = &ffi_type_uint32;
+ cls_struct_fields[2] = &ffi_type_sint;
cls_struct_fields[3] = NULL;
- cls_struct_fields1[0] = &ffi_type_uint32;
+ cls_struct_fields1[0] = &ffi_type_sint;
cls_struct_fields1[1] = &ffi_type_double;
cls_struct_fields1[2] = &ffi_type_float;
cls_struct_fields1[3] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct1.c b/libffi/testsuite/libffi.call/nested_struct1.c
index 835e978ad52..f7fe72e5902 100644
--- a/libffi/testsuite/libffi.call/nested_struct1.c
+++ b/libffi/testsuite/libffi.call/nested_struct1.c
@@ -5,7 +5,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_16byte1 {
@@ -113,10 +113,10 @@ int main (void)
cls_struct_fields[0] = &ffi_type_double;
cls_struct_fields[1] = &ffi_type_float;
- cls_struct_fields[2] = &ffi_type_uint32;
+ cls_struct_fields[2] = &ffi_type_sint;
cls_struct_fields[3] = NULL;
- cls_struct_fields1[0] = &ffi_type_uint32;
+ cls_struct_fields1[0] = &ffi_type_sint;
cls_struct_fields1[1] = &ffi_type_double;
cls_struct_fields1[2] = &ffi_type_float;
cls_struct_fields1[3] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct10.c b/libffi/testsuite/libffi.call/nested_struct10.c
index 9faf9bf6543..8d9aba2acdc 100644
--- a/libffi/testsuite/libffi.call/nested_struct10.c
+++ b/libffi/testsuite/libffi.call/nested_struct10.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20051010 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
@@ -102,7 +102,7 @@ int main (void)
cls_struct_fields1[0] = &ffi_type_uchar;
cls_struct_fields1[1] = &cls_struct_type;
- cls_struct_fields1[2] = &ffi_type_uint32;
+ cls_struct_fields1[2] = &ffi_type_uint;
cls_struct_fields1[3] = NULL;
cls_struct_fields2[0] = &ffi_type_uint64;
diff --git a/libffi/testsuite/libffi.call/nested_struct2.c b/libffi/testsuite/libffi.call/nested_struct2.c
index 933d3bbad35..821fcc40f6b 100644
--- a/libffi/testsuite/libffi.call/nested_struct2.c
+++ b/libffi/testsuite/libffi.call/nested_struct2.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030911 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
@@ -80,7 +80,7 @@ int main (void)
struct B res_dbl;
- cls_struct_fields[0] = &ffi_type_mylong;
+ cls_struct_fields[0] = &ffi_type_ulong;
cls_struct_fields[1] = &ffi_type_uchar;
cls_struct_fields[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct3.c b/libffi/testsuite/libffi.call/nested_struct3.c
index 48e27d2610c..f11aff49b94 100644
--- a/libffi/testsuite/libffi.call/nested_struct3.c
+++ b/libffi/testsuite/libffi.call/nested_struct3.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030911 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
diff --git a/libffi/testsuite/libffi.call/nested_struct4.c b/libffi/testsuite/libffi.call/nested_struct4.c
index add6eac5c1c..0553ce88166 100644
--- a/libffi/testsuite/libffi.call/nested_struct4.c
+++ b/libffi/testsuite/libffi.call/nested_struct4.c
@@ -6,7 +6,7 @@
PR: PR 25630.
Originator: <andreast@gcc.gnu.org> 20051010 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
diff --git a/libffi/testsuite/libffi.call/nested_struct5.c b/libffi/testsuite/libffi.call/nested_struct5.c
index f9e982bbfb7..a77931b59b8 100644
--- a/libffi/testsuite/libffi.call/nested_struct5.c
+++ b/libffi/testsuite/libffi.call/nested_struct5.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20051010 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
diff --git a/libffi/testsuite/libffi.call/nested_struct6.c b/libffi/testsuite/libffi.call/nested_struct6.c
index 059389b3d0a..af2821c769f 100644
--- a/libffi/testsuite/libffi.call/nested_struct6.c
+++ b/libffi/testsuite/libffi.call/nested_struct6.c
@@ -6,7 +6,7 @@
PR: PR 25630.
Originator: <andreast@gcc.gnu.org> 20051010 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
@@ -103,7 +103,7 @@ int main (void)
cls_struct_fields1[1] = &ffi_type_uchar;
cls_struct_fields1[2] = NULL;
- cls_struct_fields2[0] = &ffi_type_mylong;
+ cls_struct_fields2[0] = &ffi_type_slong;
cls_struct_fields2[1] = &ffi_type_uchar;
cls_struct_fields2[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/nested_struct7.c b/libffi/testsuite/libffi.call/nested_struct7.c
index 220c651ea0d..c7dd4f7347e 100644
--- a/libffi/testsuite/libffi.call/nested_struct7.c
+++ b/libffi/testsuite/libffi.call/nested_struct7.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20051010 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
diff --git a/libffi/testsuite/libffi.call/nested_struct8.c b/libffi/testsuite/libffi.call/nested_struct8.c
index 2b72a6c43d8..775ff70fdaf 100644
--- a/libffi/testsuite/libffi.call/nested_struct8.c
+++ b/libffi/testsuite/libffi.call/nested_struct8.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20051010 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
diff --git a/libffi/testsuite/libffi.call/nested_struct9.c b/libffi/testsuite/libffi.call/nested_struct9.c
index b936d16d1e4..70332de890b 100644
--- a/libffi/testsuite/libffi.call/nested_struct9.c
+++ b/libffi/testsuite/libffi.call/nested_struct9.c
@@ -6,7 +6,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20051010 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct A {
@@ -103,7 +103,7 @@ int main (void)
cls_struct_fields1[1] = &ffi_type_uchar;
cls_struct_fields1[2] = NULL;
- cls_struct_fields2[0] = &ffi_type_mylong;
+ cls_struct_fields2[0] = &ffi_type_ulong;
cls_struct_fields2[1] = &ffi_type_uchar;
cls_struct_fields2[2] = NULL;
diff --git a/libffi/testsuite/libffi.call/problem1.c b/libffi/testsuite/libffi.call/problem1.c
index 6a5c8ab3181..ca70cc8d773 100644
--- a/libffi/testsuite/libffi.call/problem1.c
+++ b/libffi/testsuite/libffi.call/problem1.c
@@ -4,7 +4,7 @@
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitest.h"
typedef struct my_ffi_struct {
diff --git a/libffi/testsuite/libffi.call/return_dbl1.c b/libffi/testsuite/libffi.call/return_dbl1.c
index a6c1cfca2da..0ea5d50551a 100644
--- a/libffi/testsuite/libffi.call/return_dbl1.c
+++ b/libffi/testsuite/libffi.call/return_dbl1.c
@@ -21,7 +21,7 @@ int main (void)
unsigned int in3;
args[0] = &ffi_type_double;
args[1] = &ffi_type_float;
- args[2] = &ffi_type_uint32;
+ args[2] = &ffi_type_uint;
args[3] = &ffi_type_double;
values[0] = &dbl1;
values[1] = &fl2;
diff --git a/libffi/testsuite/libffi.call/return_dbl2.c b/libffi/testsuite/libffi.call/return_dbl2.c
index 51af3bad8ca..b3818f866b5 100644
--- a/libffi/testsuite/libffi.call/return_dbl2.c
+++ b/libffi/testsuite/libffi.call/return_dbl2.c
@@ -20,7 +20,7 @@ int main (void)
unsigned int in3;
args[0] = &ffi_type_double;
args[1] = &ffi_type_double;
- args[2] = &ffi_type_uint32;
+ args[2] = &ffi_type_uint;
args[3] = &ffi_type_double;
values[0] = &dbl1;
values[1] = &dbl2;
diff --git a/libffi/testsuite/libffi.call/return_fl3.c b/libffi/testsuite/libffi.call/return_fl3.c
index c3d2f120380..c37877b18ec 100644
--- a/libffi/testsuite/libffi.call/return_fl3.c
+++ b/libffi/testsuite/libffi.call/return_fl3.c
@@ -20,7 +20,7 @@ int main (void)
unsigned int in3;
args[0] = &ffi_type_float;
args[1] = &ffi_type_float;
- args[2] = &ffi_type_uint32;
+ args[2] = &ffi_type_uint;
args[3] = &ffi_type_float;
values[0] = &fl1;
values[1] = &fl2;
diff --git a/libffi/testsuite/libffi.call/return_ldl.c b/libffi/testsuite/libffi.call/return_ldl.c
new file mode 100644
index 00000000000..413bf94a67d
--- /dev/null
+++ b/libffi/testsuite/libffi.call/return_ldl.c
@@ -0,0 +1,34 @@
+/* Area: ffi_call
+ Purpose: Check return value long double.
+ Limitations: none.
+ PR: none.
+ Originator: <andreast@gcc.gnu.org> 20071113 */
+
+/* { dg-do run } */
+#include "ffitest.h"
+
+static long double return_ldl(long double ldl)
+{
+ return 2*ldl;
+}
+int main (void)
+{
+ ffi_cif cif;
+ ffi_type *args[MAX_ARGS];
+ void *values[MAX_ARGS];
+ long double ldl, rldl;
+
+ args[0] = &ffi_type_longdouble;
+ values[0] = &ldl;
+
+ /* Initialize the cif */
+ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
+ &ffi_type_longdouble, args) == FFI_OK);
+
+ for (ldl = -127.0; ldl < 127.0; ldl++)
+ {
+ ffi_call(&cif, FFI_FN(return_ldl), &rldl, values);
+ CHECK(rldl == 2 * ldl);
+ }
+ exit(0);
+}
diff --git a/libffi/testsuite/libffi.call/return_ll1.c b/libffi/testsuite/libffi.call/return_ll1.c
index 32fdfa122ff..5681d84b407 100644
--- a/libffi/testsuite/libffi.call/return_ll1.c
+++ b/libffi/testsuite/libffi.call/return_ll1.c
@@ -20,9 +20,9 @@ int main (void)
long long ll1;
unsigned ll0, ll2;
- args[0] = &ffi_type_uint32;
+ args[0] = &ffi_type_sint;
args[1] = &ffi_type_sint64;
- args[2] = &ffi_type_uint32;
+ args[2] = &ffi_type_sint;
values[0] = &ll0;
values[1] = &ll1;
values[2] = &ll2;
diff --git a/libffi/testsuite/libffi.call/return_sc.c b/libffi/testsuite/libffi.call/return_sc.c
index ddb26778695..19608ee7c8b 100644
--- a/libffi/testsuite/libffi.call/return_sc.c
+++ b/libffi/testsuite/libffi.call/return_sc.c
@@ -30,7 +30,7 @@ int main (void)
sc < (signed char) 127; sc++)
{
ffi_call(&cif, FFI_FN(return_sc), &rint, values);
- CHECK((signed char) rint == sc);
+ CHECK(rint == (ffi_arg) sc);
}
exit(0);
}
diff --git a/libffi/testsuite/libffi.call/return_sl.c b/libffi/testsuite/libffi.call/return_sl.c
new file mode 100644
index 00000000000..f0fd345f7a8
--- /dev/null
+++ b/libffi/testsuite/libffi.call/return_sl.c
@@ -0,0 +1,38 @@
+/* Area: ffi_call
+ Purpose: Check if long as return type is handled correctly.
+ Limitations: none.
+ PR: none.
+ */
+
+/* { dg-do run } */
+#include "ffitest.h"
+static long return_sl(long l1, long l2)
+{
+ return l1 - l2;
+}
+
+int main (void)
+{
+ ffi_cif cif;
+ ffi_type *args[MAX_ARGS];
+ void *values[MAX_ARGS];
+ ffi_arg res;
+ unsigned long l1, l2;
+
+ args[0] = &ffi_type_slong;
+ args[1] = &ffi_type_slong;
+ values[0] = &l1;
+ values[1] = &l2;
+
+ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2,
+ &ffi_type_slong, args) == FFI_OK);
+
+ l1 = 1073741823L;
+ l2 = 1073741824L;
+
+ ffi_call(&cif, FFI_FN(return_sl), &res, values);
+ printf("res: %ld, %ld\n", (long)res, l1 - l2);
+ /* { dg-output "res: -1, -1" } */
+
+ exit(0);
+}
diff --git a/libffi/testsuite/libffi.call/return_ul.c b/libffi/testsuite/libffi.call/return_ul.c
index 25102240bc8..12b266f0373 100644
--- a/libffi/testsuite/libffi.call/return_ul.c
+++ b/libffi/testsuite/libffi.call/return_ul.c
@@ -16,7 +16,7 @@ int main (void)
ffi_cif cif;
ffi_type *args[MAX_ARGS];
void *values[MAX_ARGS];
- unsigned long res;
+ ffi_arg res;
unsigned long ul1, ul2;
args[0] = &ffi_type_ulong;
@@ -31,7 +31,7 @@ int main (void)
ul2 = 1073741824L;
ffi_call(&cif, FFI_FN(return_ul), &res, values);
- printf("res: %ld, %ld\n", res, ul1 + ul2);
+ printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2);
/* { dg-output "res: 2147483647, 2147483647" } */
exit(0);
diff --git a/libffi/testsuite/libffi.special/unwindtest.cc b/libffi/testsuite/libffi.special/unwindtest.cc
index f27de0271d4..a3d803780ab 100644
--- a/libffi/testsuite/libffi.special/unwindtest.cc
+++ b/libffi/testsuite/libffi.special/unwindtest.cc
@@ -4,7 +4,7 @@
PR: none.
Originator: Jeff Sturm <jsturm@one-point.com> */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitestcxx.h"
void
diff --git a/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc b/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc
index 5f5f34b946a..29739cdb171 100644
--- a/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc
+++ b/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc
@@ -4,7 +4,7 @@
PR: none.
Originator: Andreas Tobler <andreast@gcc.gnu.org> 20061213 */
-/* { dg-do run { xfail mips64*-*-* } } */
+/* { dg-do run } */
#include "ffitestcxx.h"
static int checking(int a __UNUSED__, short b __UNUSED__,