From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Dec 5 15:00:00 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8E7045C for ; Thu, 5 Dec 2013 15:00:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 909E91228 for ; Thu, 5 Dec 2013 15:00:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rB5F00ff051514 for ; Thu, 5 Dec 2013 15:00:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rB5F00dP051513; Thu, 5 Dec 2013 15:00:00 GMT (envelope-from gnats) Resent-Date: Thu, 5 Dec 2013 15:00:00 GMT Resent-Message-Id: <201312051500.rB5F00dP051513@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kubilay Kocak Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 06C5324A; Thu, 5 Dec 2013 14:50:32 +0000 (UTC) Received: from mail-pb0-x22a.google.com (mail-pb0-x22a.google.com [IPv6:2607:f8b0:400e:c01::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CC48E11C5; Thu, 5 Dec 2013 14:50:31 +0000 (UTC) Received: by mail-pb0-f42.google.com with SMTP id uo5so26236132pbc.1 for ; Thu, 05 Dec 2013 06:50:31 -0800 (PST) Received: from 9-STABLE-amd64.elysium (ppp59-167-128-11.static.internode.on.net. [59.167.128.11]) by mx.google.com with ESMTPSA id e6sm37801179pbg.4.2013.12.05.06.50.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Dec 2013 06:50:30 -0800 (PST) Received: by 9-STABLE-amd64.elysium (Postfix, from userid 1001) id 424DE39F1F; Fri, 6 Dec 2013 01:50:25 +1100 (EST) Message-Id: <20131205145025.424DE39F1F@9-STABLE-amd64.elysium> Date: Fri, 6 Dec 2013 01:50:25 +1100 (EST) From: Kubilay Kocak To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/184517: [PATCH] devel/libffi: Fix abort() on ARM related to __clear_cache() Cc: zeising@FreeBSD.org X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2013 15:00:00 -0000 >Number: 184517 >Category: ports >Synopsis: [PATCH] devel/libffi: Fix abort() on ARM related to __clear_cache() >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Dec 05 15:00:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Kubilay Kocak >Release: FreeBSD 9.2-STABLE amd64 >Organization: >Environment: System: FreeBSD 9-STABLE-amd64.elysium 9.2-STABLE FreeBSD 9.2-STABLE #3 r258507: Sun Nov 24 18:59:42 EST >Description: devel/libffi: Fix abort() on ARM related to __clear_cache() The current ARM __clear_cache() implementation does nothing #if __i386__ || __x86_64__ #else abort(); This is also the root cause of abort() on import for the ctypes module on Python, as they bundle libffi. [1] This change addresses that issue until a permanent fix is committed to base, and in addition is required to support Python ports that use devel/libffi unconditionally, or users that compile Python against this port. A huge shout out to cognet@ who helped diagnose the issue and created the patch to address it. Thank you! While I'm here: - Enable STAGE support, remove MAN macros - Sort USE_* section PR: ports/149167 [1] Submitted by: cognet Reviewed by: cognet Port maintainer (zeising@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 0.99_11 (mode: change, diff: ports) >How-To-Repeat: >Fix: --- libffi-3.0.13_1.patch begins here --- diff -ruN /usr/ports/devel/libffi/Makefile ./Makefile --- /usr/ports/devel/libffi/Makefile 2013-09-21 03:13:42.000000000 +1000 +++ ./Makefile 2013-12-04 00:52:22.225037815 +1100 @@ -1,8 +1,9 @@ # Created by: Horance Chou -# $FreeBSD: devel/libffi/Makefile 327724 2013-09-20 17:13:42Z bapt $ +# $FreeBSD: head/devel/libffi/Makefile 327724 2013-09-20 17:13:42Z bapt $ PORTNAME= libffi PORTVERSION= 3.0.13 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= SOURCEWARE MASTER_SITE_SUBDIR= ${PORTNAME} @@ -12,30 +13,27 @@ TEST_DEPENDS= runtest:${PORTSDIR}/misc/dejagnu +USES= pathfix pkgconfig +USE_LDCONFIG= yes +GNU_CONFIGURE= yes + OPTIONS_DEFINE= TESTS TESTS_DESC= Include tools for test suite -NO_STAGE= yes .include .if ${PORT_OPTIONS:MTESTS} BUILD_DEPENDS:= ${TEST_DEPENDS} .endif -GNU_CONFIGURE= yes -USE_LDCONFIG= yes -USES= pathfix pkgconfig -PLIST_SUB= PORTVERSION=${PORTVERSION} - INFO= libffi - -MAN3= ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 +PLIST_SUB= PORTVERSION=${PORTVERSION} post-install: @${LN} -sf ../lib/libffi-${PORTVERSION}/include/ffi.h \ - ${PREFIX}/include/ + ${STAGEDIR}${PREFIX}/include/ @${LN} -sf ../lib/libffi-${PORTVERSION}/include/ffitarget.h \ - ${PREFIX}/include/ + ${STAGEDIR}${PREFIX}/include/ regression-test: build @cd ${WRKSRC} && ${MAKE} check diff -ruN /usr/ports/devel/libffi/files/patch-src__arm__ffi.c ./files/patch-src__arm__ffi.c --- /usr/ports/devel/libffi/files/patch-src__arm__ffi.c 1970-01-01 10:00:00.000000000 +1000 +++ ./files/patch-src__arm__ffi.c 2013-12-03 19:32:11.292023441 +1100 @@ -0,0 +1,35 @@ +# Description: Fix _ctypes abort on import for FreeBSD/ARM +# PR: ports/149167 +# Patch by: cognet@ + +--- ./src/arm/ffi.c.orig 2013-03-16 22:19:39.000000000 +1100 ++++ ./src/arm/ffi.c 2013-12-03 19:30:58.440924300 +1100 +@@ -33,6 +33,11 @@ + + #include + ++#if defined(__FreeBSD__) && defined(__arm__) ++#include ++#include ++#endif ++ + /* Forward declares. */ + static int vfp_type_p (ffi_type *); + static void layout_vfp_args (ffi_cif *); +@@ -582,6 +587,16 @@ + + #else + ++#if defined(__FreeBSD__) && defined(__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); \ + unsigned int __fun = (unsigned int)(FUN); \ diff -ruN /usr/ports/devel/libffi/pkg-plist ./pkg-plist --- /usr/ports/devel/libffi/pkg-plist 2013-01-29 11:35:32.000000000 +1100 +++ ./pkg-plist 2013-12-04 00:01:30.161316938 +1100 @@ -7,5 +7,9 @@ lib/libffi.so lib/libffi.so.6 libdata/pkgconfig/libffi.pc +man/man3/ffi.3.gz +man/man3/ffi_call.3.gz +man/man3/ffi_prep_cif.3.gz +man/man3/ffi_prep_cif_var.3.gz @dirrm lib/libffi-%%PORTVERSION%%/include @dirrm lib/libffi-%%PORTVERSION%% --- libffi-3.0.13_1.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: