gperftools: Drop obsolete musl patches

ppc-musl.patch no longer applies after the 2.19.3 upgrade, failing
do_patch on musl. Upstream fixed PT_NIP handling for non-glibc in
122d6e7885 and 17ff2e676b, and elf_mem_image.cc no longer uses
__WORDSIZE, so drop it and the elf_mem_image patch.

Replace the Makefile.am patch that stopped building the test programs
with the --disable-tests configure option added upstream.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-11-12 20:54:59 -08:00
1 parent 5b6e144ad3
commit 6a0b61aa0e
4 files changed
+2 -138

No files matched your search

@@ -1,35 +0,0 @@
From 02ff9fcc74ba64aeb22fcc553f30657bd2b62930 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Wed, 26 Feb 2025 23:46:56 -0800
Subject: [PATCH 2/3] src/base/elf_mem_image.cc: fix build for musl
Include header file for musl to avoid error below:
error: '__WORDSIZE' was not declared in this scope
Upstream-Status: Pending
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
src/base/elf_mem_image.cc | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/base/elf_mem_image.cc b/src/base/elf_mem_image.cc
index d2ca1a5..89dc0e4 100644
--- a/src/base/elf_mem_image.cc
+++ b/src/base/elf_mem_image.cc
@@ -38,6 +38,11 @@
#ifdef HAVE_ELF_MEM_IMAGE // defined in elf_mem_image.h
+// for musl __WORDSIZE definition
+#if !defined(__GLIBC__)
+#include <sys/reg.h>
+#endif
+
#include <stddef.h> // for size_t, ptrdiff_t
#include "base/logging.h"
--
2.25.1
@@ -1,32 +0,0 @@
From 3bb5707c6a6a0d2061c79c556cbe4a87efea02ab Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Thu, 27 Feb 2025 00:44:34 -0800
Subject: [PATCH 3/3] Makefile.am: disable building noinst tests for musl
Build fails for musl + qemuppc64 about ld failing to find
symbols in libucontext. Until a real solution is found,
we need this workaround.
Upstream-Status: Inappropriate [OE Specific]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 9fa24c0..7dd1b60 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -938,7 +938,7 @@ endif WITH_HEAP_PROFILER_OR_CHECKER
# This should always include $(TESTS), but may also include other
# binaries that you compile but don't want automatically installed.
# We'll add to this later, on a library-by-library basis
-noinst_PROGRAMS += $(TESTS)
+#noinst_PROGRAMS += $(TESTS)
# http://linux.die.net/man/1/pkg-config, http://pkg-config.freedesktop.org/wiki
pkgconfigdir = $(libdir)/pkgconfig
--
2.25.1
@@ -1,65 +0,0 @@
From 1526be49b8c49719459ef15c93090fdbdc10f3cb Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 13 Mar 2021 00:42:25 -0800
Subject: [PATCH 1/3] Compatibility fixes for musl.
Upstream-Status: Pending
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
src/getpc.h | 4 ++++
src/stacktrace_powerpc-linux-inl.h | 8 ++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/getpc.h b/src/getpc.h
index c14c9d0..cf4866b 100644
--- a/src/getpc.h
+++ b/src/getpc.h
@@ -61,6 +61,10 @@
typedef ucontext ucontext_t;
#endif
+#if defined(__powerpc__) && !defined(PT_NIP)
+#define PT_NIP 32
+#endif
+
namespace tcmalloc {
namespace getpc {
diff --git a/src/stacktrace_powerpc-linux-inl.h b/src/stacktrace_powerpc-linux-inl.h
index 883e7d2..212bd25 100644
--- a/src/stacktrace_powerpc-linux-inl.h
+++ b/src/stacktrace_powerpc-linux-inl.h
@@ -186,7 +186,7 @@ static int GET_STACK_TRACE_OR_FRAMES {
ucontext_t uc;
// We don't care about the rest, since the IP value is at 'uc' field.
} *sigframe = reinterpret_cast<signal_frame_64*>(current);
- result[n] = (void*) sigframe->uc.uc_mcontext.gp_regs[PT_NIP];
+ result[n] = (void*) sigframe->uc.uc_mcontext.gp_regs[32];
}
#else
if (sigtramp32_vdso && (sigtramp32_vdso == current->return_addr)) {
@@ -196,7 +196,7 @@ static int GET_STACK_TRACE_OR_FRAMES {
mcontext_t mctx;
// We don't care about the rest, since IP value is at 'mctx' field.
} *sigframe = reinterpret_cast<signal_frame_32*>(current);
- result[n] = (void*) sigframe->mctx.gregs[PT_NIP];
+ result[n] = (void*) sigframe->mctx.gregs[32];
} else if (sigtramp32_rt_vdso && (sigtramp32_rt_vdso == current->return_addr)) {
struct rt_signal_frame_32 {
char dummy[64 + 16];
@@ -204,7 +204,11 @@ static int GET_STACK_TRACE_OR_FRAMES {
ucontext_t uc;
// We don't care about the rest, since IP value is at 'uc' field.A
} *sigframe = reinterpret_cast<rt_signal_frame_32*>(current);
+#if defined(__GLIBC__)
result[n] = (void*) sigframe->uc.uc_mcontext.uc_regs->gregs[PT_NIP];
+#else
+ result[n] = (void*) sigframe->uc.uc_mcontext.gregs[32];
+#endif
}
#endif
--
2.25.1
@@ -13,12 +13,6 @@ DEPENDS:append:libc-musl = " libucontext"
SRCREV = "d837a42788ba591d5d791c3b686f2738e7a93562"
SRC_URI = "git://github.com/gperftools/gperftools;branch=master;protocol=https;tag=gperftools-${PV}"
SRC_URI:append:libc-musl = " \
file://ppc-musl.patch \
file://0002-src-base-elf_mem_image.cc-fix-build-for-musl.patch \
file://0003-Makefile.am-disable-building-noinst-tests-for-musl.patch \
"
inherit autotools
@@ -36,6 +30,8 @@ COMPATIBLE_HOST:riscv32 = "null"
ARM_INSTRUCTION_SET:armv5 = "arm"
ARM_INSTRUCTION_SET:toolchain-clang:arm = "arm"
# Test programs fail to link against libucontext on musl + ppc64
EXTRA_OECONF:append:libc-musl = " --disable-tests"
EXTRA_OECONF:append:libc-musl:powerpc64le = " --disable-cpu-profiler"
EXTRA_OECONF:append:libc-musl:powerpc = " --disable-cpu-profiler"
PACKAGECONFIG ?= "libunwind static"