From 16006e09f894d251bfb7b3e3239b4766aaf0e06eabe86c0f772c46c2516fd031 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Wed, 28 Sep 2022 15:51:07 +0000 Subject: [PATCH] Updating link to change in openSUSE:Factory/libffi revision 11.0 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libffi?expand=0&rev=572816b58542a7c51451b3fc476d5bb1 --- libffi.changes | 5 +++++ libffi.spec | 3 ++- riscv-rvalue-ext.patch | 50 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 riscv-rvalue-ext.patch diff --git a/libffi.changes b/libffi.changes index 429698e..7904f40 100644 --- a/libffi.changes +++ b/libffi.changes @@ -11,6 +11,11 @@ Fri Sep 23 13:17:48 UTC 2022 - Richard Biener - includes fix for RISCV64 - disable LTO due to (ffi#733) +------------------------------------------------------------------- +Fri Sep 23 12:48:15 UTC 2022 - Dirk Müller + +- add riscv-rvalue-ext.patch to fix libffi for RISCV64 + ------------------------------------------------------------------- Wed Dec 1 15:44:46 UTC 2021 - Dirk Müller diff --git a/libffi.spec b/libffi.spec index ac6226f..4eb8997 100644 --- a/libffi.spec +++ b/libffi.spec @@ -26,6 +26,7 @@ Group: Development/Languages/C and C++ URL: https://sourceware.org/libffi/ Source: https://github.com/libffi/libffi/releases/download/v%{version}/libffi-%{version}.tar.gz Source99: baselibs.conf +Patch24301: riscv-rvalue-ext.patch # for make check BuildRequires: dejagnu BuildRequires: expect @@ -64,7 +65,7 @@ time. %postun -n libffi%{libffi_sover} -p /sbin/ldconfig %prep -%setup -q +%autosetup -p1 %build # https://github.com/libffi/libffi/issues/733 diff --git a/riscv-rvalue-ext.patch b/riscv-rvalue-ext.patch new file mode 100644 index 0000000..1db6705 --- /dev/null +++ b/riscv-rvalue-ext.patch @@ -0,0 +1,50 @@ +From 1bb79549b68e223c18bbc979d56879c82f0eba53 Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Thu, 9 Dec 2021 23:03:30 +0100 +Subject: [PATCH] riscv: extend return types smaller than ffi_arg + +--- + src/riscv/ffi.c | 27 ++++++++++++++++++++++++++- + 1 file changed, 26 insertions(+), 1 deletion(-) + +diff --git a/src/riscv/ffi.c b/src/riscv/ffi.c +index c910858..ebd05ba 100644 +--- a/src/riscv/ffi.c ++++ b/src/riscv/ffi.c +@@ -373,7 +373,32 @@ ffi_call_int (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue, + + cb.used_float = cb.used_integer = 0; + if (!return_by_ref && rvalue) +- unmarshal(&cb, cif->rtype, 0, rvalue); ++ { ++ if (IS_INT(cif->rtype->type) ++ && cif->rtype->size < sizeof (ffi_arg)) ++ { ++ /* Integer types smaller than ffi_arg need to be extended. */ ++ switch (cif->rtype->type) ++ { ++ case FFI_TYPE_SINT8: ++ case FFI_TYPE_SINT16: ++ case FFI_TYPE_SINT32: ++ unmarshal_atom (&cb, (sizeof (ffi_arg) > 4 ++ ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32), ++ rvalue); ++ break; ++ case FFI_TYPE_UINT8: ++ case FFI_TYPE_UINT16: ++ case FFI_TYPE_UINT32: ++ unmarshal_atom (&cb, (sizeof (ffi_arg) > 4 ++ ? FFI_TYPE_UINT64 : FFI_TYPE_UINT32), ++ rvalue); ++ break; ++ } ++ } ++ else ++ unmarshal(&cb, cif->rtype, 0, rvalue); ++ } + } + + void +-- +2.34.0 +