Compare commits
8 Commits
93f40cb825
...
65322855b7
Author | SHA1 | Date |
---|---|---|
David Abdurachmanov | 65322855b7 | |
David Abdurachmanov | 017eb83856 | |
Florian Weimer | 18bec18c13 | |
Yaakov Selkowitz | a7063fb8f9 | |
Fedora Release Engineering | 586a259cea | |
DJ Delorie | 6d176a7c52 | |
Fedora Release Engineering | 4c5c11f73d | |
DJ Delorie | 09778f4c43 |
|
@ -4,3 +4,4 @@ libffi-3.0.9.tar.gz
|
|||
/libffi-3.0.13.tar.gz
|
||||
/libffi-3.1.tar.gz
|
||||
/libffi-3.4.2.tar.gz
|
||||
/libffi-3.4.4.tar.gz
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
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>
|
||||
---
|
||||
include/ffi_common.h | 4 ++++
|
||||
src/tramp.c | 4 ++++
|
||||
2 files changed, 8 insertions(+)
|
||||
|
||||
diff --git a/include/ffi_common.h b/include/ffi_common.h
|
||||
index 2bd31b03d..c53a79493 100644
|
||||
--- 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
|
||||
{
|
||||
diff --git a/src/tramp.c b/src/tramp.c
|
||||
index 7e005b054..5f19b557f 100644
|
||||
--- 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>
|
|
@ -1,58 +0,0 @@
|
|||
From 4b0c358e28fae22164bf0d423f183dfed8a1ba10 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@linux-m68k.org>
|
||||
Date: Mon, 10 Oct 2022 17:57:47 +0200
|
||||
Subject: [PATCH] riscv: make copies of structs passed by reference (#738)
|
||||
|
||||
Co-authored-by: Andreas Schwab <schwab@suse.de>
|
||||
---
|
||||
src/riscv/ffi.c | 12 +++++++++---
|
||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/riscv/ffi.c b/src/riscv/ffi.c
|
||||
index f08191dcc..b455b12ae 100644
|
||||
--- a/src/riscv/ffi.c
|
||||
+++ b/src/riscv/ffi.c
|
||||
@@ -61,6 +61,7 @@ typedef struct call_builder
|
||||
int used_integer;
|
||||
int used_float;
|
||||
size_t *used_stack;
|
||||
+ void *struct_stack;
|
||||
} call_builder;
|
||||
|
||||
/* integer (not pointer) less than ABI XLEN */
|
||||
@@ -227,7 +228,9 @@ static void marshal(call_builder *cb, ffi_type *type, int var, void *data) {
|
||||
#endif
|
||||
|
||||
if (type->size > 2 * __SIZEOF_POINTER__) {
|
||||
- /* pass by reference */
|
||||
+ /* copy to stack and pass by reference */
|
||||
+ data = memcpy (cb->struct_stack, data, type->size);
|
||||
+ cb->struct_stack = (size_t *) FFI_ALIGN ((char *) cb->struct_stack + type->size, __SIZEOF_POINTER__);
|
||||
marshal_atom(cb, FFI_TYPE_POINTER, &data);
|
||||
} else if (IS_INT(type->type) || type->type == FFI_TYPE_POINTER) {
|
||||
marshal_atom(cb, type->type, data);
|
||||
@@ -335,10 +338,12 @@ ffi_call_int (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue,
|
||||
that all remaining arguments are long long / __int128 */
|
||||
size_t arg_bytes = cif->nargs <= 3 ? 0 :
|
||||
FFI_ALIGN(2 * sizeof(size_t) * (cif->nargs - 3), STKALIGN);
|
||||
+ /* Allocate space for copies of big structures. */
|
||||
+ size_t struct_bytes = FFI_ALIGN (cif->bytes, STKALIGN);
|
||||
size_t rval_bytes = 0;
|
||||
if (rvalue == NULL && cif->rtype->size > 2*__SIZEOF_POINTER__)
|
||||
rval_bytes = FFI_ALIGN(cif->rtype->size, STKALIGN);
|
||||
- size_t alloc_size = arg_bytes + rval_bytes + sizeof(call_context);
|
||||
+ size_t alloc_size = arg_bytes + rval_bytes + struct_bytes + sizeof(call_context);
|
||||
|
||||
/* the assembly code will deallocate all stack data at lower addresses
|
||||
than the argument region, so we need to allocate the frame and the
|
||||
@@ -358,8 +363,9 @@ ffi_call_int (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue,
|
||||
|
||||
call_builder cb;
|
||||
cb.used_float = cb.used_integer = 0;
|
||||
- cb.aregs = (call_context*)(alloc_base + arg_bytes + rval_bytes);
|
||||
+ cb.aregs = (call_context*)(alloc_base + arg_bytes + rval_bytes + struct_bytes);
|
||||
cb.used_stack = (void*)alloc_base;
|
||||
+ cb.struct_stack = (void *) (alloc_base + arg_bytes + rval_bytes);
|
||||
|
||||
int return_by_ref = passed_by_ref(&cb, cif->rtype, 0);
|
||||
if (return_by_ref)
|
|
@ -1,26 +0,0 @@
|
|||
From 83ce80f3194bbf95c39764d075b070389c0f8522 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
|
||||
Date: Mon, 31 Jan 2022 09:21:53 +0000
|
||||
Subject: [PATCH] powerpc64: fix handling of homogeneous float128 structs
|
||||
|
||||
If there is a homogeneous struct with float128 members, they should be
|
||||
copied to vector register save area. The current code incorrectly copies
|
||||
only the value of the first member, not increasing the pointer with each
|
||||
iteration. Fix this.
|
||||
---
|
||||
src/powerpc/ffi_linux64.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/powerpc/ffi_linux64.c b/src/powerpc/ffi_linux64.c
|
||||
index 4d50878e4..3454dacd3 100644
|
||||
--- a/src/powerpc/ffi_linux64.c
|
||||
+++ b/src/powerpc/ffi_linux64.c
|
||||
@@ -680,7 +680,7 @@ ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack)
|
||||
{
|
||||
if (vecarg_count < NUM_VEC_ARG_REGISTERS64
|
||||
&& i < nfixedargs)
|
||||
- memcpy (vec_base.f128++, arg.f128, sizeof (float128));
|
||||
+ memcpy (vec_base.f128++, arg.f128++, sizeof (float128));
|
||||
else
|
||||
memcpy (next_arg.f128, arg.f128++, sizeof (float128));
|
||||
if (++next_arg.f128 == gpr_end.f128)
|
Binary file not shown.
44
libffi.spec
44
libffi.spec
|
@ -3,20 +3,19 @@
|
|||
%global multilib_arches %{ix86} x86_64
|
||||
|
||||
Name: libffi
|
||||
Version: 3.4.3
|
||||
Release: 1.1.riscv64%{?dist}
|
||||
Version: 3.4.4
|
||||
Release: 5.0.riscv64%{?dist}
|
||||
Summary: A portable foreign function interface library
|
||||
License: MIT
|
||||
URL: http://sourceware.org/libffi
|
||||
|
||||
Source0: https://github.com/libffi/libffi/releases/download/v3.4.3/libffi-3.4.3.tar.gz
|
||||
Source0: https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4.tar.gz
|
||||
Source1: ffi-multilib.h
|
||||
Source2: ffitarget-multilib.h
|
||||
|
||||
Patch10: 4b0c358e28fae22164bf0d423f183dfed8a1ba10.patch
|
||||
|
||||
# https://github.com/libffi/libffi/pull/689
|
||||
#Patch0: libffi-3.4.2-ppc.patch
|
||||
# error: implicit declaration of function 'open_temp_exec_file'
|
||||
# https://github.com/libffi/libffi/pull/764
|
||||
Patch0: 0001-Forward-declare-open_temp_exec_file.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc
|
||||
|
@ -70,7 +69,11 @@ developing applications that use %{name}.
|
|||
# https://gitlab.haskell.org/ghc/ghc/-/issues/20051
|
||||
# https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283
|
||||
# We need to get these fixes into Fedora before we can reeanble them.
|
||||
%configure --disable-static --disable-exec-static-tramp
|
||||
%configure \
|
||||
%ifarch riscv64
|
||||
--libdir=%{_libdir} \
|
||||
%endif
|
||||
--disable-static
|
||||
%make_build
|
||||
|
||||
%check
|
||||
|
@ -102,10 +105,13 @@ install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/ffi.h
|
|||
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h
|
||||
%endif
|
||||
|
||||
%ifarch riscv64
|
||||
# Print the content of buildroot
|
||||
find $RPM_BUILD_ROOT
|
||||
# Install libraries to a proper riscv64 libdir location
|
||||
mv -v ${RPM_BUILD_ROOT}%{_libdir}/lp64d/* ${RPM_BUILD_ROOT}%{_libdir}/
|
||||
rm -rf ${RPM_BUILD_ROOT}%{_libdir}/lp64d
|
||||
%endif
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
|
@ -113,7 +119,7 @@ rm -rf ${RPM_BUILD_ROOT}%{_libdir}/lp64d
|
|||
%license LICENSE
|
||||
%doc README.md
|
||||
%{_libdir}/libffi.so.8
|
||||
%{_libdir}/libffi.so.8.1.1
|
||||
%{_libdir}/libffi.so.8.1.2
|
||||
|
||||
%files devel
|
||||
%{_libdir}/pkgconfig/*.pc
|
||||
|
@ -123,11 +129,23 @@ rm -rf ${RPM_BUILD_ROOT}%{_libdir}/lp64d
|
|||
%{_infodir}/libffi.info.*
|
||||
|
||||
%changelog
|
||||
* Fri Sep 23 2022 David Abdurachmanov <davidlt@rivosinc.com> - 3.4.3-1.1.riscv64
|
||||
- Backport fix for 738 (fix for struct_by_value_big)
|
||||
* Tue Jan 09 2024 David Abdurachmanov <davidlt@rivosinc.com> - 3.4.4-5.0.riscv64
|
||||
- Fix libdir for riscv64
|
||||
|
||||
* Fri Sep 23 2022 David Abdurachmanov <davidlt@rivosinc.com> - 3.4.3-1.0.riscv64
|
||||
- Update to 3.4.3
|
||||
* Tue Jan 02 2024 Florian Weimer <fweimer@redhat.com> - 3.4.4-5
|
||||
- Add missing declaration of open_temp_exec_file
|
||||
|
||||
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.4-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Tue May 02 2023 DJ Delorie <dj@redhat.com> - 3.4.4-3
|
||||
- Enable static trampolines
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Fri Oct 28 2022 DJ Delorie <dj@redhat.com> - 3.4.4-1
|
||||
- Rebase to libffi 3.4.4.
|
||||
|
||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.2-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
|
2
sources
2
sources
|
@ -1 +1 @@
|
|||
SHA512 (libffi-3.4.2.tar.gz) = 31bad35251bf5c0adb998c88ff065085ca6105cf22071b9bd4b5d5d69db4fadf16cadeec9baca944c4bb97b619b035bb8279de8794b922531fddeb0779eb7fb1
|
||||
SHA512 (libffi-3.4.4.tar.gz) = 88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889
|
||||
|
|
Loading…
Reference in New Issue