Hi,
Until we switch the arm ABI to ATPCS or AAPCS this fixes libffi on arm.
All tests are passing now.
OK?
f.-
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/libffi/Makefile,v
retrieving revision 1.23
diff -u -p -u -p -r1.23 Makefile
--- Makefile 15 Jul 2013 19:01:56 -0000 1.23
+++ Makefile 20 Oct 2013 19:30:42 -0000
@@ -3,7 +3,7 @@
COMMENT= Foreign Function Interface
DISTNAME= libffi-3.0.9
-REVISION= 5
+REVISION= 6
SHARED_LIBS += ffi 0.0 # .5.9
CATEGORIES= devel
Index: patches/patch-src_arm_ffi_c
===================================================================
RCS file: /cvs/ports/devel/libffi/patches/patch-src_arm_ffi_c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-src_arm_ffi_c
--- patches/patch-src_arm_ffi_c 7 May 2013 20:04:18 -0000 1.2
+++ patches/patch-src_arm_ffi_c 20 Oct 2013 19:30:42 -0000
@@ -1,9 +1,10 @@
$OpenBSD: patch-src_arm_ffi_c,v 1.2 2013/05/07 20:04:18 jasper Exp $
-warning: implicit declaration of function '__clear_cache'
+Fix warning: implicit declaration of function '__clear_cache' and
+change the code to follow our current ABI (APCS).
---- src/arm/ffi.c.orig Tue Dec 29 16:22:26 2009
-+++ src/arm/ffi.c Tue May 7 22:01:23 2013
+--- src/arm/ffi.c.orig Tue Dec 29 15:22:26 2009
++++ src/arm/ffi.c Sun Oct 20 17:23:42 2013
@@ -29,6 +29,8 @@
#include <stdlib.h>
@@ -13,3 +14,13 @@ warning: implicit declaration of functio
/* ffi_prep_args is called by the assembly routine once stack space
has been allocated for the function's arguments */
+@@ -130,7 +132,8 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
+ break;
+
+ case FFI_TYPE_STRUCT:
+- if (cif->rtype->size <= 4)
++ if (cif->rtype->size <= 4 && cif->rtype->elements[0] &&
++ !cif->rtype->elements[1])
+ /* A Composite Type not larger than 4 bytes is returned in r0. */
+ cif->flags = (unsigned)FFI_TYPE_INT;
+ else