Sunday, January 21, 2018

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 Callahan <bcallah@devio.us> 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?

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 passes 1845
> # of unexpected failures 15
>
> 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 -0000 1.35
> +++ Makefile 21 Jan 2018 19:41:05 -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
>
> @@ -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 -0000 1.7
> +++ patches/patch-configure 21 Jan 2018 19:34:49 -0000
> @@ -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 -0000 1.7
> +++ patches/patch-src_arm_ffi_c 21 Jan 2018 19:34:49 -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>
> ++

No comments:

Post a Comment