public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch libffi SH] Fix failures for libffi.call/err_bad_abi.c
@ 2012-03-13 22:51 Kaz Kojima
  0 siblings, 0 replies; only message in thread
From: Kaz Kojima @ 2012-03-13 22:51 UTC (permalink / raw)
  To: gcc-patches

Hi,

I've applied the attached patch which fixes failures for
libffi.call/err_bad_abi.c on SH.  It's similar to the changes
done already on other targets.  Tested on sh-linux.

Regards,
	kaz
--
2012-03-13  Kaz Kojima  <kkojima@gcc.gnu.org>

	* src/sh/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test,
	just return FFI_BAD_ABI when things are wrong.
	* src/sh64/ffi.c (ffi_prep_closure_loc): Ditto.

diff -upr ORIG/trunk/libffi/src/sh/ffi.c trunk/libffi/src/sh/ffi.c
--- ORIG/trunk/libffi/src/sh/ffi.c	2009-06-06 13:12:01.000000000 +0900
+++ trunk/libffi/src/sh/ffi.c	2012-03-12 22:06:43.000000000 +0900
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------
-   ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Kaz Kojima
+   ffi.c - Copyright (c) 2002-2008, 2012 Kaz Kojima
            Copyright (c) 2008 Red Hat, Inc.
    
    SuperH Foreign Function Interface 
@@ -463,7 +463,8 @@ ffi_prep_closure_loc (ffi_closure* closu
   unsigned int *tramp;
   unsigned int insn;
 
-  FFI_ASSERT (cif->abi == FFI_GCC_SYSV);
+  if (cif->abi != FFI_SYSV)
+    return FFI_BAD_ABI;
 
   tramp = (unsigned int *) &closure->tramp[0];
   /* Set T bit if the function returns a struct pointed with R2.  */
diff -upr ORIG/trunk/libffi/src/sh64/ffi.c trunk/libffi/src/sh64/ffi.c
--- ORIG/trunk/libffi/src/sh64/ffi.c	2009-06-06 13:12:00.000000000 +0900
+++ trunk/libffi/src/sh64/ffi.c	2012-03-12 22:07:28.000000000 +0900
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------
-   ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima
+   ffi.c - Copyright (c) 2003, 2004, 2006, 2007, 2012 Kaz Kojima
            Copyright (c) 2008 Anthony Green
    
    SuperH SHmedia Foreign Function Interface 
@@ -302,7 +302,8 @@ ffi_prep_closure_loc (ffi_closure *closu
 {
   unsigned int *tramp;
 
-  FFI_ASSERT (cif->abi == FFI_GCC_SYSV);
+  if (cif->abi != FFI_SYSV)
+    return FFI_BAD_ABI;
 
   tramp = (unsigned int *) &closure->tramp[0];
   /* Since ffi_closure is an aligned object, the ffi trampoline is

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-13 22:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-13 22:51 [patch libffi SH] Fix failures for libffi.call/err_bad_abi.c Kaz Kojima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).