Accepting request 1006099 from devel:libraries:c_c++

- add riscv-rvalue-ext.patch to fix libffi for RISCV64

OBS-URL: https://build.opensuse.org/request/show/1006099
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libffi?expand=0&rev=11
This commit is contained in:
2022-09-28 15:51:07 +00:00
committed by Git OBS Bridge
3 changed files with 58 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Sep 23 12:48:15 UTC 2022 - Dirk Müller <dmueller@suse.com>
- add riscv-rvalue-ext.patch to fix libffi for RISCV64
-------------------------------------------------------------------
Wed Dec 1 15:44:46 UTC 2021 - Dirk Müller <dmueller@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package libffi
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -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/pull/647

50
riscv-rvalue-ext.patch Normal file
View File

@@ -0,0 +1,50 @@
From 1bb79549b68e223c18bbc979d56879c82f0eba53 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
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