--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: libffi: large structs need to be passed by value on hppa
- From: John David Anglin <dave.anglin@bell.net>
- Date: Sun, 20 Nov 2022 15:49:23 +0000
- Message-id: <166895936374.19079.2040133793421163198.reportbug@mx3210>
Source: libffi
Version: 3.2.1-9
Severity: normal
Tags: patch
Dear Maintainer,
The following tests fail on hppa:
=== libffi tests ===
Schedule of variations:
unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using ../../testsuite/config/default.exp as tool-and-target-specific interface file.
Running ../../testsuite/libffi.bhaible/bhaible.exp ...
Running ../../testsuite/libffi.call/call.exp ...
FAIL: libffi.call/struct_by_value_3.c -W -Wall -Wno-psabi -O0 execution test
FAIL: libffi.call/struct_by_value_3.c -W -Wall -Wno-psabi -O2 execution test
FAIL: libffi.call/struct_by_value_4.c -W -Wall -Wno-psabi -O0 execution test
FAIL: libffi.call/struct_by_value_4.c -W -Wall -Wno-psabi -O2 execution test
FAIL: libffi.call/struct_by_value_big.c -W -Wall -Wno-psabi -O0 execution test
FAIL: libffi.call/struct_by_value_big.c -W -Wall -Wno-psabi -O2 execution test
Running ../../testsuite/libffi.closures/closure.exp ...
Running ../../testsuite/libffi.complex/complex.exp ...
Running ../../testsuite/libffi.go/go.exp ...
=== libffi Summary ===
# of expected passes 1482
# of unexpected failures 6
# of unsupported tests 30
make[3]: *** [Makefile:466: check-DEJAGNU] Error 1
Full log is here:
https://buildd.debian.org/status/fetch.php?pkg=libffi&arch=hppa&ver=3.4.4-1&stamp=1666606326&raw=0
This is upstream issue #749:
https://github.com/libffi/libffi/issues/749
Attached is patch to fix the problem on hppa. It is similar to patch
applied to fix issue on sparc64.
Please apply until issue is fixed in upstream source.
Regards,
Dave Anglin
-- System Information:
Debian Release: bookworm/sid
APT prefers buildd-unstable
APT policy: (500, 'buildd-unstable'), (500, 'unstable')
Architecture: hppa (parisc64)
Kernel: Linux 6.0.9 (SMP w/4 CPU threads)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
diff --git a/src/pa/ffi.c b/src/pa/ffi.c
index 95e6694..186bf69 100644
--- 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. */
--- End Message ---
--- Begin Message ---
Source: libffi
Source-Version: 3.4.4-2
Done: Matthias Klose <doko@debian.org>
We believe that the bug you reported is fixed in the latest version of
libffi, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 1024492@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated libffi package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Sat, 25 Nov 2023 08:17:52 +0100
Source: libffi
Architecture: source
Version: 3.4.4-2
Distribution: unstable
Urgency: medium
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Closes: 1024359 1024492
Changes:
libffi (3.4.4-2) unstable; urgency=medium
.
* Update symbols file for loong64. Closes: #1024359.
* Apply patches for hppa. Closes: #1024492.
* Update symbols for mips64el.
* Update watch file.
* Bump standards version.
Checksums-Sha1:
88f804303ba079a70fe84b80df243c52bd7ac5ba 1951 libffi_3.4.4-2.dsc
44cc00d910085ffa5fd1220c48de8fbb9464ce34 14172 libffi_3.4.4-2.debian.tar.xz
4b1469d932ca9848787299d1bca0e00880e9ce33 6928 libffi_3.4.4-2_source.buildinfo
Checksums-Sha256:
ece62406f97ba791be56d614c44d7e3ade1f32e3f2bdb6e4b17de84e29278f8a 1951 libffi_3.4.4-2.dsc
c49678cfcd2757007f95bc85e695b0aefe6bf83e6806a2cd3a94f33ab9b6b1d9 14172 libffi_3.4.4-2.debian.tar.xz
675bd80d16b767cca46fb400747b01877047b087c4f9a20aa42ff3613c500a57 6928 libffi_3.4.4-2_source.buildinfo
Files:
2c12ee3e0a48e6c38a6704511d903ff4 1951 libs optional libffi_3.4.4-2.dsc
60775ae918f75b8829395244ae483f15 14172 libs optional libffi_3.4.4-2.debian.tar.xz
76178fddecfe98a8fc443479500d7b08 6928 libs optional libffi_3.4.4-2_source.buildinfo
-----BEGIN PGP SIGNATURE-----
iQJEBAEBCgAuFiEE1WVxuIqLuvFAv2PWvX6qYHePpvUFAmVhn8cQHGRva29AZGVi
aWFuLm9yZwAKCRC9fqpgd4+m9UZpEADIyk7e5D0XO3ymL1izLSjIXCqgScyLkUfy
bZ59O+O1BHUr0UN9XCmUvUfGkR9MXHYoOxrzzpbEy3xO2V2O6asvQllF0wvc+aZY
0SscRy/0wefDbx0yjiCwXjhoX38/FtXEH392n6/X9l3KoVfp4KzBTi8zVNCgngkv
ECl3TJPAgDyvCxlrgO5Bxk2BLK6+jHZtofZOJ8t0BM1dPuMtxXHe51Ud9US5Qbft
hsz1Xdzd23OgsiBnoETvotXhADvkYHkt8sFj8idjLvDKo/hiolXG1NTO0ErmXC7o
f0m0ByC4z9a3Pv7WSsjoyfRjn7v4CqRteK2G/1/84A7RE9TKPWvgu7pJ7udNLzxl
kxlLKbrQ4lDg9SUSbD64S4E+FNwmPqi7zavoJzwanozlK5ucqxxpSYQSju8mhJCW
AWu4boEDW7rL+zRSRUeDOu6QXQdl8W26GH6t2EmX31Ry3lUF0T6AQtZKRdeUAAqR
lF9Y9OyvRtFT0fe4Ubs7KB0PqZmawE5OpLEEbWHAMpF7AScjLNs6WPci4knd0s87
B9WLfEGyDnensWYB/sFeab6MA5w+b7mp+ZDUpCjsh+gzQvOUsTRSfvHMLAhL+YBl
oqAIrs0MosEzLhCgxMFVT7QX9WhLc7BYnPiu3THs0Nozvjm0x+wZHjaU7bngNKGT
pWJKS7jMSA==
=DDCh
-----END PGP SIGNATURE-----
--- End Message ---