summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-libs/libffi')
-rw-r--r--dev-libs/libffi/Manifest4
-rw-r--r--dev-libs/libffi/files/libffi-3.2.1-o-tmpfile-eacces.patch17
-rw-r--r--dev-libs/libffi/files/libffi-3.3-compiler-vendor-quote.patch33
-rw-r--r--dev-libs/libffi/files/libffi-3.3-power7-memcpy-2.patch28
-rw-r--r--dev-libs/libffi/files/libffi-3.3-power7-memcpy.patch42
-rw-r--r--dev-libs/libffi/files/libffi-3.3-power7.patch39
-rw-r--r--dev-libs/libffi/files/libffi-3.3-ppc-int128.patch63
-rw-r--r--dev-libs/libffi/files/libffi-3.3-ppc-vector-offset.patch53
-rw-r--r--dev-libs/libffi/files/libffi-3.3_rc0-ppc-macos-go.patch79
-rw-r--r--dev-libs/libffi/files/libffi-3.4.4-hppa-closure-function-ptrs.patch170
-rw-r--r--dev-libs/libffi/files/libffi-3.4.4-hppa-jump-table.patch289
-rw-r--r--dev-libs/libffi/files/libffi-3.4.4-hppa-large-struct.patch36
-rw-r--r--dev-libs/libffi/files/libffi-3.4.4-lld-17.patch34
-rw-r--r--dev-libs/libffi/files/libffi-3.4.4-sparc-float-typo.patch28
-rw-r--r--dev-libs/libffi/files/libffi-3.4.4-trampoline-c99.patch39
-rw-r--r--dev-libs/libffi/libffi-3.4.4-r3.ebuild (renamed from dev-libs/libffi/libffi-3.3-r2.ebuild)60
-rw-r--r--dev-libs/libffi/libffi-3.4.4-r4.ebuild83
-rw-r--r--dev-libs/libffi/libffi-3.4.6.ebuild (renamed from dev-libs/libffi/libffi-3.4.2-r1.ebuild)26
-rw-r--r--dev-libs/libffi/metadata.xml1
19 files changed, 729 insertions, 395 deletions
diff --git a/dev-libs/libffi/Manifest b/dev-libs/libffi/Manifest
index 6351b7c81d9d..8500e7a471b4 100644
--- a/dev-libs/libffi/Manifest
+++ b/dev-libs/libffi/Manifest
@@ -1,2 +1,2 @@
-DIST libffi-3.3.tar.gz 1305466 BLAKE2B cddc40729a30a9bd34d675809f51f8d1b4ccaffa54bc6dd6f7e965f4e260edd34754719f9f6247c8957aeb7cf154d56ce1fe16a54c3f1ad39afbebdf41d23caa SHA512 61513801a156f11420f541d325de697131846487122d6bdcf5491b18b4da788589f5c0bb07e88e396495d3be5830d74e9135595e2b8ddbfe95c448d8597fbd6f
-DIST libffi-3.4.2.tar.gz 1351355 BLAKE2B a8137bc895b819f949fd7705e405be627219c6d1fdef280253330f7407d4a548bb057d7bb0e9225d1767d42f9bf5f0ab3c455db1c3470d7cc876bb7b7d55d308 SHA512 31bad35251bf5c0adb998c88ff065085ca6105cf22071b9bd4b5d5d69db4fadf16cadeec9baca944c4bb97b619b035bb8279de8794b922531fddeb0779eb7fb1
+DIST libffi-3.4.4.tar.gz 1362394 BLAKE2B 189fe1ffe9507f204581b0ab09995dc7e7b761bb4eac7e338e9f5ff81431aebcef6c182c1839c9f9acb2706697a260c67e6d1351cf7e2aed7c4eb5d694f6f8fd SHA512 88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889
+DIST libffi-3.4.6.tar.gz 1391684 BLAKE2B af8402a09bdbd59b4e9400d2d71bd5ce98f6f1d981d35d1ab40d77a831b13b32c5bd34ca54ff75999e39f0d8a9c066381fae7a8d6c5216d955e064f929f08b88 SHA512 033d2600e879b83c6bce0eb80f69c5f32aa775bf2e962c9d39fbd21226fa19d1e79173d8eaa0d0157014d54509ea73315ad86842356fc3a303c0831c94c6ab39
diff --git a/dev-libs/libffi/files/libffi-3.2.1-o-tmpfile-eacces.patch b/dev-libs/libffi/files/libffi-3.2.1-o-tmpfile-eacces.patch
deleted file mode 100644
index 92a733cbe823..000000000000
--- a/dev-libs/libffi/files/libffi-3.2.1-o-tmpfile-eacces.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-https://bugs.gentoo.org/529044
-
-deploy this workaround until newer versions of the kernel/C library/libsandbox
-are rolled out into general circulation
-
---- a/src/closures.c
-+++ b/src/closures.c
-@@ -301,7 +301,8 @@ open_temp_exec_file_dir (const char *dir)
- #ifdef O_TMPFILE
- fd = open (dir, flags | O_RDWR | O_EXCL | O_TMPFILE, 0700);
- /* If the running system does not support the O_TMPFILE flag then retry without it. */
-- if (fd != -1 || (errno != EINVAL && errno != EISDIR && errno != EOPNOTSUPP)) {
-+ if (fd != -1 || (errno != EINVAL && errno != EISDIR && errno != EOPNOTSUPP &&
-+ errno != EACCES)) {
- return fd;
- } else {
- errno = 0;
diff --git a/dev-libs/libffi/files/libffi-3.3-compiler-vendor-quote.patch b/dev-libs/libffi/files/libffi-3.3-compiler-vendor-quote.patch
deleted file mode 100644
index db5b69ce2db9..000000000000
--- a/dev-libs/libffi/files/libffi-3.3-compiler-vendor-quote.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-https://bugs.gentoo.org/753299
---- a/testsuite/lib/libffi.exp
-+++ b/testsuite/lib/libffi.exp
-@@ -287,9 +287,6 @@ proc libffi-init { args } {
- verbose "libffi $blddirffi"
-
- # Which compiler are we building with?
-- set tmp [grep "$blddirffi/config.log" "^ax_cv_c_compiler_vendor.*$"]
-- regexp -- {^[^=]*=(.*)$} $tmp nil compiler_vendor
--
- if { [string match $compiler_vendor "gnu"] } {
- set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
- if {$gccdir != ""} {
---- a/configure.ac
-+++ b/configure.ac
-@@ -59,6 +59,7 @@ fi
- cat > local.exp <<EOF
- set CC_FOR_TARGET "$CC"
- set CXX_FOR_TARGET "$CXX"
-+set compiler_vendor "$ax_cv_c_compiler_vendor"
- EOF
-
- AM_MAINTAINER_MODE
---- a/configure
-+++ b/configure
-@@ -17402,6 +17402,7 @@ fi
- cat > local.exp <<EOF
- set CC_FOR_TARGET "$CC"
- set CXX_FOR_TARGET "$CXX"
-+set compiler_vendor "$ax_cv_c_compiler_vendor"
- EOF
-
-
diff --git a/dev-libs/libffi/files/libffi-3.3-power7-memcpy-2.patch b/dev-libs/libffi/files/libffi-3.3-power7-memcpy-2.patch
deleted file mode 100644
index d9d47acb618f..000000000000
--- a/dev-libs/libffi/files/libffi-3.3-power7-memcpy-2.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 6663047f56c2932a6b10a790f4ac6666dd181326 Mon Sep 17 00:00:00 2001
-From: Anthony Green <green@moxielogic.com>
-Date: Fri, 29 Nov 2019 07:00:35 -0500
-Subject: [PATCH] Address platforms with no __int128.
-
----
- src/powerpc/ffi_linux64.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c
-index de0d033..7364770 100644
---- a/src/powerpc/ffi_linux64.c
-+++ b/src/powerpc/ffi_linux64.c
-@@ -547,9 +547,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
- if (next_arg.ul == gpr_end.ul)
- next_arg.ul = rest.ul;
- if (vecarg_count < NUM_VEC_ARG_REGISTERS64 && i < nfixedargs)
-- *vec_base.f128++ = **p_argv.f128;
-+ memcpy (vec_base.f128++, *p_argv.f128, sizeof (float128));
- else
-- *next_arg.f128 = **p_argv.f128;
-+ memcpy (next_arg.f128, *p_argv.f128, sizeof (float128));
- if (++next_arg.f128 == gpr_end.f128)
- next_arg.f128 = rest.f128;
- vecarg_count++;
---
-2.26.0
-
diff --git a/dev-libs/libffi/files/libffi-3.3-power7-memcpy.patch b/dev-libs/libffi/files/libffi-3.3-power7-memcpy.patch
deleted file mode 100644
index 91f9a6f60fae..000000000000
--- a/dev-libs/libffi/files/libffi-3.3-power7-memcpy.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From e50b9ef8b910fa642ef158f6642e60d54d7ad740 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 7 Dec 2019 02:34:14 -0800
-Subject: [PATCH] powerpc64: Use memcpy to help platforms with no __int128.
- (#534)
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- src/powerpc/ffi_linux64.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c
-index 7364770..4d50878 100644
---- a/src/powerpc/ffi_linux64.c
-+++ b/src/powerpc/ffi_linux64.c
-@@ -680,9 +680,9 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
- {
- if (vecarg_count < NUM_VEC_ARG_REGISTERS64
- && i < nfixedargs)
-- *vec_base.f128++ = *arg.f128++;
-+ memcpy (vec_base.f128++, arg.f128, sizeof (float128));
- else
-- *next_arg.f128 = *arg.f128++;
-+ memcpy (next_arg.f128, arg.f128++, sizeof (float128));
- if (++next_arg.f128 == gpr_end.f128)
- next_arg.f128 = rest.f128;
- vecarg_count++;
-@@ -986,9 +986,9 @@ ffi_closure_helper_LINUX64 (ffi_cif *cif,
- do
- {
- if (pvec < end_pvec && i < nfixedargs)
-- *to.f128 = *pvec++;
-+ memcpy (to.f128, pvec++, sizeof (float128));
- else
-- *to.f128 = *from.f128;
-+ memcpy (to.f128, from.f128, sizeof (float128));
- to.f128++;
- from.f128++;
- }
---
-2.26.0
-
diff --git a/dev-libs/libffi/files/libffi-3.3-power7.patch b/dev-libs/libffi/files/libffi-3.3-power7.patch
deleted file mode 100644
index 83f518f4c2e3..000000000000
--- a/dev-libs/libffi/files/libffi-3.3-power7.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-https://bugs.gentoo.org/701128
-
-From 2138adb2a5b6a0bc2fe3518e0645eacc89b6f392 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Thu, 28 Nov 2019 00:02:42 +0000
-Subject: [PATCH] powerpc: fix build failure on power7 and older
-
-Build failure looks as:
-```
-libtool: compile: powerpc-unknown-linux-gnu-gcc \
- -O2 -mcpu=powerpc -mtune=powerpc -pipe ... -c src/powerpc/ffi.c ...
-In file included from src/powerpc/ffi.c:33:
-src/powerpc/ffi_powerpc.h:65:9: error: '__int128' is not supported on this target
- 65 | typedef __int128 float128;
- | ^~~~~~~~
-```
-
-The fix avoids using __int128 in favour of aligned char[16].
-
-Closes: https://github.com/libffi/libffi/issues/531
-Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
----
- src/powerpc/ffi_powerpc.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/src/powerpc/ffi_powerpc.h
-+++ b/src/powerpc/ffi_powerpc.h
-@@ -62,7 +62,7 @@ typedef _Float128 float128;
- #elif defined(__FLOAT128__)
- typedef __float128 float128;
- #else
--typedef __int128 float128;
-+typedef char float128[16] __attribute__((aligned(16)));
- #endif
-
- void FFI_HIDDEN ffi_closure_SYSV (void);
---
-2.24.0
-
diff --git a/dev-libs/libffi/files/libffi-3.3-ppc-int128.patch b/dev-libs/libffi/files/libffi-3.3-ppc-int128.patch
deleted file mode 100644
index ed53ae99902f..000000000000
--- a/dev-libs/libffi/files/libffi-3.3-ppc-int128.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 4f9e20ac51ce13d46fed3c869e1deb6d9bb89444 Mon Sep 17 00:00:00 2001
-From: Andrew Geissler <geissonator@users.noreply.github.com>
-Date: Fri, 1 May 2020 06:58:30 -0500
-Subject: [PATCH] ffi_powerpc.h: fix build failure with powerpc7 (#561)
-
-This is a patch pulled down from the following:
-https://github.com/buildroot/buildroot/blob/78926f610b1411b03464152472fd430012deb9ac/package/libffi/0004-ffi_powerpc.h-fix-build-failure-with-powerpc7.patch
-
-This issue is being hit on OpenBMC code when pulling the latest
-libffi tag and building on a P8 ppc64le machine. I verified this
-patch fixes the issue we are seeing.
-
-Below is the original commit message:
-
-Sicne commit 73dd43afc8a447ba98ea02e9aad4c6898dc77fb0, build on powerpc7
-fails on:
-
-In file included from ../src/powerpc/ffi.c:33:0:
-../src/powerpc/ffi_powerpc.h:61:9: error: '_Float128' is not supported on this target
- typedef _Float128 float128;
- ^~~~~~~~~
-
-Fix this build failure by checking for __HAVE_FLOAT128 before using
-_Float128, as _Float128 is enabled only on specific conditions, see
-output/host/powerpc64-buildroot-linux-gnu/sysroot/usr/include/bits/floatn.h:
-
- /* Defined to 1 if the current compiler invocation provides a
- floating-point type with the IEEE 754 binary128 format, and this glibc
- includes corresponding *f128 interfaces for it. */
- #if defined _ARCH_PWR8 && defined __LITTLE_ENDIAN__ && (_CALL_ELF == 2) \
- && defined __FLOAT128__ && !defined __NO_LONG_DOUBLE_MATH
- # define __HAVE_FLOAT128 1
- #else
- # define __HAVE_FLOAT128 0
- #endif
-
-Fixes:
- - http://autobuild.buildroot.org/results/5c9dd8fb3b6a128882b6250f197c80232d8a3b53
-
-Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
-Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
-
-Co-authored-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
----
- src/powerpc/ffi_powerpc.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/powerpc/ffi_powerpc.h b/src/powerpc/ffi_powerpc.h
-index 8e2f2f0..960a5c4 100644
---- a/src/powerpc/ffi_powerpc.h
-+++ b/src/powerpc/ffi_powerpc.h
-@@ -57,7 +57,7 @@ typedef union
- double d;
- } ffi_dblfl;
-
--#if defined(__FLOAT128_TYPE__)
-+#if defined(__FLOAT128_TYPE__) && defined(__HAVE_FLOAT128)
- typedef _Float128 float128;
- #elif defined(__FLOAT128__)
- typedef __float128 float128;
---
-2.27.0
-
diff --git a/dev-libs/libffi/files/libffi-3.3-ppc-vector-offset.patch b/dev-libs/libffi/files/libffi-3.3-ppc-vector-offset.patch
deleted file mode 100644
index 4bcd27e4f152..000000000000
--- a/dev-libs/libffi/files/libffi-3.3-ppc-vector-offset.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 4d6d2866ae43e55325e8ee96561221804602cd7a Mon Sep 17 00:00:00 2001
-From: Samuel Holland <samuel@sholland.org>
-Date: Fri, 21 Feb 2020 21:06:15 -0600
-Subject: [PATCH] Update powerpc sysv assembly for ffi_powerpc.h changes (#541)
-
-Some of the flag bits were moved when adding powerpc64 vector support.
-
-Fixes #536
----
- src/powerpc/sysv.S | 12 +++++-------
- 1 file changed, 5 insertions(+), 7 deletions(-)
-
-diff --git a/src/powerpc/sysv.S b/src/powerpc/sysv.S
-index 1474ce7..df97734 100644
---- a/src/powerpc/sysv.S
-+++ b/src/powerpc/sysv.S
-@@ -104,17 +104,16 @@ ENTRY(ffi_call_SYSV)
- bctrl
-
- /* Now, deal with the return value. */
-- mtcrf 0x01,%r31 /* cr7 */
-+ mtcrf 0x03,%r31 /* cr6-cr7 */
- bt- 31,L(small_struct_return_value)
- bt- 30,L(done_return_value)
- #ifndef __NO_FPRS__
- bt- 29,L(fp_return_value)
- #endif
- stw %r3,0(%r30)
-- bf+ 28,L(done_return_value)
-+ bf+ 27,L(done_return_value)
- stw %r4,4(%r30)
-- mtcrf 0x02,%r31 /* cr6 */
-- bf 27,L(done_return_value)
-+ bf 26,L(done_return_value)
- stw %r5,8(%r30)
- stw %r6,12(%r30)
- /* Fall through... */
-@@ -145,10 +144,9 @@ L(done_return_value):
- #ifndef __NO_FPRS__
- L(fp_return_value):
- .cfi_restore_state
-- bf 28,L(float_return_value)
-+ bf 27,L(float_return_value)
- stfd %f1,0(%r30)
-- mtcrf 0x02,%r31 /* cr6 */
-- bf 27,L(done_return_value)
-+ bf 26,L(done_return_value)
- stfd %f2,8(%r30)
- b L(done_return_value)
- L(float_return_value):
---
-2.27.0
-
diff --git a/dev-libs/libffi/files/libffi-3.3_rc0-ppc-macos-go.patch b/dev-libs/libffi/files/libffi-3.3_rc0-ppc-macos-go.patch
deleted file mode 100644
index 88f9b4557657..000000000000
--- a/dev-libs/libffi/files/libffi-3.3_rc0-ppc-macos-go.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-ffi_darwin: use FFI_GO_CLOSURES guard to avoid unsolvable dependencies
-
-The go calls depend on compilation and link-time signatures and symbols
-which are missing because they aren't build due to FFO_GO_CLOSURES not
-being set.
-
-Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-
---- a/src/powerpc/ffi_darwin.c 2018-04-02 14:21:51.000000000 +0200
-+++ b/src/powerpc/ffi_darwin.c 2018-12-10 13:57:26.000000000 +0100
-@@ -909,8 +909,10 @@
- extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *,
- void (*fn)(void), void (*fn2)(void));
-
-+#if FFI_GO_CLOSURES
- extern void ffi_call_go_AIX(extended_cif *, long, unsigned, unsigned *,
- void (*fn)(void), void (*fn2)(void), void *closure);
-+#endif
-
- extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *,
- void (*fn)(void), void (*fn2)(void), ffi_type*);
-@@ -950,6 +952,7 @@
- }
- }
-
-+#if FFI_GO_CLOSURES
- void
- ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue,
- void *closure)
-@@ -981,6 +984,7 @@
- break;
- }
- }
-+#endif
-
- static void flush_icache(char *);
- static void flush_range(char *, int);
-@@ -1110,6 +1114,7 @@
- return FFI_OK;
- }
-
-+#if FFI_GO_CLOSURES
- ffi_status
- ffi_prep_go_closure (ffi_go_closure* closure,
- ffi_cif* cif,
-@@ -1133,6 +1138,7 @@
- }
- return FFI_OK;
- }
-+#endif
-
- static void
- flush_icache(char *addr)
-@@ -1168,9 +1174,11 @@
- ffi_closure_helper_DARWIN (ffi_closure *, void *,
- unsigned long *, ffi_dblfl *);
-
-+#if FFI_GO_CLOSURES
- ffi_type *
- ffi_go_closure_helper_DARWIN (ffi_go_closure*, void *,
- unsigned long *, ffi_dblfl *);
-+#endif
-
- /* Basically the trampoline invokes ffi_closure_ASM, and on
- entry, r11 holds the address of the closure.
-@@ -1430,6 +1438,7 @@
- closure->user_data, rvalue, pgr, pfr);
- }
-
-+#if FFI_GO_CLOSURES
- ffi_type *
- ffi_go_closure_helper_DARWIN (ffi_go_closure *closure, void *rvalue,
- unsigned long *pgr, ffi_dblfl *pfr)
-@@ -1437,4 +1446,5 @@
- return ffi_closure_helper_common (closure->cif, closure->fun,
- closure, rvalue, pgr, pfr);
- }
-+#endif
-
diff --git a/dev-libs/libffi/files/libffi-3.4.4-hppa-closure-function-ptrs.patch b/dev-libs/libffi/files/libffi-3.4.4-hppa-closure-function-ptrs.patch
new file mode 100644
index 000000000000..065f35e7c4c2
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.4-hppa-closure-function-ptrs.patch
@@ -0,0 +1,170 @@
+https://github.com/libffi/libffi/commit/e58e22b22386ed0e0a95e97eb8eed016e3f01b02
+
+From e58e22b22386ed0e0a95e97eb8eed016e3f01b02 Mon Sep 17 00:00:00 2001
+From: Anthony Green <green@moxielogic.com>
+Date: Thu, 2 Feb 2023 07:02:53 -0500
+Subject: [PATCH] From Dave Anglin:
+
+A couple of years ago the 32-bit hppa targets were converted from using a trampoline executed on the stack to the function descriptor technique used by ia64. This is more efficient and avoids having to have an executable stack. However, function pointers on 32-bit need the PLABEL bit set in the pointer. It distinguishes between pointers that point directly to the executable code and pointer that point to a function descriptor. We need the later for libffi. But as a result, it is not possible to convert using casts data pointers to function pointers.
+
+The solution at the time was to set the PLABEL bit in hppa closure pointers using FFI_CLOSURE_PTR. However, I realized recently that this was a bad choice. Packages like python-cffi allocate their own closure pointers, so this isn't going to work well there.
+
+A better solution is to leave closure pointers unchanged and only set the PLABEL bit in pointers used to point to executable code.
+
+The attached patch drops the FFI_CLOSURE_PTR and FFI_RESTORE_PTR defines. This allows some cleanup in the hppa closure routines. The FFI_FN define is now used to set the PLABEL bit on hppa. ffi_closure_alloc is modified to set the PLABEL bit in the value set in *code.
+
+I also added a FFI_CL define to convert a function pointer to a closure pointer. It is only used in one test case.
+--- a/include/ffi.h.in
++++ b/include/ffi.h.in
+@@ -361,14 +361,6 @@ typedef struct {
+ FFI_API void *ffi_closure_alloc (size_t size, void **code);
+ FFI_API void ffi_closure_free (void *);
+
+-#if defined(PA_LINUX) || defined(PA_HPUX)
+-#define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2))
+-#define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3))
+-#else
+-#define FFI_CLOSURE_PTR(X) (X)
+-#define FFI_RESTORE_PTR(X) (X)
+-#endif
+-
+ FFI_API ffi_status
+ ffi_prep_closure (ffi_closure*,
+ ffi_cif *,
+@@ -515,8 +507,14 @@ FFI_API
+ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type,
+ size_t *offsets);
+
+-/* Useful for eliminating compiler warnings. */
++/* Convert between closure and function pointers. */
++#if defined(PA_LINUX) || defined(PA_HPUX)
++#define FFI_FN(f) ((void (*)(void))((unsigned int)(f) | 2))
++#define FFI_CL(f) ((void *)((unsigned int)(f) & ~3))
++#else
+ #define FFI_FN(f) ((void (*)(void))f)
++#define FFI_CL(f) ((void *)(f))
++#endif
+
+ /* ---- Definitions shared with assembly code ---------------------------- */
+
+--- a/src/closures.c
++++ b/src/closures.c
+@@ -993,23 +993,23 @@ ffi_closure_alloc (size_t size, void **code)
+ if (!code)
+ return NULL;
+
+- ptr = FFI_CLOSURE_PTR (dlmalloc (size));
++ ptr = dlmalloc (size);
+
+ if (ptr)
+ {
+ msegmentptr seg = segment_holding (gm, ptr);
+
+- *code = add_segment_exec_offset (ptr, seg);
++ *code = FFI_FN (add_segment_exec_offset (ptr, seg));
+ if (!ffi_tramp_is_supported ())
+ return ptr;
+
+ ftramp = ffi_tramp_alloc (0);
+ if (ftramp == NULL)
+ {
+- dlfree (FFI_RESTORE_PTR (ptr));
++ dlfree (ptr);
+ return NULL;
+ }
+- *code = ffi_tramp_get_addr (ftramp);
++ *code = FFI_FN (ffi_tramp_get_addr (ftramp));
+ ((ffi_closure *) ptr)->ftramp = ftramp;
+ }
+
+@@ -1050,7 +1050,7 @@ ffi_closure_free (void *ptr)
+ if (ffi_tramp_is_supported ())
+ ffi_tramp_free (((ffi_closure *) ptr)->ftramp);
+
+- dlfree (FFI_RESTORE_PTR (ptr));
++ dlfree (ptr);
+ }
+
+ int
+@@ -1070,16 +1070,20 @@ ffi_tramp_is_present (void *ptr)
+ void *
+ ffi_closure_alloc (size_t size, void **code)
+ {
++ void *c;
++
+ if (!code)
+ return NULL;
+
+- return *code = FFI_CLOSURE_PTR (malloc (size));
++ c = malloc (size);
++ *code = FFI_FN (c);
++ return c;
+ }
+
+ void
+ ffi_closure_free (void *ptr)
+ {
+- free (FFI_RESTORE_PTR (ptr));
++ free (ptr);
+ }
+
+ void *
+--- a/src/pa/ffi.c
++++ b/src/pa/ffi.c
+@@ -445,7 +445,6 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
+ int i, avn;
+ unsigned int slot = FIRST_ARG_SLOT;
+ register UINT32 r28 asm("r28");
+- ffi_closure *c = (ffi_closure *)FFI_RESTORE_PTR (closure);
+
+ cif = closure->cif;
+
+@@ -548,7 +547,7 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
+ }
+
+ /* Invoke the closure. */
+- (c->fun) (cif, rvalue, avalue, c->user_data);
++ (closure->fun) (cif, rvalue, avalue, closure->user_data);
+
+ debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", u.ret[0],
+ u.ret[1]);
+@@ -649,8 +648,6 @@ ffi_prep_closure_loc (ffi_closure* closure,
+ void *user_data,
+ void *codeloc)
+ {
+- ffi_closure *c = (ffi_closure *)FFI_RESTORE_PTR (closure);
+-
+ /* The layout of a function descriptor. A function pointer with the PLABEL
+ bit set points to a function descriptor. */
+ struct pa32_fd
+@@ -676,14 +673,14 @@ ffi_prep_closure_loc (ffi_closure* closure,
+ fd = (struct pa32_fd *)((UINT32)ffi_closure_pa32 & ~3);
+
+ /* Setup trampoline. */
+- tramp = (struct ffi_pa32_trampoline_struct *)c->tramp;
++ tramp = (struct ffi_pa32_trampoline_struct *)closure->tramp;
+ tramp->code_pointer = fd->code_pointer;
+ tramp->fake_gp = (UINT32)codeloc & ~3;
+ tramp->real_gp = fd->gp;
+
+- c->cif = cif;
+- c->user_data = user_data;
+- c->fun = fun;
++ closure->cif = cif;
++ closure->user_data = user_data;
++ closure->fun = fun;
+
+ return FFI_OK;
+ }
+--- a/testsuite/libffi.closures/closure_loc_fn0.c
++++ b/testsuite/libffi.closures/closure_loc_fn0.c
+@@ -85,7 +85,7 @@ int main (void)
+
+ #ifndef FFI_EXEC_STATIC_TRAMP
+ /* With static trampolines, the codeloc does not point to closure */
+- CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0);
++ CHECK(memcmp(pcl, FFI_CL(codeloc), sizeof(*pcl)) == 0);
+ #endif
+
+ res = (*((closure_loc_test_type0)codeloc))
+
diff --git a/dev-libs/libffi/files/libffi-3.4.4-hppa-jump-table.patch b/dev-libs/libffi/files/libffi-3.4.4-hppa-jump-table.patch
new file mode 100644
index 000000000000..822a7eb893ec
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.4-hppa-jump-table.patch
@@ -0,0 +1,289 @@
+https://github.com/libffi/libffi/commit/222abd0c65babe2174b21753217145f5031a8b91
+
+From 222abd0c65babe2174b21753217145f5031a8b91 Mon Sep 17 00:00:00 2001
+From: Anthony Green <green@moxielogic.com>
+Date: Thu, 2 Feb 2023 07:04:55 -0500
+Subject: [PATCH] From Dave Anglin:
+
+This patch is derived from the work done in implementing libffi for 64-bit hppa64-hpux target. Currently, the 32-bit hppa targets do a linear search for the return type of an ffi_call. This is slow and inefficient. A jump table can used to jump directly to the code used to process the return value. In most common cases, the return value can be processed in the jump table itself.
+
+The patch also fixes return handling for FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16 and FFI_TYPE_SINT16.
+--- a/src/pa/ffi.c
++++ b/src/pa/ffi.c
+@@ -56,27 +56,12 @@ static inline int ffi_struct_type(ffi_type *t)
+ size_t sz = t->size;
+
+ /* Small structure results are passed in registers,
+- larger ones are passed by pointer. Note that
+- small structures of size 2, 4 and 8 differ from
+- the corresponding integer types in that they have
+- different alignment requirements. */
+-
+- if (sz <= 1)
+- return FFI_TYPE_UINT8;
+- else if (sz == 2)
+- return FFI_TYPE_SMALL_STRUCT2;
+- else if (sz == 3)
+- return FFI_TYPE_SMALL_STRUCT3;
+- else if (sz == 4)
+- return FFI_TYPE_SMALL_STRUCT4;
+- else if (sz == 5)
+- return FFI_TYPE_SMALL_STRUCT5;
+- else if (sz == 6)
+- return FFI_TYPE_SMALL_STRUCT6;
+- else if (sz == 7)
+- return FFI_TYPE_SMALL_STRUCT7;
+- else if (sz <= 8)
+- return FFI_TYPE_SMALL_STRUCT8;
++ larger ones are passed by pointer. Note that small
++ structures differ from the corresponding integer
++ types in that they have different alignment requirements. */
++
++ if (sz <= 8)
++ return -sz;
+ else
+ return FFI_TYPE_STRUCT; /* else, we pass it by pointer. */
+ }
+@@ -556,16 +541,16 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
+ switch (cif->flags)
+ {
+ case FFI_TYPE_UINT8:
+- *(stack - FIRST_ARG_SLOT) = (UINT8)(u.ret[0] >> 24);
++ *(stack - FIRST_ARG_SLOT) = (UINT8)u.ret[0];
+ break;
+ case FFI_TYPE_SINT8:
+- *(stack - FIRST_ARG_SLOT) = (SINT8)(u.ret[0] >> 24);
++ *(stack - FIRST_ARG_SLOT) = (SINT8)u.ret[0];
+ break;
+ case FFI_TYPE_UINT16:
+- *(stack - FIRST_ARG_SLOT) = (UINT16)(u.ret[0] >> 16);
++ *(stack - FIRST_ARG_SLOT) = (UINT16)u.ret[0];
+ break;
+ case FFI_TYPE_SINT16:
+- *(stack - FIRST_ARG_SLOT) = (SINT16)(u.ret[0] >> 16);
++ *(stack - FIRST_ARG_SLOT) = (SINT16)u.ret[0];
+ break;
+ case FFI_TYPE_INT:
+ case FFI_TYPE_SINT32:
+@@ -590,6 +575,7 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
+ /* Don't need a return value, done by caller. */
+ break;
+
++ case FFI_TYPE_SMALL_STRUCT1:
+ case FFI_TYPE_SMALL_STRUCT2:
+ case FFI_TYPE_SMALL_STRUCT3:
+ case FFI_TYPE_SMALL_STRUCT4:
+--- a/src/pa/ffitarget.h
++++ b/src/pa/ffitarget.h
+@@ -73,11 +73,22 @@ typedef enum ffi_abi {
+ #define FFI_TRAMPOLINE_SIZE 12
+ #endif
+
+-#define FFI_TYPE_SMALL_STRUCT2 -1
+-#define FFI_TYPE_SMALL_STRUCT3 -2
+-#define FFI_TYPE_SMALL_STRUCT4 -3
+-#define FFI_TYPE_SMALL_STRUCT5 -4
+-#define FFI_TYPE_SMALL_STRUCT6 -5
+-#define FFI_TYPE_SMALL_STRUCT7 -6
+-#define FFI_TYPE_SMALL_STRUCT8 -7
++#define FFI_TYPE_SMALL_STRUCT1 -1
++#define FFI_TYPE_SMALL_STRUCT2 -2
++#define FFI_TYPE_SMALL_STRUCT3 -3
++#define FFI_TYPE_SMALL_STRUCT4 -4
++#define FFI_TYPE_SMALL_STRUCT5 -5
++#define FFI_TYPE_SMALL_STRUCT6 -6
++#define FFI_TYPE_SMALL_STRUCT7 -7
++#define FFI_TYPE_SMALL_STRUCT8 -8
++
++/* linux.S and hpux32.S expect FFI_TYPE_COMPLEX is the last generic type. */
++#define FFI_PA_TYPE_LAST FFI_TYPE_COMPLEX
++
++/* If new generic types are added, the jump tables in linux.S and hpux32.S
++ likely need updating. */
++#if FFI_TYPE_LAST != FFI_PA_TYPE_LAST
++# error "You likely have broken jump tables"
++#endif
++
+ #endif
+
+--- a/src/pa/linux.S
++++ b/src/pa/linux.S
+@@ -103,51 +103,103 @@ ffi_call_pa32:
+
+ /* Prepare to store the result; we need to recover flags and rvalue. */
+ ldw -48(%r3), %r21 /* r21 <- flags */
+- ldw -52(%r3), %r20 /* r20 <- rvalue */
+
+- /* Store the result according to the return type. */
++ /* Adjust flags range from [-8, 15] to [0, 23]. */
++ addi 8, %r21, %r21
+
+-.Lcheckint:
+- comib,<>,n FFI_TYPE_INT, %r21, .Lcheckint8
+- b .Ldone
+- stw %ret0, 0(%r20)
++ blr %r21, %r0
++ ldw -52(%r3), %r20 /* r20 <- rvalue */
+
+-.Lcheckint8:
+- comib,<>,n FFI_TYPE_UINT8, %r21, .Lcheckint16
++ /* Giant jump table */
++ /* 8-byte small struct */
++ b,n .Lsmst8
++ nop
++ /* 7-byte small struct */
++ b,n .Lsmst7
++ nop
++ /* 6-byte small struct */
++ b,n .Lsmst6
++ nop
++ /* 5-byte small struct */
++ b,n .Lsmst5
++ nop
++ /* 4-byte small struct */
++ b,n .Lsmst4
++ nop
++ /* 3-byte small struct */
++ b,n .Lsmst3
++ nop
++ /* 2-byte small struct */
++ b,n .Lsmst2
++ nop
++ /* 1-byte small struct */
+ b .Ldone
+ stb %ret0, 0(%r20)
+-
+-.Lcheckint16:
+- comib,<>,n FFI_TYPE_UINT16, %r21, .Lcheckdbl
++ /* void */
++ b,n .Ldone
++ nop
++ /* int */
+ b .Ldone
+- sth %ret0, 0(%r20)
+-
+-.Lcheckdbl:
+- comib,<>,n FFI_TYPE_DOUBLE, %r21, .Lcheckfloat
++ stw %ret0, 0(%r20)
++ /* float */
++ b .Ldone
++ fstw %fr4L,0(%r20)
++ /* double */
+ b .Ldone
+ fstd %fr4,0(%r20)
+-
+-.Lcheckfloat:
+- comib,<>,n FFI_TYPE_FLOAT, %r21, .Lcheckll
++ /* long double */
+ b .Ldone
+- fstw %fr4L,0(%r20)
++ fstd %fr4,0(%r20)
++ /* unsigned int8 */
++ b .Ldone
++ stw %ret0, 0(%r20)
++ /* sint8 */
++ b .Ldone
++ stw %ret0, 0(%r20)
++ /* unsigned int16 */
++ b .Ldone
++ stw %ret0, 0(%r20)
++ /* sint16 */
++ b .Ldone
++ stw %ret0, 0(%r20)
++ /* unsigned int32 */
++ b .Ldone
++ stw %ret0, 0(%r20)
++ /* sint32 */
++ b .Ldone
++ stw %ret0, 0(%r20)
++ /* unsigned int64 */
++ b,n .Luint64
++ nop
++ /* signed int64 */
++ b,n .Lsint64
++ nop
++ /* large struct */
++ b,n .Ldone
++ nop
++ /* pointer */
++ b .Ldone
++ stw %ret0, 0(%r20)
++ /* complex */
++ b,n .Ldone
++ nop
++
++ /* Store the result according to the return type. */
+
+-.Lcheckll:
+- comib,<>,n FFI_TYPE_UINT64, %r21, .Lchecksmst2
++.Luint64:
++.Lsint64:
+ stw %ret0, 0(%r20)
+ b .Ldone
+ stw %ret1, 4(%r20)
+
+-.Lchecksmst2:
+- comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, .Lchecksmst3
++.Lsmst2:
+ /* 2-byte structs are returned in ret0 as ????xxyy. */
+ extru %ret0, 23, 8, %r22
+ stbs,ma %r22, 1(%r20)
+ b .Ldone
+ stb %ret0, 0(%r20)
+
+-.Lchecksmst3:
+- comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, .Lchecksmst4
++.Lsmst3:
+ /* 3-byte structs are returned in ret0 as ??xxyyzz. */
+ extru %ret0, 15, 8, %r22
+ stbs,ma %r22, 1(%r20)
+@@ -156,8 +208,7 @@ ffi_call_pa32:
+ b .Ldone
+ stb %ret0, 0(%r20)
+
+-.Lchecksmst4:
+- comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, .Lchecksmst5
++.Lsmst4:
+ /* 4-byte structs are returned in ret0 as wwxxyyzz. */
+ extru %ret0, 7, 8, %r22
+ stbs,ma %r22, 1(%r20)
+@@ -168,8 +219,7 @@ ffi_call_pa32:
+ b .Ldone
+ stb %ret0, 0(%r20)
+
+-.Lchecksmst5:
+- comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, .Lchecksmst6
++.Lsmst5:
+ /* 5 byte values are returned right justified:
+ ret0 ret1
+ 5: ??????aa bbccddee */
+@@ -183,8 +233,7 @@ ffi_call_pa32:
+ b .Ldone
+ stb %ret1, 0(%r20)
+
+-.Lchecksmst6:
+- comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, .Lchecksmst7
++.Lsmst6:
+ /* 6 byte values are returned right justified:
+ ret0 ret1
+ 6: ????aabb ccddeeff */
+@@ -200,8 +249,7 @@ ffi_call_pa32:
+ b .Ldone
+ stb %ret1, 0(%r20)
+
+-.Lchecksmst7:
+- comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, .Lchecksmst8
++.Lsmst7:
+ /* 7 byte values are returned right justified:
+ ret0 ret1
+ 7: ??aabbcc ddeeffgg */
+@@ -219,8 +267,7 @@ ffi_call_pa32:
+ b .Ldone
+ stb %ret1, 0(%r20)
+
+-.Lchecksmst8:
+- comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, .Ldone
++.Lsmst8:
+ /* 8 byte values are returned right justified:
+ ret0 ret1
+ 8: aabbccdd eeffgghh */
diff --git a/dev-libs/libffi/files/libffi-3.4.4-hppa-large-struct.patch b/dev-libs/libffi/files/libffi-3.4.4-hppa-large-struct.patch
new file mode 100644
index 000000000000..aaf4af368432
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.4-hppa-large-struct.patch
@@ -0,0 +1,36 @@
+https://github.com/libffi/libffi/commit/c50c16d0bcb58952840184aa83e62c6d912bf779
+
+From c50c16d0bcb58952840184aa83e62c6d912bf779 Mon Sep 17 00:00:00 2001
+From: Anthony Green <green@moxielogic.com>
+Date: Sun, 20 Nov 2022 12:20:40 -0500
+Subject: [PATCH] Fix large struct passing on PA-RISC
+
+--- a/src/pa/ffi.c
++++ b/src/pa/ffi.c
+@@ -376,10 +376,26 @@ extern void ffi_call_pa32(void (*)(UINT32 *, extended_cif *, unsigned),
+ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
+ {
+ extended_cif ecif;
++ size_t i, nargs = cif->nargs;
++ ffi_type **arg_types = cif->arg_types;
+
+ ecif.cif = cif;
+ ecif.avalue = avalue;
+
++ /* If we have any large structure arguments, make a copy so we are passing
++ by value. */
++ for (i = 0; i < nargs; i++)
++ {
++ ffi_type *at = arg_types[i];
++ int size = at->size;
++ if (at->type == FFI_TYPE_STRUCT && size > 8)
++ {
++ char *argcopy = alloca (size);
++ memcpy (argcopy, avalue[i], size);
++ avalue[i] = argcopy;
++ }
++ }
++
+ /* If the return value is a struct and we don't have a return
+ value address then we need to make one. */
+
diff --git a/dev-libs/libffi/files/libffi-3.4.4-lld-17.patch b/dev-libs/libffi/files/libffi-3.4.4-lld-17.patch
new file mode 100644
index 000000000000..8e87814b23bf
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.4-lld-17.patch
@@ -0,0 +1,34 @@
+https://bugs.gentoo.org/915086
+https://github.com/libffi/libffi/pull/800
+
+From 65f6869fd74630a9252ef89971b725b921f17061 Mon Sep 17 00:00:00 2001
+From: Alfred Wingate <parona@protonmail.com>
+Date: Tue, 10 Oct 2023 06:32:02 +0300
+Subject: [PATCH] Put optional symbols behind ifdefs
+
+Signed-off-by: Alfred Wingate <parona@protonmail.com>
+--- a/libffi.map.in
++++ b/libffi.map.in
+@@ -33,7 +33,10 @@ LIBFFI_BASE_8.0 {
+ ffi_raw_to_ptrarray;
+ ffi_raw_size;
+
++#if !FFI_NATIVE_RAW_API
+ ffi_java_raw_call;
++#endif
++
+ ffi_java_ptrarray_to_raw;
+ ffi_java_raw_to_ptrarray;
+ ffi_java_raw_size;
+@@ -62,8 +65,10 @@ LIBFFI_CLOSURE_8.0 {
+ ffi_prep_closure_loc;
+ ffi_prep_raw_closure;
+ ffi_prep_raw_closure_loc;
++#if !FFI_NATIVE_RAW_API
+ ffi_prep_java_raw_closure;
+ ffi_prep_java_raw_closure_loc;
++#endif
+ } LIBFFI_BASE_8.0;
+ #endif
+
+
diff --git a/dev-libs/libffi/files/libffi-3.4.4-sparc-float-typo.patch b/dev-libs/libffi/files/libffi-3.4.4-sparc-float-typo.patch
new file mode 100644
index 000000000000..3768df62df9f
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.4-sparc-float-typo.patch
@@ -0,0 +1,28 @@
+https://github.com/libffi/libffi/issues/778
+https://bugs.gentoo.org/882071
+
+Fix incorrect type for passing floats. Thanks to Petr Sumbera and Richard Henderson
+for figuring it out on the upstream bug.
+--- a/src/sparc/ffi64.c
++++ b/src/sparc/ffi64.c
+@@ -382,13 +382,19 @@ ffi_prep_args_v9(ffi_cif *cif, unsigned long *argp, void *rvalue, void **avalue)
+ *argp++ = *(SINT32 *)a;
+ break;
+ case FFI_TYPE_UINT32:
+- case FFI_TYPE_FLOAT:
+ *argp++ = *(UINT32 *)a;
+ break;
+ case FFI_TYPE_SINT64:
+ case FFI_TYPE_UINT64:
+ case FFI_TYPE_POINTER:
++ *argp++ = *(UINT64 *)a;
++ break;
++ case FFI_TYPE_FLOAT:
++ flags |= SPARC_FLAG_FP_ARGS;
++ *argp++ = *(UINT32 *)a;
++ break;
+ case FFI_TYPE_DOUBLE:
++ flags |= SPARC_FLAG_FP_ARGS;
+ *argp++ = *(UINT64 *)a;
+ break;
+
diff --git a/dev-libs/libffi/files/libffi-3.4.4-trampoline-c99.patch b/dev-libs/libffi/files/libffi-3.4.4-trampoline-c99.patch
new file mode 100644
index 000000000000..a7728331135e
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.4.4-trampoline-c99.patch
@@ -0,0 +1,39 @@
+https://github.com/libffi/libffi/issues/760
+https://github.com/libffi/libffi/commit/ce077e5565366171aa1b4438749b0922fce887a4
+
+From ce077e5565366171aa1b4438749b0922fce887a4 Mon Sep 17 00:00:00 2001
+From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
+Date: Thu, 2 Feb 2023 14:46:29 +0000
+Subject: [PATCH] Forward declare open_temp_exec_file (#764)
+
+It's defined in closures.c and used in tramp.c.
+Also declare it as an hidden symbol, as it should be.
+
+Co-authored-by: serge-sans-paille <sguelton@mozilla.com>
+--- a/include/ffi_common.h
++++ b/include/ffi_common.h
+@@ -128,6 +128,10 @@ void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN;
+ static trampoline. */
+ int ffi_tramp_is_present (void *closure) FFI_HIDDEN;
+
++/* Return a file descriptor of a temporary zero-sized file in a
++ writable and executable filesystem. */
++int open_temp_exec_file(void) FFI_HIDDEN;
++
+ /* Extended cif, used in callback from assembly routine */
+ typedef struct
+ {
+--- a/src/tramp.c
++++ b/src/tramp.c
+@@ -39,6 +39,10 @@
+ #ifdef __linux__
+ #define _GNU_SOURCE 1
+ #endif
++
++#include <ffi.h>
++#include <ffi_common.h>
++
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+
diff --git a/dev-libs/libffi/libffi-3.3-r2.ebuild b/dev-libs/libffi/libffi-3.4.4-r3.ebuild
index 3d1f2530f8fe..835adbe61215 100644
--- a/dev-libs/libffi/libffi-3.3-r2.ebuild
+++ b/dev-libs/libffi/libffi-3.4.4-r3.ebuild
@@ -1,46 +1,41 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
-inherit multilib-minimal
+EAPI=8
+
+inherit multilib-minimal preserve-libs
MY_PV=${PV/_rc/-rc}
MY_P=${PN}-${MY_PV}
-DESCRIPTION="a portable, high level programming interface to various calling conventions"
+DESCRIPTION="Portable, high level programming interface to various calling conventions"
HOMEPAGE="https://sourceware.org/libffi/"
SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
+S="${WORKDIR}"/${MY_P}
LICENSE="MIT"
-SLOT="0/7" # SONAME=libffi.so.7
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="debug pax-kernel static-libs test"
+# This is a core package which is depended on by e.g. Python
+# Please use preserve-libs.eclass in pkg_{pre,post}inst to cover users
+# with FEATURES="-preserved-libs" or another package manager if SONAME
+# changes.
+SLOT="0/8" # SONAME=libffi.so.8
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="debug exec-static-trampoline pax-kernel static-libs test"
RESTRICT="!test? ( test )"
-
-RDEPEND=""
-DEPEND=""
BDEPEND="test? ( dev-util/dejagnu )"
-DOCS="ChangeLog* README.md"
-
PATCHES=(
- "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
- "${FILESDIR}"/${PN}-3.3_rc0-ppc-macos-go.patch
- "${FILESDIR}"/${PN}-3.3-power7.patch
- "${FILESDIR}"/${PN}-3.3-power7-memcpy.patch
- "${FILESDIR}"/${PN}-3.3-power7-memcpy-2.patch
- "${FILESDIR}"/${PN}-3.3-ppc-int128.patch
- "${FILESDIR}"/${PN}-3.3-ppc-vector-offset.patch
- "${FILESDIR}"/${PN}-3.3-compiler-vendor-quote.patch
+ "${FILESDIR}"/${P}-hppa-large-struct.patch
+ "${FILESDIR}"/${P}-hppa-closure-function-ptrs.patch
+ "${FILESDIR}"/${P}-hppa-jump-table.patch
+ "${FILESDIR}"/${P}-sparc-float-typo.patch
+ "${FILESDIR}"/${P}-lld-17.patch
)
-S=${WORKDIR}/${MY_P}
-
-ECONF_SOURCE=${S}
-
src_prepare() {
default
+
if [[ ${CHOST} == arm64-*-darwin* ]] ; then
# ensure we use aarch64 asm, not x86 on arm64
sed -i -e 's/aarch64\*-\*-\*/arm64*-*-*|&/' \
@@ -60,15 +55,28 @@ multilib_src_configure() {
# 2. have ${ABI}-specific location as ffi.h is target-dependent.
#
# We use /usr/$(get_libdir)/... to have ABI identifier.
- econf \
+ ECONF_SOURCE="${S}" econf \
--includedir="${EPREFIX}"/usr/$(get_libdir)/${PN}/include \
--disable-multi-os-directory \
$(use_enable static-libs static) \
+ $(use_enable exec-static-trampoline exec-static-tramp) \
$(use_enable pax-kernel pax_emutramp) \
$(use_enable debug)
}
+multilib_src_test() {
+ emake -Onone check
+}
+
multilib_src_install_all() {
- find "${ED}" -name "*.la" -delete || die
einstalldocs
+ find "${ED}" -name "*.la" -delete || die
+}
+
+pkg_preinst() {
+ preserve_old_lib /usr/$(get_libdir)/libffi.so.7
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /usr/$(get_libdir)/libffi.so.7
}
diff --git a/dev-libs/libffi/libffi-3.4.4-r4.ebuild b/dev-libs/libffi/libffi-3.4.4-r4.ebuild
new file mode 100644
index 000000000000..a80f5a73f9d6
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.4.4-r4.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit multilib-minimal preserve-libs
+
+MY_PV=${PV/_rc/-rc}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Portable, high level programming interface to various calling conventions"
+HOMEPAGE="https://sourceware.org/libffi/"
+SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="MIT"
+# This is a core package which is depended on by e.g. Python
+# Please use preserve-libs.eclass in pkg_{pre,post}inst to cover users
+# with FEATURES="-preserved-libs" or another package manager if SONAME
+# changes.
+SLOT="0/8" # SONAME=libffi.so.8
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="debug exec-static-trampoline pax-kernel static-libs test"
+
+RESTRICT="!test? ( test )"
+BDEPEND="test? ( dev-util/dejagnu )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-hppa-large-struct.patch
+ "${FILESDIR}"/${P}-hppa-closure-function-ptrs.patch
+ "${FILESDIR}"/${P}-hppa-jump-table.patch
+ "${FILESDIR}"/${P}-sparc-float-typo.patch
+ "${FILESDIR}"/${P}-lld-17.patch
+ "${FILESDIR}"/${P}-trampoline-c99.patch
+)
+
+src_prepare() {
+ default
+
+ if [[ ${CHOST} == arm64-*-darwin* ]] ; then
+ # ensure we use aarch64 asm, not x86 on arm64
+ sed -i -e 's/aarch64\*-\*-\*/arm64*-*-*|&/' \
+ configure configure.host || die
+ fi
+}
+
+multilib_src_configure() {
+ # --includedir= path maintains a few properties:
+ # 1. have stable name across libffi versions: some packages like
+ # dev-lang/ghc or kde-frameworks/networkmanager-qt embed
+ # ${includedir} at build-time. Don't require those to be
+ # rebuilt unless SONAME changes. bug #695788
+ #
+ # We use /usr/.../${PN} (instead of former /usr/.../${P}).
+ #
+ # 2. have ${ABI}-specific location as ffi.h is target-dependent.
+ #
+ # We use /usr/$(get_libdir)/... to have ABI identifier.
+ ECONF_SOURCE="${S}" econf \
+ --includedir="${EPREFIX}"/usr/$(get_libdir)/${PN}/include \
+ --disable-multi-os-directory \
+ $(use_enable static-libs static) \
+ $(use_enable exec-static-trampoline exec-static-tramp) \
+ $(use_enable pax-kernel pax_emutramp) \
+ $(use_enable debug)
+}
+
+multilib_src_test() {
+ emake -Onone check
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ find "${ED}" -name "*.la" -delete || die
+}
+
+pkg_preinst() {
+ preserve_old_lib /usr/$(get_libdir)/libffi.so.7
+}
+
+pkg_postinst() {
+ preserve_old_lib_notify /usr/$(get_libdir)/libffi.so.7
+}
diff --git a/dev-libs/libffi/libffi-3.4.2-r1.ebuild b/dev-libs/libffi/libffi-3.4.6.ebuild
index 492d9b34c625..999a90fa9eaa 100644
--- a/dev-libs/libffi/libffi-3.4.2-r1.ebuild
+++ b/dev-libs/libffi/libffi-3.4.6.ebuild
@@ -1,36 +1,32 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
+EAPI=8
inherit multilib-minimal preserve-libs
MY_PV=${PV/_rc/-rc}
MY_P=${PN}-${MY_PV}
-DESCRIPTION="a portable, high level programming interface to various calling conventions"
+DESCRIPTION="Portable, high level programming interface to various calling conventions"
HOMEPAGE="https://sourceware.org/libffi/"
SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
S="${WORKDIR}"/${MY_P}
LICENSE="MIT"
-# This is a core package which is depended on by e.g. Python
+# This is a core package which is depended on by e.g. Python.
# Please use preserve-libs.eclass in pkg_{pre,post}inst to cover users
-# with FEATURES="-preserved-libs" or another package manager if SONAME
-# changes.
+# with FEATURES="-preserved-libs" or another package manager if SONAME changes.
SLOT="0/8" # SONAME=libffi.so.8
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="debug exec-static-trampoline pax-kernel static-libs test"
RESTRICT="!test? ( test )"
BDEPEND="test? ( dev-util/dejagnu )"
-DOCS="ChangeLog* README.md"
-
-ECONF_SOURCE=${S}
-
src_prepare() {
default
+
if [[ ${CHOST} == arm64-*-darwin* ]] ; then
# ensure we use aarch64 asm, not x86 on arm64
sed -i -e 's/aarch64\*-\*-\*/arm64*-*-*|&/' \
@@ -50,7 +46,7 @@ multilib_src_configure() {
# 2. have ${ABI}-specific location as ffi.h is target-dependent.
#
# We use /usr/$(get_libdir)/... to have ABI identifier.
- econf \
+ ECONF_SOURCE="${S}" econf \
--includedir="${EPREFIX}"/usr/$(get_libdir)/${PN}/include \
--disable-multi-os-directory \
$(use_enable static-libs static) \
@@ -59,9 +55,13 @@ multilib_src_configure() {
$(use_enable debug)
}
+multilib_src_test() {
+ emake -Onone check
+}
+
multilib_src_install_all() {
- find "${ED}" -name "*.la" -delete || die
einstalldocs
+ find "${ED}" -name "*.la" -delete || die
}
pkg_preinst() {
diff --git a/dev-libs/libffi/metadata.xml b/dev-libs/libffi/metadata.xml
index 53754327cd3f..aa5aa78f433f 100644
--- a/dev-libs/libffi/metadata.xml
+++ b/dev-libs/libffi/metadata.xml
@@ -39,5 +39,6 @@
</use>
<upstream>
<remote-id type="cpe">cpe:/a:libffi_project:libffi</remote-id>
+ <remote-id type="github">libffi/libffi</remote-id>
</upstream>
</pkgmetadata>