From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 65DDB158011 for ; Thu, 1 Sep 2022 02:06:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A9113E0A87; Thu, 1 Sep 2022 02:06:33 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8CD90E0A87 for ; Thu, 1 Sep 2022 02:06:33 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 65413340E01 for ; Thu, 1 Sep 2022 02:06:32 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C4FF05B1 for ; Thu, 1 Sep 2022 02:06:30 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1661997863.dbabd1516a53fa57ae0204216ae78741bd4928c9.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libhugetlbfs/files/, sys-libs/libhugetlbfs/ X-VCS-Repository: repo/gentoo X-VCS-Files: sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-ino_t-fix.patch sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-nonnull-fix.patch sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-path-max-fix.patch sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-sc-level2-fix.patch sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild X-VCS-Directories: sys-libs/libhugetlbfs/files/ sys-libs/libhugetlbfs/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: dbabd1516a53fa57ae0204216ae78741bd4928c9 X-VCS-Branch: master Date: Thu, 1 Sep 2022 02:06:30 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 25457748-e5d3-4073-b97f-c6085cd66389 X-Archives-Hash: 693667b09851f2510ad7551556932957 commit: dbabd1516a53fa57ae0204216ae78741bd4928c9 Author: brahmajit das protonmail com> AuthorDate: Sat Jul 23 18:47:48 2022 +0000 Commit: Sam James gentoo org> CommitDate: Thu Sep 1 02:04:23 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dbabd151 sys-libs/libhugetlbfs: fix musl build errors Fix _SC_LEVEL2_CACHE_LINESIZE undeclared and misc issues. Patches for musl that mainly closes bug 828830, plus some other patches for errors that come along 828830. Closes: https://bugs.gentoo.org/828830 Closes: https://bugs.gentoo.org/832980 Signed-off-by: brahmajit das protonmail.com> Closes: https://github.com/gentoo/gentoo/pull/26539 Signed-off-by: Sam James gentoo.org> .../files/libhugetlbfs-2.23-musl-ino_t-fix.patch | 13 +++++++ .../files/libhugetlbfs-2.23-musl-nonnull-fix.patch | 31 +++++++++++++++ .../libhugetlbfs-2.23-musl-path-max-fix.patch | 22 +++++++++++ .../libhugetlbfs-2.23-musl-sc-level2-fix.patch | 45 ++++++++++++++++++++++ sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild | 4 ++ 5 files changed, 115 insertions(+) diff --git a/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-ino_t-fix.patch b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-ino_t-fix.patch new file mode 100644 index 000000000000..f408f9fd6ac0 --- /dev/null +++ b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-ino_t-fix.patch @@ -0,0 +1,13 @@ +# Include dirent.h for ino_t +# Fixes error: unknown typename 'ino_t' +# Closes: https://bugs.gentoo.org/828830 +--- a/tests/hugetests.h ++++ b/tests/hugetests.h +@@ -22,6 +22,7 @@ + + #include + #include ++#include + #include + + #include "libhugetlbfs_privutils.h" diff --git a/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-nonnull-fix.patch b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-nonnull-fix.patch new file mode 100644 index 000000000000..5e3532e50877 --- /dev/null +++ b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-nonnull-fix.patch @@ -0,0 +1,31 @@ +# Use __nonnull only on glibc system +# Closes: https://bugs.gentoo.org/832980 +--- a/shm.c ++++ b/shm.c +@@ -35,6 +35,12 @@ + #endif + + #ifdef HAVE_SHMGET_SYSCALL ++ ++/* define __THROW to avoid build issue when it's not available from the libc */ ++#ifndef __THROW ++#define __THROW ++#endif ++ + /* + * The calls to dlsym() and dlerror() in the shmget() wrapper below force + * a dependency on libdl.so. This does not work for static executables +@@ -48,8 +54,13 @@ + * system shmget() may be performed without worry as there is no dynamic + * call chain. + */ ++#ifdef __GLIBC__ + extern void *dlsym (void *__restrict __handle, __const char *__restrict __name) + __attribute__((weak)) __THROW __nonnull ((2)); ++#else ++extern void *dlsym (void *__restrict __handle, __const char *__restrict __name) ++ __attribute__((weak)) __THROW __attribute__((nonnull((2)))); ++#endif // __GLIBC__ + extern char *dlerror (void) __attribute__((weak)) __THROW; + + diff --git a/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-path-max-fix.patch b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-path-max-fix.patch new file mode 100644 index 000000000000..883bb3e98fc7 --- /dev/null +++ b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-path-max-fix.patch @@ -0,0 +1,22 @@ +# Include limits.h for PATH_MAX +# Closes: https://bugs.gentoo.org/828830 +--- a/hugeadm.c ++++ b/hugeadm.c +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + + #include + #include +--- a/tests/gethugepagesizes.c ++++ b/tests/gethugepagesizes.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #include + #include + diff --git a/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-sc-level2-fix.patch b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-sc-level2-fix.patch new file mode 100644 index 000000000000..c42e017abec1 --- /dev/null +++ b/sys-libs/libhugetlbfs/files/libhugetlbfs-2.23-musl-sc-level2-fix.patch @@ -0,0 +1,45 @@ +# _SC_LEVEL2_CACHE_LINESIZE is most probably Glibc specific define. Hence we +# cannot use it with other libc's. Check if _SC_LEVEL2_CACHE_LINESIZE is +# available or use custom function to get CPU cache size +# Original patch was found here [1] +# [1]: https://cgit.openembedded.org/meta-openembedded/plain/meta-oe/recipes-benchmark/libhugetlbfs/files/0003-alloc.c-Avoid-sysconf-_SC_LEVEL2_CACHE_LINESIZE-on-l.patch +# Closes: https://bugs.gentoo.org/828830 +--- a/alloc.c ++++ b/alloc.c +@@ -245,6 +245,24 @@ void free_huge_pages(void *ptr) + __free_huge_pages(ptr, 1); + } + ++/* ++ * Avoid sysconf(_SC_LEVEL2_CACHE_LINESIZE) on linux ++ * Taken from the folling patch [1] ++ * ++ * [1]: https://cgit.openembedded.org/meta-openembedded/plain/meta-oe/recipes-benchmark/libhugetlbfs/files/0003-alloc.c-Avoid-sysconf-_SC_LEVEL2_CACHE_LINESIZE-on-l.patch ++ */ ++#if !defined(_SC_LEVEL2_CACHE_LINESIZE) ++static size_t get_cacheline_size() { ++ FILE * fp = fopen("/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size", "r"); ++ unsigned int line_size = 0; ++ if (fp) { ++ fscanf(fp, "%d", &line_size); ++ fclose(fp); ++ } ++ return line_size; ++} ++#endif ++ + /* + * Offset the buffer using bytes wasted due to alignment to avoid using the + * same cache lines for the start of every buffer returned by +@@ -261,7 +279,11 @@ void *cachecolor(void *buf, size_t len, size_t color_bytes) + + /* Lookup our cacheline size once */ + if (cacheline_size == 0) { ++#if defined(_SC_LEVEL2_CACHE_LINESIZE) + cacheline_size = sysconf(_SC_LEVEL2_CACHE_LINESIZE); ++#else ++ cacheline_size = get_cacheline_size(); ++#endif + linemod = time(NULL); + } + diff --git a/sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild b/sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild index 7702cc3283c3..c7a87ce891cd 100644 --- a/sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild +++ b/sys-libs/libhugetlbfs/libhugetlbfs-2.23.ebuild @@ -23,6 +23,10 @@ PATCHES=( "${FILESDIR}"/${PN}-2.6-fixup-testsuite.patch "${FILESDIR}"/${PN}-2.23-uncompressed-man-pages.patch "${FILESDIR}"/${PN}-2.23-allow-building-against-glibc-2.34.patch + "${FILESDIR}"/${PN}-2.23-musl-sc-level2-fix.patch + "${FILESDIR}"/${PN}-2.23-musl-path-max-fix.patch + "${FILESDIR}"/${PN}-2.23-musl-nonnull-fix.patch + "${FILESDIR}"/${PN}-2.23-musl-ino_t-fix.patch ) src_prepare() {