commit:     7bb683da9daae84171957f55941320f198ac3ce1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 26 03:55:42 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 26 03:55:52 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7bb683da

dev-libs/libaio: fix tests on x32

This uses Andrii's patch but tweaked to accommodate GCC's 
r11-257-g13a46321516e2e
where __ILP32__ started to be defined even for -m32. Instead, we check for
x32 specifically (x86-64 and not LP64) because of x32's syscall convention.

Closes: https://bugs.gentoo.org/722672
Thanks-to: Andrii Batyiev <batyiev <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/libaio/files/libaio-0.3.113-x32.patch     | 48 ++++++++++++++++++++++
 ...libaio-9999.ebuild => libaio-0.3.113-r2.ebuild} |  4 +-
 dev-libs/libaio/libaio-9999.ebuild                 |  4 +-
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/dev-libs/libaio/files/libaio-0.3.113-x32.patch 
b/dev-libs/libaio/files/libaio-0.3.113-x32.patch
new file mode 100644
index 000000000000..39aacd46b65d
--- /dev/null
+++ b/dev-libs/libaio/files/libaio-0.3.113-x32.patch
@@ -0,0 +1,48 @@
+https://bugs.gentoo.org/722672#c4
+--- a/src/syscall-x86_64.h
++++ b/src/syscall-x86_64.h
+@@ -1,6 +1,16 @@
++#if ! defined(__ILP32__)
+ #define __NR_io_setup         206
+ #define __NR_io_destroy               207
+ #define __NR_io_getevents     208
+ #define __NR_io_submit                209
+ #define __NR_io_cancel                210
+ #define __NR_io_pgetevents    333
++#else
++#define __X32_SYSCALL_BIT       0x40000000
++#define __NR_io_setup         (__X32_SYSCALL_BIT + 543)
++#define __NR_io_destroy       (__X32_SYSCALL_BIT + 207)
++#define __NR_io_getevents     (__X32_SYSCALL_BIT + 208)
++#define __NR_io_submit                (__X32_SYSCALL_BIT + 544)
++#define __NR_io_cancel                (__X32_SYSCALL_BIT + 210)
++#define __NR_io_pgetevents    (__X32_SYSCALL_BIT + 333)
++#endif
+--- a/src/io_pgetevents.c
++++ b/src/io_pgetevents.c
+@@ -21,6 +21,7 @@
+ #include <stdlib.h>
+ #include <time.h>
+ #include <signal.h>
++#include <stdint.h>
+ #include "syscall.h"
+ #include "aio_ring.h"
+ 
+@@ -33,10 +34,17 @@
+               struct io_event *events, struct timespec *timeout,
+               sigset_t *sigmask)
+ {
++#if (defined(__x86_64__) && ! defined(__ILP32__)) || ! defined(__x86_64__)
+       struct {
+               unsigned long ss;
+               unsigned long ss_len;
+       } data;
++#else
++      struct {
++              uint64_t ss;
++              uint64_t ss_len;
++      } data;
++#endif
+ 
+       if (aio_ring_is_empty(ctx, timeout))
+               return 0;

diff --git a/dev-libs/libaio/libaio-9999.ebuild 
b/dev-libs/libaio/libaio-0.3.113-r2.ebuild
similarity index 94%
copy from dev-libs/libaio/libaio-9999.ebuild
copy to dev-libs/libaio/libaio-0.3.113-r2.ebuild
index 546ecc00a293..9bfdd449884d 100644
--- a/dev-libs/libaio/libaio-9999.ebuild
+++ b/dev-libs/libaio/libaio-0.3.113-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -24,6 +24,8 @@ RESTRICT="!test? ( test )"
 PATCHES=(
        "${FILESDIR}"/${PN}-0.3.112-cppflags.patch
        "${FILESDIR}"/${PN}-0.3.113-respect-LDFLAGS.patch
+       "${FILESDIR}"/${PN}-0.3.113-32-bit-tests.patch
+       "${FILESDIR}"/${PN}-0.3.113-x32.patch
 )
 
 src_prepare() {

diff --git a/dev-libs/libaio/libaio-9999.ebuild 
b/dev-libs/libaio/libaio-9999.ebuild
index 546ecc00a293..9bfdd449884d 100644
--- a/dev-libs/libaio/libaio-9999.ebuild
+++ b/dev-libs/libaio/libaio-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -24,6 +24,8 @@ RESTRICT="!test? ( test )"
 PATCHES=(
        "${FILESDIR}"/${PN}-0.3.112-cppflags.patch
        "${FILESDIR}"/${PN}-0.3.113-respect-LDFLAGS.patch
+       "${FILESDIR}"/${PN}-0.3.113-32-bit-tests.patch
+       "${FILESDIR}"/${PN}-0.3.113-x32.patch
 )
 
 src_prepare() {

Reply via email to