This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: libffi 3.0.12 rc2 ready for testing
Hi Anthony,
================================================================================
Here's a patch to fix the libffi.call/many.c testsuite failures on
powerpc-linux due to an over eager assert which I first pointed out here:
http://sourceware.org/ml/libffi-discuss/2012/msg00093.html
Having looked at the code again, I believe the following patch is
the correct fix for this problem. With the following patch, we're
now down to zero unexpected testsuite failures on powerpc-linux.
Peter
2013-02-08 Peter Bergner <bergner@vnet.ibm.com>
* src/powerpc/ffi.c (ffi_prep_args_SYSV): Account for FP args pushed
on the stack.
diff -urpN -X /home/bergner/cvs/dontdiff libffi-3.0.12-rc1.orig/src/powerpc/ffi.c libffi-3.0.12-rc1/src/powerpc/ffi.c
--- libffi-3.0.12-rc1.orig/src/powerpc/ffi.c 2013-02-06 16:36:41.000000000 -0600
+++ libffi-3.0.12-rc1/src/powerpc/ffi.c 2013-02-08 12:07:53.000000000 -0600
@@ -370,6 +370,12 @@ ffi_prep_args_SYSV (extended_cif *ecif,
#ifndef __NO_FPRS__
FFI_ASSERT (fpr_base.u
<= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS);
+ /* The assert below is testing that the number of integer arguments agrees
+ with the number found in ffi_prep_cif_machdep(). However, intarg_count
+ is incremented whenever we place an FP arg on the stack, so account for
+ that before our assert test. */
+ if (fparg_count > NUM_FPR_ARG_REGISTERS)
+ intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS;
#endif
FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4);
}