From a87a1eec3f51d12790b03bc68c3d5690200ea0a3 Mon Sep 17 00:00:00 2001 From: Sam James Date: Mon, 23 Jan 2023 01:09:44 +0000 Subject: 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 --- .../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(-) create mode 100644 dev-util/valgrind/files/valgrind-3.20.0-musl-interpose.patch (limited to 'dev-util/valgrind') 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 +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 -- cgit v1.2.3-65-gdbad