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, fix powerpc-unknown-freebsd


Hi all,

yeah, I shot myself in the toe. When I added FFI_LINUX_SOFT_FLOAT support I did mess up with SMALL_STRUCTS on FFI_SYSV. Reminds me to always TEST!

This patch fixes libffi compilation and test suite on powerpc-unknown-freebsd.

Tested on 4.3 and 4.4, aka. trunk.

On 4.3 no failures, on trunk some issues with _Unwind_GetIPInfo in the unwind tests. These I'll address later. These are _not_ part of my mess.

Ok for 4.3 and trunk?

Test Run By andreast on Mon Aug 18 21:35:35 2008
Native configuration is powerpc-unknown-freebsd7.0

=== libffi tests ===

Schedule of variations:
    unix

=== libffi Summary ===

# of expected passes		1389
# of unsupported tests		10


Thanks, Andreas

2008-08-18 Andreas Tobler <a.tobler@schweiz.org>

	* src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and
	FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum.
	Adjust copyright notice.
	* src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix bit position
	calculation for FFI_SYSV_TYPE_SMALL_STRUCT.
	(ffi_closure_helper_SYSV): Fix return type for
	FFI_SYSV_TYPE_SMALL_STRUCT.
	Adjust copyright notice.
Index: src/powerpc/ffitarget.h
===================================================================
--- src/powerpc/ffitarget.h	(revision 139196)
+++ src/powerpc/ffitarget.h	(working copy)
@@ -1,6 +1,6 @@
 /* -----------------------------------------------------------------*-C-*-
    ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
-   Copyright (C) 2007 Free Software Foundation, Inc
+   Copyright (C) 2007, 2008 Free Software Foundation, Inc
    Target configuration macros for PowerPC.
 
    Permission is hereby granted, free of charge, to any person obtaining
@@ -77,6 +77,8 @@
   FFI_SYSV,
   FFI_GCC_SYSV,
   FFI_LINUX64,
+  FFI_LINUX,
+  FFI_LINUX_SOFT_FLOAT,
   FFI_DEFAULT_ABI = FFI_SYSV,
 #endif
 
Index: src/powerpc/ffi.c
===================================================================
--- src/powerpc/ffi.c	(revision 139196)
+++ src/powerpc/ffi.c	(working copy)
@@ -1,6 +1,6 @@
 /* -----------------------------------------------------------------------
    ffi.c - Copyright (c) 1998 Geoffrey Keating
-   Copyright (C) 2007 Free Software Foundation, Inc
+   Copyright (C) 2007, 2008 Free Software Foundation, Inc
 
    PowerPC Foreign Function Interface
 
@@ -679,14 +679,14 @@
 		 The same applies for the structs returned in r3/r4.  */
 	      if (size <= 4)
 		{
-		  flags |= 1 << (31 - FFI_SYSV_TYPE_SMALL_STRUCT - 1);
+		  flags |= 1 << (31 - FFI_SYSV_TYPE_SMALL_STRUCT + 1);
 		  flags |= 8 * (4 - size) << 4;
 		  break;
 		}
 	      /* These structs are returned in r3 and r4. See above.   */
 	      if  (size <= 8)
 		{
-		  flags |= 1 << (31 - FFI_SYSV_TYPE_SMALL_STRUCT - 2);
+		  flags |= 1 << (31 - FFI_SYSV_TYPE_SMALL_STRUCT);
 		  flags |= 8 * (8 - size) << 4;
 		  break;
 		}
@@ -1251,7 +1251,7 @@
      we have to tell ffi_closure_SYSV how to treat them.  */
   if (cif->abi == FFI_SYSV && cif->rtype->type == FFI_TYPE_STRUCT
       && size <= 8)
-    return FFI_SYSV_TYPE_SMALL_STRUCT + size;
+    return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size;
 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
   else if (cif->rtype->type == FFI_TYPE_LONGDOUBLE
 	   && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT)

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