commit: 0c2f6e7e4647aa7f51d024da2699a5762297490e Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> AuthorDate: Sat Jan 17 16:22:25 2026 +0000 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> CommitDate: Sat Jan 17 16:24:45 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c2f6e7e
sys-apps/kmod: Add s390 build fix Bug: https://github.com/kmod-project/kmod/issues/402 Closes: https://bugs.gentoo.org/962314 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org> sys-apps/kmod/files/kmod-34.2-s390.patch | 53 ++++++++++++++++++++++++++++++++ sys-apps/kmod/kmod-34.2.ebuild | 6 +++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/sys-apps/kmod/files/kmod-34.2-s390.patch b/sys-apps/kmod/files/kmod-34.2-s390.patch new file mode 100644 index 000000000000..be6634029003 --- /dev/null +++ b/sys-apps/kmod/files/kmod-34.2-s390.patch @@ -0,0 +1,53 @@ +From 4e18b842b3dae5486adb2c6cc11bdfdd53ee8646 Mon Sep 17 00:00:00 2001 +From: Tobias Stoeckmann <[email protected]> +Date: Wed, 14 Jan 2026 20:58:50 +0100 +Subject: [PATCH] util: Add s390 31 bit mode support + +Even though size_t is of the same size as a uint32_t, the s390 +architecture is a bit picky about its 31 bit mode with size_t. + +Use custom code to fix this issue in a rather architecture +independent but unfortunately slower way for s390 31 bit mode. + +Reference: https://github.com/kmod-project/kmod/issues/402 +Signed-off-by: Tobias Stoeckmann <[email protected]> +--- + shared/util.h | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/shared/util.h b/shared/util.h +index bf3f1009..b785f5b1 100644 +--- a/shared/util.h ++++ b/shared/util.h +@@ -123,7 +123,15 @@ static inline bool uaddsz_overflow(size_t a, size_t b, size_t *res) + #if __SIZEOF_SIZE_T__ == 8 + return uadd64_overflow(a, b, res); + #elif __SIZEOF_SIZE_T__ == 4 ++#ifdef __s390__ ++ if (b < SIZE_MAX - a) { ++ *res = a + b; ++ return true; ++ } ++ return false; ++#else + return uadd32_overflow(a, b, res); ++#endif + #else + #error "Unknown sizeof(size_t)" + #endif +@@ -167,7 +175,15 @@ static inline bool umulsz_overflow(size_t a, size_t b, size_t *res) + #if __SIZEOF_SIZE_T__ == 8 + return umul64_overflow(a, b, res); + #elif __SIZEOF_SIZE_T__ == 4 ++#ifdef __s390__ ++ if (a == 0 || b <= SIZE_MAX / a) { ++ *res = a * b; ++ return true; ++ } ++ return false; ++#else + return umul32_overflow(a, b, res); ++#endif + #else + #error "Unknown sizeof(size_t)" + #endif diff --git a/sys-apps/kmod/kmod-34.2.ebuild b/sys-apps/kmod/kmod-34.2.ebuild index 619e78350778..c8e68cf22163 100644 --- a/sys-apps/kmod/kmod-34.2.ebuild +++ b/sys-apps/kmod/kmod-34.2.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -40,6 +40,10 @@ BDEPEND=" zlib? ( virtual/pkgconfig ) " +PATCHES=( + "${FILESDIR}/${P}-s390.patch" +) + pkg_setup() { : }
