This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi 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]

Re: libffi fails to build on powerpc64-linux


On Tue, 2012-03-06 at 09:34 -0600, Peter Bergner wrote:
> On Mon, 2012-03-05 at 22:18 -0500, Anthony Green wrote:
> > At this point, I'm hoping that Kyle Moffett, the author of this patch
> > can have a look.  My guess is that either I mis-applied the patch, or
> > he posted the wrong patch to apply.
> 
> Agreed, it would be nice for Kyle to comment.  Looking at the bugzilla
> above, he said:
> 
> > This passes the testsuite on soft-floating-point PowerPC, and it builds
> > and passes the testsuite on PowerPC e500 systems which cannot even
> > assemble the regular floating-point instruction set.
> 
> Both of these are non FP power systems, so I can see why he didn't
> see these build errors, since the broken code is inside of
> "#ifndef __NO_FPRS__" (double negative?).

Looking at the bugzilla further, I noticed Kyle has a blog here that
mentions he has moved to Google, so that explains why his email address
was bouncing.  I'm also guessing he's no longer interested in PowerPC
issues now that he's no longer at Boeing.

That said, looking farther down that debian bugzilla, I noticed someone
complained about his patch breaking the debian build.  He attached a
patch:

  http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=40;filename=libffi-powerpc-build-fix.patch;att=1;bug=644338


If you ignore the debian specific changes and look at the src/powerpc/ffi.c
change, you'll see it's the same as my patch, minus the hunks of my patch
that are silencing warnings, so I think my patch is probably safe to take
as is.  Therefore, I'm officially submitting the patch below to fix the
build issues.

That still leaves the 32-bit many.c testsuite breakage I am seeing, but I
think that should be fixed in a separate patch since it is not related to
these changes at all.

Peter


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

diff --git a/src/powerpc/ffi.c b/src/powerpc/ffi.c
index 1920c91..baca694 100644
--- a/src/powerpc/ffi.c
+++ b/src/powerpc/ffi.c
@@ -146,6 +146,7 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
   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 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
   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 @@ ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack)
 
 	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 @@ ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
    */
   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 @@ ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue,
 
 	  if (nf < 8)
 	    {
-	      temp = pfr->d;
+	      double temp = pfr->d;
 	      pfr->f = (float) temp;
 	      avalue[i] = pfr;
 	      nf++;



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