summaryrefslogtreecommitdiff
path: root/system/libffi
diff options
context:
space:
mode:
Diffstat (limited to 'system/libffi')
-rw-r--r--system/libffi/APKBUILD9
-rw-r--r--system/libffi/fix-testsuite-opts.patch11
-rw-r--r--system/libffi/pax-dlmmap.patch120
3 files changed, 15 insertions, 125 deletions
diff --git a/system/libffi/APKBUILD b/system/libffi/APKBUILD
index 1913e0dbc..07a5be5eb 100644
--- a/system/libffi/APKBUILD
+++ b/system/libffi/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=libffi
pkgver=3.2.1
-pkgrel=5
+pkgrel=6
pkgdesc="A portable, high level programming interface to various calling conventions."
url="https://sourceware.org/libffi"
arch="all"
@@ -13,8 +13,8 @@ subpackages="$pkgname-dev $pkgname-doc"
source="https://sourceware.org/pub/$pkgname/$pkgname-$pkgver.tar.gz
disable-ppc-ldvariant.patch
fix-testsuite-longdouble.patch
+ fix-testsuite-opts.patch
gnu-linux-define.patch
- pax-dlmmap.patch
powerpc-fixes.patch
"
@@ -22,8 +22,7 @@ build () {
./configure \
--build=$CBUILD \
--host=$CHOST \
- --prefix=/usr \
- --enable-pax_emutramp
+ --prefix=/usr
make
}
@@ -48,6 +47,6 @@ package() {
sha512sums="980ca30a8d76f963fca722432b1fe5af77d7a4e4d2eac5144fbc5374d4c596609a293440573f4294207e1bdd9fda80ad1e1cafb2ffb543df5a275bc3bd546483 libffi-3.2.1.tar.gz
cfd3b11a0e168fd74da0a6219c95610df3466b0769966351b2a5076c93a75996daf9aed41644bebb80e28793bbe18d62272385afd7813c472104cc6c93dcba41 disable-ppc-ldvariant.patch
de92cb20ded7bfefc3e469ba2ac2d9d869d67dc172ec7e2d1222f8530944eb6d5016ae913baf01ac2e26bee1624c682ae9dd08d0e45d5532d59298dbe7e417eb fix-testsuite-longdouble.patch
+9b4b1d1b54cc7c96c44ba727556d9bfd2ab261a594061223df2fbd47ae7a067a7b9a3db92dc2e1b45d8c502bf4a192f8988c7638737c7aacfeac31ed1536891a fix-testsuite-opts.patch
264af568ae5388d50f647f891a406945c73cc358692266f65ad341787c0bf5f6bf31203b86c39fa1b338101c1a6d2f4fec60f95a90d379951ff5153f8f9e178f gnu-linux-define.patch
-72486b389db16055ae4d7d33ba0cb05840537e28fe7a86aa89e2cb922592125d99c18c26c5df7ffde6282742e79f2b9126353e58b58f091f0486589e14dd6474 pax-dlmmap.patch
bb3eb51a196aac2849fa0d0214e46f1428d55c8ed4375e5f8cf7fc9076927db935f97ac4d6e61a101897ac6ddc137a0a61e210b8d91888e938c6af122700e935 powerpc-fixes.patch"
diff --git a/system/libffi/fix-testsuite-opts.patch b/system/libffi/fix-testsuite-opts.patch
new file mode 100644
index 000000000..b3d08b4af
--- /dev/null
+++ b/system/libffi/fix-testsuite-opts.patch
@@ -0,0 +1,11 @@
+--- libffi-3.2.1/testsuite/lib/libffi.old 2014-11-08 06:47:24.000000000 -0600
++++ libffi-3.2.1/testsuite/lib/libffi.exp 2019-07-22 13:29:32.086840387 -0500
+@@ -281,7 +281,7 @@
+ global using_gcc
+ if { [string match $using_gcc "yes"] } {
+ set common "-W -Wall -Wno-psabi"
+- set optimizations { "-O0" "-O2" "-O3" "-Os" "-O2 -fomit-frame-pointer" }
++ set optimizations { "-O0" "-O2 -fno-inline-small-functions" "-O3 -fno-inline-small-functions" "-Os" "-O2 -fno-inline-small-functions -fomit-frame-pointer" }
+ } else {
+ # Assume we are using the vendor compiler.
+ set common ""
diff --git a/system/libffi/pax-dlmmap.patch b/system/libffi/pax-dlmmap.patch
deleted file mode 100644
index ec4150410..000000000
--- a/system/libffi/pax-dlmmap.patch
+++ /dev/null
@@ -1,120 +0,0 @@
-From 48d2e46528fb6e621d95a7fa194069fd136b712d Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Stefan=20B=C3=BChler?= <buehler@cert.uni-stuttgart.de>
-Date: Wed, 7 Sep 2016 15:49:48 +0200
-Subject: [PATCH 1/2] dlmmap_locked always needs locking as it always modifies
- execsize
-
----
- src/closures.c | 13 ++++---------
- 1 file changed, 4 insertions(+), 9 deletions(-)
-
-diff --git a/src/closures.c b/src/closures.c
-index 2e0ffb45..04d6e27f 100644
---- a/src/closures.c
-+++ b/src/closures.c
-@@ -769,16 +769,11 @@ dlmmap (void *start, size_t length, int prot,
- MREMAP_DUP and prot at this point. */
- }
-
-- if (execsize == 0 || execfd == -1)
-- {
-- pthread_mutex_lock (&open_temp_exec_file_mutex);
-- ptr = dlmmap_locked (start, length, prot, flags, offset);
-- pthread_mutex_unlock (&open_temp_exec_file_mutex);
-+ pthread_mutex_lock (&open_temp_exec_file_mutex);
-+ ptr = dlmmap_locked (start, length, prot, flags, offset);
-+ pthread_mutex_unlock (&open_temp_exec_file_mutex);
-
-- return ptr;
-- }
--
-- return dlmmap_locked (start, length, prot, flags, offset);
-+ return ptr;
- }
-
- /* Release memory at the given address, as well as the corresponding
-
-From 7aad5f895e2dfdb79d2ef67e1b231d21063e6511 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Stefan=20B=C3=BChler?= <buehler@cert.uni-stuttgart.de>
-Date: Wed, 7 Sep 2016 15:50:54 +0200
-Subject: [PATCH 2/2] ignore PaX EMUTRAMP flag; instead check for MPROTECT
-
-- code using ffi_closure_alloc doesn't necessarily generate gcc compatible trampolines; only those are allowed by PaX
-- if MPROTECT is enabled use the same workaround as is used for SELinux (double mmap())
----
- src/closures.c | 29 +++++++++++++----------------
- 1 file changed, 13 insertions(+), 16 deletions(-)
-
-diff --git a/src/closures.c b/src/closures.c
-index 04d6e27f..babecc1a 100644
---- a/src/closures.c
-+++ b/src/closures.c
-@@ -401,14 +401,15 @@ selinux_enabled_check (void)
-
- #endif /* !FFI_MMAP_EXEC_SELINUX */
-
--/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */
-+/* On PaX enable kernels that have MPROTECT enabled we can't use PROT_EXEC. */
- #ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX
- #include <stdlib.h>
-
--static int emutramp_enabled = -1;
-+/* -1: not read yet; 0: no PaX or MPROTECT disabled; 1: MPROTECT enabled. */
-+static int mprotect_enabled = -1;
-
- static int
--emutramp_enabled_check (void)
-+mprotect_enabled_check (void)
- {
- char *buf = NULL;
- size_t len = 0;
-@@ -422,9 +423,7 @@ emutramp_enabled_check (void)
- while (getline (&buf, &len, f) != -1)
- if (!strncmp (buf, "PaX:", 4))
- {
-- char emutramp;
-- if (sscanf (buf, "%*s %*c%c", &emutramp) == 1)
-- ret = (emutramp == 'E');
-+ ret = (NULL != strchr (buf + 4, 'M'));
- break;
- }
- free (buf);
-@@ -432,8 +431,9 @@ emutramp_enabled_check (void)
- return ret;
- }
-
--#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \
-- : (emutramp_enabled = emutramp_enabled_check ()))
-+#define is_mprotect_enabled() (mprotect_enabled >= 0 ? mprotect_enabled \
-+ : (mprotect_enabled = mprotect_enabled_check ()))
-+
- #endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */
-
- #elif defined (__CYGWIN__) || defined(__INTERIX)
-@@ -446,7 +446,7 @@ emutramp_enabled_check (void)
- #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */
-
- #ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX
--#define is_emutramp_enabled() 0
-+#define is_mprotect_enabled() 0
- #endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */
-
- /* Declare all functions defined in dlmalloc.c as static. */
-@@ -750,13 +750,10 @@ dlmmap (void *start, size_t length, int prot,
- && flags == (MAP_PRIVATE | MAP_ANONYMOUS)
- && fd == -1 && offset == 0);
-
-- if (execfd == -1 && is_emutramp_enabled ())
-- {
-- ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset);
-- return ptr;
-- }
--
-- if (execfd == -1 && !is_selinux_enabled ())
-+ /* -1 != execfd hints that we already decided to use dlmmap_locked
-+ last time. If PaX MPROTECT or SELinux is active fallback to
-+ dlmmap_locked. */
-+ if (execfd == -1 && !is_mprotect_enabled () && !is_selinux_enabled ())
- {
- ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset);
-