Patchwork [committed] Fix PR2497, libffi build breakage on powerpc64-*

login
register
mail settings
Submitter Peter Bergner
Date April 2, 2012, 6:47 p.m.
Message ID <1333392457.22518.17.camel@otta>
Download mbox | patch
Permalink /patch/150225/
State New
Headers show

Comments

Peter Bergner - April 2, 2012, 6:47 p.m.
I have committed the following patch to fix the libffi build breakage I'm
seeing on powerpc64-linux (when building java) which was caused by the
recent merge of upstream libffi.  Anthony Green ack'd this patch for
upstream, but said to commit it here and he'd merge the gcc sources
back to upstream libffi.

libffi/

        * src/powerpc/ffi.c (ffi_prep_args_SYSV): Declare double_tmp.
        Silence casting pointer to integer of different size warning.
        Delete goto to previously deleted label.
        (ffi_call): Silence possibly undefined warning.
        (ffi_closure_helper_SYSV): Declare variable type.

Patch

Index: libffi/src/powerpc/ffi.c
===================================================================
--- libffi/src/powerpc/ffi.c	(revision 186090)
+++ libffi/src/powerpc/ffi.c	(revision 186091)
@@ -146,6 +146,7 @@ 
   gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS;
   intarg_count = 0;
 #ifndef __NO_FPRS__
+  double double_tmp;
   fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS;
   fparg_count = 0;
   copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c);
@@ -155,9 +156,9 @@ 
   next_arg.u = stack + 2;
 
   /* Check that everything starts aligned properly.  */
-  FFI_ASSERT (((unsigned) (char *) stack & 0xF) == 0);
-  FFI_ASSERT (((unsigned) copy_space.c & 0xF) == 0);
-  FFI_ASSERT (((unsigned) stacktop.c & 0xF) == 0);
+  FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0);
+  FFI_ASSERT (((unsigned long) copy_space.c & 0xF) == 0);
+  FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0);
   FFI_ASSERT ((bytes & 0xF) == 0);
   FFI_ASSERT (copy_space.c >= next_arg.c);
 
@@ -211,8 +212,6 @@ 
 
 	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)
@@ -925,7 +924,7 @@ 
    */
   unsigned int smst_buffer[2];
   extended_cif ecif;
-  unsigned int rsize;
+  unsigned int rsize = 0;
 
   ecif.cif = cif;
   ecif.avalue = avalue;
@@ -1132,7 +1131,7 @@ 
 
 	  if (nf < 8)
 	    {
-	      temp = pfr->d;
+	      double temp = pfr->d;
 	      pfr->f = (float) temp;
 	      avalue[i] = pfr;
 	      nf++;