Re: FIX: devel/libffi on armv7/clang
On Sun, Jan 21, 2018 at 09:45:53PM +0100, Jeremie Courreges-Anglas wrote: > > +cc maintainer > > On Sun, Jan 21 2018, Brian Callahanwrote: > > 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. > > I think it would be better to link libffi against -lc++abi, inter-libs deps > would be enough and would ensure that consumers don't need to use > pkg-config. static builds would still need the pkg-config goo, but we > don't have static archs any more. Do we have such ports? Linking libffi against c++abi makes sense and matches how a similiar situation is handled with devel/luajit. > > The diff below also adds c++abi to WANTLIB. > > Test summary: > # of expected passes1845 > # of unexpected failures15 > > Now testing some consumer ports. > > > Index: Makefile > === > RCS file: /d/cvs/ports/devel/libffi/Makefile,v > retrieving revision 1.35 > diff -u -p -r1.35 Makefile > --- Makefile 26 May 2016 20:48:50 - 1.35 > +++ Makefile 21 Jan 2018 19:41:05 - > @@ -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 > > @@ -15,6 +15,10 @@ HOMEPAGE= http://sourceware.org/libffi/ > PERMIT_PACKAGE_CDROM=Yes > > WANTLIB += pthread > +# needed for unwind symbols > +.if ${MACHINE_ARCH} == "arm" > +WANTLIB += c++abi > +.endif > > MASTER_SITES=ftp://sourceware.org/pub/libffi/ > > Index: patches/patch-configure > === > RCS file: /d/cvs/ports/devel/libffi/patches/patch-configure,v > retrieving revision 1.7 > diff -u -p -r1.7 patch-configure > --- patches/patch-configure 28 Jan 2016 08:40:47 - 1.7 > +++ patches/patch-configure 21 Jan 2018 19:34:49 - > @@ -1,14 +1,19 @@ > $OpenBSD: patch-configure,v 1.7 2016/01/28 08:40:47 jasper Exp $ > > -- Always link with -pthread for libffi > +- Always link with -pthread for libffi (XXX not needed any more?) > +- Link with libc++abi on arm (to access unwind symbols) > > configure.orig Tue Jan 26 18:55:54 2016 > -+++ configureTue Jan 26 18:56:20 2016 > -@@ -18522,6 +18522,12 @@ $as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h > +Index: configure > +--- configure.orig > configure > +@@ -18522,6 +18522,15 @@ $as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h > > fi > > +case "$target" in > ++arm-*-openbsd*) > ++ LDFLAGS="-lpthread -lc++abi $LDFLAGS" > ++;; > +*-*-openbsd*) > + LDFLAGS="-lpthread $LDFLAGS" > +;; > Index: patches/patch-src_arm_ffi_c > === > RCS file: /d/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 - 1.7 > +++ patches/patch-src_arm_ffi_c 21 Jan 2018 19:34:49 - > @@ -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=markup > > src/arm/ffi.c.orig Fri Apr 25 19:45:13 2014 > -+++ src/arm/ffi.cMon 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 > + > ++#ifdef __arm__ > ++#include > ++#include > ++#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 { >
Re: FIX: devel/libffi on armv7/clang
On 2018 Jan 21 (Sun) at 22:18:21 +0100 (+0100), Jeremie Courreges-Anglas wrote: :On Sun, Jan 21 2018, Peter Hesslerwrote: :> On 2018 Jan 21 (Sun) at 21:45:53 +0100 (+0100), Jeremie Courreges-Anglas wrote: :> :On Sun, Jan 21 2018, Brian Callahan wrote: :> :> 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. :> : :> :I think it would be better to link libffi against -lc++abi, inter-libs deps :> :would be enough and would ensure that consumers don't need to use :> :pkg-config. static builds would still need the pkg-config goo, but we :> :don't have static archs any more. Do we have such ports? :> : :> :> iirc, lld doesn't do inter-lib deps so we would still need pkg-config :> help. while this isn't a problem *yet*, I'd like to avoid it being a :> problem in the (hopefully near) future. : :lld's behavior is a bit more convoluted: say your program links against :libfoo, and libfoo in turn links against libbar. As long as your :program only uses symbols from libfoo, you're fine. If the program also :use symbols from libbar, you must tell lld to link your program against :libfoo *and* libbar*. : :This is not the case here, linking libffi against libc++abi should be :enough. If a port uses libffi and also needs functions from :libc++abi/libunwind, it should specify so. : :* There's probably a more formal, better wording for the difference in : behavior between our old ld(1) and lld. : Ahh, then I misunderstood some of the details. Thanks for the explanation! -- The other day I put instant coffee in my microwave oven ... I almost went back in time. -- Steven Wright
Re: FIX: devel/libffi on armv7/clang
On Sun, Jan 21 2018, Peter Hesslerwrote: > On 2018 Jan 21 (Sun) at 21:45:53 +0100 (+0100), Jeremie Courreges-Anglas > wrote: > :On Sun, Jan 21 2018, Brian Callahan wrote: > :> 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. > : > :I think it would be better to link libffi against -lc++abi, inter-libs deps > :would be enough and would ensure that consumers don't need to use > :pkg-config. static builds would still need the pkg-config goo, but we > :don't have static archs any more. Do we have such ports? > : > > iirc, lld doesn't do inter-lib deps so we would still need pkg-config > help. while this isn't a problem *yet*, I'd like to avoid it being a > problem in the (hopefully near) future. lld's behavior is a bit more convoluted: say your program links against libfoo, and libfoo in turn links against libbar. As long as your program only uses symbols from libfoo, you're fine. If the program also use symbols from libbar, you must tell lld to link your program against libfoo *and* libbar*. This is not the case here, linking libffi against libc++abi should be enough. If a port uses libffi and also needs functions from libc++abi/libunwind, it should specify so. * There's probably a more formal, better wording for the difference in behavior between our old ld(1) and lld. -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: FIX: devel/libffi on armv7/clang
On 2018 Jan 21 (Sun) at 21:45:53 +0100 (+0100), Jeremie Courreges-Anglas wrote: :On Sun, Jan 21 2018, Brian Callahanwrote: :> 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. : :I think it would be better to link libffi against -lc++abi, inter-libs deps :would be enough and would ensure that consumers don't need to use :pkg-config. static builds would still need the pkg-config goo, but we :don't have static archs any more. Do we have such ports? : iirc, lld doesn't do inter-lib deps so we would still need pkg-config help. while this isn't a problem *yet*, I'd like to avoid it being a problem in the (hopefully near) future. -- Corruption is not the #1 priority of the Police Commissioner. His job is to enforce the law and fight crime. -- P.B.A. President E. J. Kiernan
Re: FIX: devel/libffi on armv7/clang
+cc maintainer On Sun, Jan 21 2018, Brian Callahanwrote: > 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. I think it would be better to link libffi against -lc++abi, inter-libs deps would be enough and would ensure that consumers don't need to use pkg-config. static builds would still need the pkg-config goo, but we don't have static archs any more. Do we have such ports? The diff below also adds c++abi to WANTLIB. Test summary: # of expected passes1845 # of unexpected failures15 Now testing some consumer ports. Index: Makefile === RCS file: /d/cvs/ports/devel/libffi/Makefile,v retrieving revision 1.35 diff -u -p -r1.35 Makefile --- Makefile26 May 2016 20:48:50 - 1.35 +++ Makefile21 Jan 2018 19:41:05 - @@ -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 @@ -15,6 +15,10 @@ HOMEPAGE=http://sourceware.org/libffi/ PERMIT_PACKAGE_CDROM= Yes WANTLIB += pthread +# needed for unwind symbols +.if ${MACHINE_ARCH} == "arm" +WANTLIB += c++abi +.endif MASTER_SITES= ftp://sourceware.org/pub/libffi/ Index: patches/patch-configure === RCS file: /d/cvs/ports/devel/libffi/patches/patch-configure,v retrieving revision 1.7 diff -u -p -r1.7 patch-configure --- patches/patch-configure 28 Jan 2016 08:40:47 - 1.7 +++ patches/patch-configure 21 Jan 2018 19:34:49 - @@ -1,14 +1,19 @@ $OpenBSD: patch-configure,v 1.7 2016/01/28 08:40:47 jasper Exp $ -- Always link with -pthread for libffi +- Always link with -pthread for libffi (XXX not needed any more?) +- Link with libc++abi on arm (to access unwind symbols) configure.orig Tue Jan 26 18:55:54 2016 -+++ configure Tue Jan 26 18:56:20 2016 -@@ -18522,6 +18522,12 @@ $as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h +Index: configure +--- configure.orig configure +@@ -18522,6 +18522,15 @@ $as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h fi +case "$target" in ++arm-*-openbsd*) ++ LDFLAGS="-lpthread -lc++abi $LDFLAGS" ++;; +*-*-openbsd*) + LDFLAGS="-lpthread $LDFLAGS" +;; Index: patches/patch-src_arm_ffi_c === RCS file: /d/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 - 1.7 +++ patches/patch-src_arm_ffi_c 21 Jan 2018 19:34:49 - @@ -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=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 + ++#ifdef __arm__ ++#include ++#include ++#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, ); \ ++ } while (0); ++#endif + #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX)\ +
Re: FIX: devel/libffi on armv7/clang
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 - 1.35 +++ Makefile 21 Jan 2018 15:05:34 - @@ -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 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 - 1.7 +++ patches/patch-src_arm_ffi_c 21 Jan 2018 15:05:34 - @@ -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=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 + ++#ifdef __arm__ ++#include ++#include ++#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, );\ ++ } 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 - +++ patches/patch-src_arm_sysv_S 21 Jan 2018 15:05:34 - @@ -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
Re: FIX: devel/libffi on armv7/clang
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? -- Idaho state law makes it illegal for a man to give his sweetheart a box of candy weighing less than fifty pounds.
FIX: devel/libffi on armv7/clang
Hi ports -- devel/libffi failed to build for me on my Orange Pi Zero (armv7) using the latest snapshot. It's a clang thing, FreeBSD dealt with it like such: https://github.com/libffi/libffi/issues/162 So let's do the same thing. The change in patches/patch_src_arm_ffi_c is also necessary. Without it, trying to build py-setuptools Abort Traps immediately. With the patch, everything seems OK. However, a ton of tests fail: # of expected passes 10 # of unexpected failures 685 # of unresolved testcases 675 But I don't know the previous state of things. So I don't know if this is a change or as expected. 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. Also taking suggestions for #ifdef __arm__ defines in the event they would also catch arm64. Comments/OK? ~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 - 1.35 +++ Makefile 21 Jan 2018 05:11:17 - @@ -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 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 - 1.7 +++ patches/patch-src_arm_ffi_c 21 Jan 2018 05:11:17 - @@ -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=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 + ++#ifdef __arm__ ++#include ++#include ++#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, );\ ++ } 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 - +++ patches/patch-src_arm_sysv_S 21 Jan 2018 05:11:17 - @@ -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