On 01/21/18 08:13, Peter Hessler wrote:
On 2018 Jan 21 (Sun) at 02:06:52 -0500 (-0500), Brian Callahan wrote:
:Finally, it looks like libffi needs libc++abi on arm for at least some
:functions, as
:experienced with lang/snobol4, its configure script didn't pick up libffi and
:instead
:complained about this:
:/usr/local/lib/libffi.so.1.2: undefined reference to `__aeabi_unwind_cpp_pr0'
:/usr/local/lib/libffi.so.1.2: undefined reference to `__aeabi_unwind_cpp_pr1'
:Those functions are in libc++abi.
:
Did you mean to include a patch to libffi.pc to address these issues?
Ugh. No more 2am diffs more me.
We just want this to be for arm, of course, to avoid breaking all gcc
archs. Attached diff deals.
~Brian
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/libffi/Makefile,v
retrieving revision 1.35
diff -u -p -r1.35 Makefile
--- Makefile 26 May 2016 20:48:50 -0000 1.35
+++ Makefile 21 Jan 2018 15:05:34 -0000
@@ -3,7 +3,7 @@
COMMENT= Foreign Function Interface
DISTNAME= libffi-3.2.1
-REVISION= 2
+REVISION= 3
SHARED_LIBS += ffi 1.2 # .6.4
CATEGORIES= devel
@@ -23,5 +23,10 @@ TEST_DEPENDS= devel/dejagnu
CONFIGURE_STYLE= gnu
FAKE_FLAGS+= includesdir="${PREFIX}/include"
+
+.if ${MACHINE_ARCH:Marm}
+pre-configure:
+ sed -i 's,-lffi,-lffi -lc++abi,g' ${WRKSRC}/libffi.pc.in
+.endif
.include <bsd.port.mk>
Index: patches/patch-src_arm_ffi_c
===================================================================
RCS file: /cvs/ports/devel/libffi/patches/patch-src_arm_ffi_c,v
retrieving revision 1.7
diff -u -p -r1.7 patch-src_arm_ffi_c
--- patches/patch-src_arm_ffi_c 15 Jul 2015 17:06:48 -0000 1.7
+++ patches/patch-src_arm_ffi_c 21 Jan 2018 15:05:34 -0000
@@ -1,15 +1,36 @@
$OpenBSD: patch-src_arm_ffi_c,v 1.7 2015/07/15 17:06:48 jasper Exp $
-Fix warning: implicit declaration of function '__clear_cache'
+https://svnweb.freebsd.org/ports/head/devel/libffi/files/patch-src__arm__ffi.c?revision=337118&view=markup
---- src/arm/ffi.c.orig Fri Apr 25 19:45:13 2014
-+++ src/arm/ffi.c Mon Sep 15 22:00:37 2014
-@@ -37,6 +37,8 @@
+Index: src/arm/ffi.c
+--- src/arm/ffi.c.orig
++++ src/arm/ffi.c
+@@ -33,6 +33,11 @@
+
+ #include <stdlib.h>
+
++#ifdef __arm__
++#include <machine/sysarch.h>
++#include <stdint.h>
++#endif
++
+ /* Forward declares. */
static int vfp_type_p (ffi_type *);
static void layout_vfp_args (ffi_cif *);
+@@ -750,6 +755,16 @@ ffi_closure_free (void *ptr)
+ }
-+extern void __clear_cache(char *beg, char *end);
+ #else
+
- int ffi_prep_args_SYSV(char *stack, extended_cif *ecif, float *vfp_space);
- int ffi_prep_args_VFP(char *stack, extended_cif *ecif, float *vfp_space);
++#ifdef __arm__
++#define __clear_cache(start, end) do { \
++ struct arm_sync_icache_args ua; \
++ \
++ ua.addr = (uintptr_t)(start); \
++ ua.len = (char *)(end) - (char *)start; \
++ sysarch(ARM_SYNC_ICACHE, &ua); \
++ } while (0);
++#endif
+ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
+ ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
Index: patches/patch-src_arm_sysv_S
===================================================================
RCS file: patches/patch-src_arm_sysv_S
diff -N patches/patch-src_arm_sysv_S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_arm_sysv_S 21 Jan 2018 15:05:34 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+https://github.com/libffi/libffi/issues/162
+
+Index: src/arm/sysv.S
+--- src/arm/sysv.S.orig
++++ src/arm/sysv.S
+@@ -396,7 +396,7 @@ LSYM(Lbase_args):
+ beq LSYM(Lepilogue_vfp)
+
+ cmp r3, #FFI_TYPE_SINT64
+- stmeqia r2, {r0, r1}
++ stmiaeq r2, {r0, r1}
+ beq LSYM(Lepilogue_vfp)
+
+ cmp r3, #FFI_TYPE_FLOAT