commit:     a87a1eec3f51d12790b03bc68c3d5690200ea0a3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 23 01:09:44 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 23 01:09:46 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a87a1eec

dev-util/valgrind: add another musl patch

Without this, I got nonsensical results on musl on e.g. 'valgrind emerge'
within python-exec, as it couldn't handle fclose() properly.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/valgrind-3.20.0-musl-interpose.patch     | 30 ++++++++++++++++++++++
 dev-util/valgrind/valgrind-3.20.0-r1.ebuild        |  5 +++-
 dev-util/valgrind/valgrind-9999.ebuild             |  5 +++-
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/dev-util/valgrind/files/valgrind-3.20.0-musl-interpose.patch 
b/dev-util/valgrind/files/valgrind-3.20.0-musl-interpose.patch
new file mode 100644
index 000000000000..6ede22f8b5ec
--- /dev/null
+++ b/dev-util/valgrind/files/valgrind-3.20.0-musl-interpose.patch
@@ -0,0 +1,30 @@
+https://bugs.kde.org/show_bug.cgi?id=435441
+
+From 460d0c9a6c27edfffed8ced623cecf64466619f2 Mon Sep 17 00:00:00 2001
+From: Michael Forney <[email protected]>
+Date: Thu, 4 Nov 2021 14:26:40 -0700
+Subject: [PATCH] Bug 435441 - Handle weak symbols as global for redirection
+
+Weak symbols are global but with lower precedence, so they should
+be handled the same way as global symbols during malloc replacement.
+
+This fixes valgrind on musl 1.2.2 when it is not patched with a
+soname (as is done on Alpine Linux).
+
+https://bugs.kde.org/show_bug.cgi?id=435441
+--- a/coregrind/m_debuginfo/readelf.c
++++ b/coregrind/m_debuginfo/readelf.c
+@@ -429,7 +429,8 @@ Bool get_elf_symbol_info (
+    }
+ #  endif
+ 
+-   if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL) {
++   if (ELFXX_ST_BIND(sym->st_info) == STB_GLOBAL
++       || ELFXX_ST_BIND(sym->st_info) == STB_WEAK) {
+       *is_global_out = True;
+    }
+ 
+-- 
+2.32.0
+
+

diff --git a/dev-util/valgrind/valgrind-3.20.0-r1.ebuild 
b/dev-util/valgrind/valgrind-3.20.0-r1.ebuild
index 0be352c52d9b..0268876b1061 100644
--- a/dev-util/valgrind/valgrind-3.20.0-r1.ebuild
+++ b/dev-util/valgrind/valgrind-3.20.0-r1.ebuild
@@ -37,7 +37,10 @@ src_prepare() {
        sed -i -e 's:-arch \(i386\|x86_64\)::g' Makefile.all.am || die
 
        if use elibc_musl ; then
-               PATCHES+=( "${FILESDIR}"/valgrind-3.13.0-malloc.patch )
+               PATCHES+=(
+                       "${FILESDIR}"/${PN}-3.13.0-malloc.patch
+                       "${FILESDIR}"/${PN}-3.20.0-musl-interpose.patch
+               )
        fi
 
        if [[ ${CHOST} == *-solaris* ]] ; then

diff --git a/dev-util/valgrind/valgrind-9999.ebuild 
b/dev-util/valgrind/valgrind-9999.ebuild
index 82cd1992cc4f..b690f11f1222 100644
--- a/dev-util/valgrind/valgrind-9999.ebuild
+++ b/dev-util/valgrind/valgrind-9999.ebuild
@@ -36,7 +36,10 @@ src_prepare() {
        sed -i -e 's:-arch \(i386\|x86_64\)::g' Makefile.all.am || die
 
        if use elibc_musl ; then
-               PATCHES+=( "${FILESDIR}"/valgrind-3.13.0-malloc.patch )
+               PATCHES+=(
+                       "${FILESDIR}"/${PN}-3.13.0-malloc.patch
+                       "${FILESDIR}"/${PN}-3.20.0-musl-interpose.patch
+               )
        fi
 
        if [[ ${CHOST} == *-solaris* ]] ; then

Reply via email to