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]

[Patch] libffi-MIPS: Fix long double return types in n32/n64.


This patch fixes failures in the libffi testsuite for long double return
values.  These are the last remaining failures for mips64 in libffi.

The fix is to add special handling for long double return values.

Testing on mips64-unknown-linux-gnu n32 and n64.

OK to commit if no problems found?

2007-12-07  David Daney  <ddaney@avtrex.com>

    * src/mips/ffi.c (ffi_prep_cif_machdep): Handle long double return
    type.

Index: src/mips/ffi.c
===================================================================
--- src/mips/ffi.c	(revision 130659)
+++ src/mips/ffi.c	(working copy)
@@ -462,7 +462,13 @@ ffi_status ffi_prep_cif_machdep(ffi_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;

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