This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PowerPC64 libffi fixes


Fixes these PowerPC64 libffi testsuite failures.

FAIL: libffi.call/cls_12byte.c execution test
FAIL: libffi.call/cls_16byte.c execution test
FAIL: libffi.call/cls_20byte.c execution test
FAIL: libffi.call/cls_24byte.c execution test
FAIL: libffi.call/nested_struct.c execution test
FAIL: libffi.call/nested_struct1.c execution test
FAIL: libffi.call/problem1.c execution test

	* src/types.c (double, longdouble): Merge identical SH and ARM
	typedefs, and add POWERPC64.
	* src/powerpc/ffi.c (ffi_prep_args64): Correct next_arg calc for
	struct split over gpr and rest.
	(ffi_prep_cif_machdep): Correct intarg_count for structures.
	* src/powerpc/linux64.S (ffi_call_LINUX64): Fix gpr offsets.

Applying as obvious.

The following remain to be fixed.
FAIL: libffi.call/cls_3byte1.c execution test
FAIL: libffi.call/cls_5byte.c execution test
FAIL: libffi.call/cls_float.c output pattern test
FAIL: libffi.special/unwindtest.cc execution test

Index: libffi/src/types.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/src/types.c,v
retrieving revision 1.8
diff -u -p -r1.8 types.c
--- libffi/src/types.c	26 Nov 2002 22:24:05 -0000	1.8
+++ libffi/src/types.c	11 Sep 2003 04:58:35 -0000
@@ -76,12 +76,7 @@ FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_T
 FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
 FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE);
 
-#elif defined ARM
-
-FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
-FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
-
-#elif defined SH
+#elif defined ARM || defined SH || defined POWERPC64
 
 FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE);
 FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE);
Index: libffi/src/powerpc/ffi.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/src/powerpc/ffi.c,v
retrieving revision 1.6
diff -u -p -r1.6 ffi.c
--- libffi/src/powerpc/ffi.c	9 Sep 2003 17:37:53 -0000	1.6
+++ libffi/src/powerpc/ffi.c	11 Sep 2003 04:58:35 -0000
@@ -376,11 +376,11 @@ void hidden ffi_prep_args64(extended_cif
 	  words = ((*ptr)->size + 7) / 8;
 	  if (next_arg >= gpr_base && next_arg + words > gpr_end)
 	    {
-	      unsigned int first = (char *) gpr_end - (char *) next_arg;
+	      size_t first = (char *) gpr_end - (char *) next_arg;
 	      memcpy((char *) next_arg, (char *) *p_argv, first);
 	      memcpy((char *) rest, (char *) *p_argv + first,
 		     (*ptr)->size - first);
-	      next_arg = rest + words * 8 - first;
+	      next_arg = (unsigned long *) ((char *) rest + words * 8 - first);
 	    }
 	  else
 	    {
@@ -591,7 +591,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif 
 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
 	  case FFI_TYPE_LONGDOUBLE:
 #endif
-	    intarg_count += ((*ptr)->size + 7) & ~7;
+	    intarg_count += ((*ptr)->size + 7) / 8;
 	    break;
 
 	  default:
Index: libffi/src/powerpc/linux64.S
===================================================================
RCS file: /cvs/gcc/gcc/libffi/src/powerpc/linux64.S,v
retrieving revision 1.3
diff -u -p -r1.3 linux64.S
--- libffi/src/powerpc/linux64.S	1 Aug 2003 15:19:01 -0000	1.3
+++ libffi/src/powerpc/linux64.S	11 Sep 2003 04:58:35 -0000
@@ -73,10 +73,10 @@ ffi_call_LINUX64:
 	ld	%r5, -32-(6*8)(%r28)
 	ld	%r6, -32-(5*8)(%r28)
 	bf-	5, 1f
-	ld	%r7, -32-(4*4)(%r28)
-	ld	%r8, -32-(3*4)(%r28)
-	ld	%r9, -32-(2*4)(%r28)
-	ld	%r10, -32-(1*4)(%r28)
+	ld	%r7, -32-(4*8)(%r28)
+	ld	%r8, -32-(3*8)(%r28)
+	ld	%r9, -32-(2*8)(%r28)
+	ld	%r10, -32-(1*8)(%r28)
 1:
 
 	/* Load all the FP registers.  */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]