aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python31/files
diff options
context:
space:
mode:
authorkoobs <koobs@FreeBSD.org>2013-12-08 14:22:07 +0800
committerkoobs <koobs@FreeBSD.org>2013-12-08 14:22:07 +0800
commit5e0df17784d7a18a4890c46b84888e5b2aa634ee (patch)
tree8f180a543f860576dcca1eaa4a2ae751bb0cc7c3 /lang/python31/files
parente00ed1fe625761290b8c6936049c5c43fb38a8f9 (diff)
downloadfreebsd-ports-gnome-5e0df17784d7a18a4890c46b84888e5b2aa634ee.tar.gz
freebsd-ports-gnome-5e0df17784d7a18a4890c46b84888e5b2aa634ee.tar.zst
freebsd-ports-gnome-5e0df17784d7a18a4890c46b84888e5b2aa634ee.zip
All Python ports: Address abort() for ctypes import on FreeBSD/ARM
The current FreeBSD/ARM __clear_cache() implementation does nothing #if __i386__ || __x86_64__ #else abort(); cognet@ advises this is an issue for anything !Apple that is using the libcompiler_rt provided by Clang on ARM, and requires upstreaming. This is the root cause of abort() on import for the ctypes module in Python, as they bundle libffi. [1] This change patches the bundled libffi library in all Python ports, even though it is a NOOP for the ports that use devel/libffi. These ports, currently python31, will get the fix via ports/184517 A huge shout out to cognet@ who helped diagnose the issue and created the patch to address it. Thank you! PR: ports/149167 [1] PR: ports/184517 Submitted by: cognet [3] Reviewed by: cognet, eadler, milki, ak
Diffstat (limited to 'lang/python31/files')
-rw-r--r--lang/python31/files/patch-Modules___ctypes__libffi__src__arm__ffi.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/lang/python31/files/patch-Modules___ctypes__libffi__src__arm__ffi.c b/lang/python31/files/patch-Modules___ctypes__libffi__src__arm__ffi.c
new file mode 100644
index 000000000000..1e8b0d7af825
--- /dev/null
+++ b/lang/python31/files/patch-Modules___ctypes__libffi__src__arm__ffi.c
@@ -0,0 +1,36 @@
+# Description: Fix _ctypes abort on import for FreeBSD/ARM. This is an issue
+# for anything !apple that is using the libcompiler_rt provided by clang on arm
+# PR: ports/149167 ports/184517
+# Patch by: cognet@ (to be upstreamed @ LLVM)
+
+--- ./Modules/_ctypes/libffi/src/arm/ffi.c.orig 2013-12-08 15:55:58.351993767 +1100
++++ ./Modules/_ctypes/libffi/src/arm/ffi.c 2013-12-08 15:57:40.531068291 +1100
+@@ -29,6 +29,11 @@
+
+ #include <stdlib.h>
+
++#if defined(__FreeBSD__) && defined(__arm__)
++#include <sys/types.h>
++#include <machine/sysarch.h>
++#endif
++
+ /* ffi_prep_args is called by the assembly routine once stack space
+ has been allocated for the function's arguments */
+
+@@ -273,6 +278,16 @@
+
+ /* How to make a trampoline. */
+
++#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); \