Commit cd2277cc796b96b149cd284ae85326529fe7fb9c

Anthony Green 2012-01-23T13:43:38

mend

diff --git a/ChangeLog b/ChangeLog
index 64d5b20..7e2b4d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
+2012-01-23  Andreas Schwab <schwab@linux-m68k.org>
+
+	* src/m68k/sysv.S (ffi_call_SYSV): Properly test for plain
+	mc68000.  Test for __HAVE_68881__ in addition to __MC68881__.
+
 2012-01-23  Alan Hourihane <alanh@fairlite.co.uk>
 
 	* src/m68k/ffi.c (ffi_prep_closure_loc): Fix ABI check.
-	* src/m68k/sysv.S: Support 68881.
 	* testsuite/libffi.call/return_sc.c (main): Fix test check.
 
 2012-01-19  Jakub Jelinek  <jakub@redhat.com>
diff --git a/configure.ac b/configure.ac
index b4a60c8..f56c7f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -339,7 +339,7 @@ case "$target" in
                  [Cannot use PROT_EXEC on this target, so, we revert to
                    alternative means])
      ;;
-     *-apple-darwin1[[10]]* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
+     *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
        AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
                  [Cannot use malloc on this target, so, we revert to
                    alternative means])
diff --git a/patches/m68k-patches b/patches/m68k-patches
index f756261..07642e2 100644
--- a/patches/m68k-patches
+++ b/patches/m68k-patches
@@ -16,6 +16,23 @@ Index: libffi/src/m68k/sysv.S
 ===================================================================
 --- libffi.orig/src/m68k/sysv.S
 +++ libffi/src/m68k/sysv.S
+@@ -1,6 +1,6 @@
+ /* -----------------------------------------------------------------------
+ 	
+-   sysv.S - Copyright (c) 1998 Andreas Schwab
++   sysv.S - Copyright (c) 1998, 2012 Andreas Schwab
+ 	    Copyright (c) 2008 Red Hat, Inc. 
+    
+    m68k Foreign Function Interface 
+@@ -87,7 +87,7 @@ ffi_call_SYSV:
+ 
+ 	| If the return value pointer is NULL, assume no return value.
+ 	| NOTE: On the mc68000, tst on an address register is not supported.
+-#if defined(__mc68000__) && !defined(__mcoldfire__)
++#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__)
+ 	cmp.w	#0, %a1
+ #else
+ 	tst.l	%a1
 @@ -109,7 +109,7 @@ retlongint:
  retfloat:
  	btst	#2,%d2
diff --git a/src/m68k/sysv.S b/src/m68k/sysv.S
index 6f17801..dfdd864 100644
--- a/src/m68k/sysv.S
+++ b/src/m68k/sysv.S
@@ -1,6 +1,6 @@
 /* -----------------------------------------------------------------------
 	
-   sysv.S - Copyright (c) 1998 Andreas Schwab
+   sysv.S - Copyright (c) 1998, 2012 Andreas Schwab
 	    Copyright (c) 2008 Red Hat, Inc. 
    
    m68k Foreign Function Interface 
@@ -87,7 +87,7 @@ ffi_call_SYSV:
 
 	| If the return value pointer is NULL, assume no return value.
 	| NOTE: On the mc68000, tst on an address register is not supported.
-#if defined(__mc68000__) && !defined(__mcoldfire__)
+#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__)
 	cmp.w	#0, %a1
 #else
 	tst.l	%a1