diff -r a290f992e69a Modules/_ctypes/libffi/configure --- a/Modules/_ctypes/libffi/configure Tue Jul 26 12:55:20 2016 +0200 +++ b/Modules/_ctypes/libffi/configure Tue Jul 26 21:47:44 2016 +0800 @@ -18601,7 +18601,7 @@ $as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h ;; - *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) + *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris* | *arm*-linux-android* | *aarch64*-linux-android*) $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h diff -r a290f992e69a Modules/_ctypes/libffi/configure.ac --- a/Modules/_ctypes/libffi/configure.ac Tue Jul 26 12:55:20 2016 +0200 +++ b/Modules/_ctypes/libffi/configure.ac Tue Jul 26 21:47:44 2016 +0800 @@ -461,7 +461,7 @@ [Cannot use PROT_EXEC on this target, so, we revert to alternative means]) ;; - *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) + *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris* | *arm*-linux-android* | *aarch64*-linux-android*) AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, [Cannot use malloc on this target, so, we revert to alternative means]) diff -r a290f992e69a Modules/_ctypes/libffi/src/closures.c --- a/Modules/_ctypes/libffi/src/closures.c Tue Jul 26 12:55:20 2016 +0200 +++ b/Modules/_ctypes/libffi/src/closures.c Tue Jul 26 21:47:44 2016 +0800 @@ -54,7 +54,7 @@ #endif #if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX -# ifdef __linux__ +# if defined(__linux__) && !defined(__ANDROID__) /* When defined to 1 check for SELinux and if SELinux is active, don't attempt PROT_EXEC|PROT_WRITE mapping at all, as that might cause audit messages. */