!64 [sync] PR-57: 修复riscv架构上测试错误

From: @openeuler-sync-bot 
Reviewed-by: @ziyangc 
Signed-off-by: @ziyangc
This commit is contained in:
openeuler-ci-bot 2023-04-10 02:32:42 +00:00 committed by Gitee
commit 974361437a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 59 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: libffi Name: libffi
Version: 3.4.2 Version: 3.4.2
Release: 6 Release: 7
Summary: A Portable Foreign Function Interface Library Summary: A Portable Foreign Function Interface Library
License: MIT License: MIT
URL: http://sourceware.org/libffi URL: http://sourceware.org/libffi
@ -12,6 +12,7 @@ Patch0: backport-x86-64-Always-double-jump-table-slot-size-for-CET-71.patch
Patch1: backport-Fix-check-for-invalid-varargs-arguments-707.patch Patch1: backport-Fix-check-for-invalid-varargs-arguments-707.patch
Patch2: libffi-Add-sw64-architecture.patch Patch2: libffi-Add-sw64-architecture.patch
Patch3: backport-Fix-signed-vs-unsigned-comparison.patch Patch3: backport-Fix-signed-vs-unsigned-comparison.patch
Patch4: riscv-extend-return-types-smaller-than-ffi_arg-680.patch
BuildRequires: gcc gcc-c++ dejagnu BuildRequires: gcc gcc-c++ dejagnu
BuildRequires: make BuildRequires: make
@ -99,6 +100,12 @@ fi
%{_infodir}/libffi.info.gz %{_infodir}/libffi.info.gz
%changelog %changelog
* Wed Mar 29 2023 laokz <zhangkai@iscas.ac.cn> - 3.4.2-7
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:Backport upstream patch to fix riscv %check error
* Thu Mar 23 2023 fuanan <fuanan3@h-partners.com> - 3.4.2-6 * Thu Mar 23 2023 fuanan <fuanan3@h-partners.com> - 3.4.2-6
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA

View File

@ -0,0 +1,51 @@
From aa3fce08ba620c50db17215a9f14dd0f1facf741 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Sun, 13 Feb 2022 21:04:33 +0100
Subject: [PATCH] riscv: extend return types smaller than ffi_arg (#680)
Co-authored-by: Andreas Schwab <schwab@suse.de>
---
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.39.2