gperftools: Update SRCREV to point to 2.9.1 release

Refresh patches
Drop upstreamed patch 0001-profile-handler-Specify-libc-specific-thread_id.patch
Fix build on musl/ppc
Disable heap and cpu profilers on ppc64le/musl since it does not build
stacktrace utility yet

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2021-03-13 00:42:25 -08:00
parent 0587a7c65a
commit 70af4c73c7
7 changed files with 79 additions and 59 deletions

View File

@ -11,11 +11,9 @@ Upstream-Status: Pending
configure.ac | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configure.ac b/configure.ac
index 70b49a3..8154c5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,8 @@ case "$host" in
@@ -53,6 +53,8 @@ case "$host" in
*-cygwin*) default_enable_heap_checker=no; default_enable_cpu_profiler=no;;
*-freebsd*) default_enable_heap_checker=no;;
*-darwin*) default_enable_heap_checker=no;;
@ -23,4 +21,4 @@ index 70b49a3..8154c5c 100644
+ default_enable_debugalloc=no; default_enable_libunwind=no;
esac
# Currently only backtrace works on s390.
# Currently only backtrace works on s390 and OSX.

View File

@ -10,13 +10,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
src/malloc_hook_mmap_linux.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h
index e2efb05..66b3110 100644
--- a/src/malloc_hook_mmap_linux.h
+++ b/src/malloc_hook_mmap_linux.h
@@ -46,6 +46,10 @@
#include <errno.h>
#include "base/linux_syscall_support.h"
@@ -45,6 +45,10 @@
#include <sys/syscall.h>
#include <unistd.h>
+#ifndef __GLIBC__
+typedef off64_t __off64_t;
@ -25,7 +23,7 @@ index e2efb05..66b3110 100644
// The x86-32 case and the x86-64 case differ:
// 32b has a mmap2() syscall, 64b does not.
// 64b and 32b have different calling conventions for mmap().
@@ -175,7 +179,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags,
@@ -175,7 +179,7 @@ extern "C" void* mmap64(void *start, siz
return result;
}
@ -34,6 +32,3 @@ index e2efb05..66b3110 100644
extern "C" void* mmap(void *start, size_t length, int prot, int flags,
int fd, off_t offset) __THROW {
--
2.17.1

View File

@ -1,38 +0,0 @@
From 0a504852ed6e56620d1df26b503c4aa2b5b74760 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 31 Oct 2020 16:12:36 -0700
Subject: [PATCH] profile-handler: Specify libc specific thread_id
We need to know internal _sigev_un is glibc specific, add an else for
musl case
Fixes build issue
../git/src/profile-handler.cc:275:8: error: no member named '_sigev_un' in 'sigevent'
sevp._sigev_un._tid = sys_gettid();
~~~~ ^
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/profile-handler.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/profile-handler.cc b/src/profile-handler.cc
index 7fdcb69..5867118 100644
--- a/src/profile-handler.cc
+++ b/src/profile-handler.cc
@@ -272,7 +272,11 @@ static void StartLinuxThreadTimer(int timer_type, int signal_number,
struct itimerspec its;
memset(&sevp, 0, sizeof(sevp));
sevp.sigev_notify = SIGEV_THREAD_ID;
+#ifdef __GLIBC__
sevp._sigev_un._tid = sys_gettid();
+#else
+ sevp.sigev_notify_thread_id = sys_gettid();
+#endif
sevp.sigev_signo = signal_number;
clockid_t clock = CLOCK_THREAD_CPUTIME_ID;
if (timer_type == ITIMER_REAL) {
--
2.29.2

View File

@ -12,11 +12,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
configure.ac | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/configure.ac b/configure.ac
index 8154c5c..063b260 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,11 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __PPC64__])],
@@ -76,6 +76,11 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [re
[default_enable_libunwind=yes
default_tcmalloc_pagesize=8])

View File

@ -0,0 +1,66 @@
Compatibility fixes for musl.
--- a/m4/pc_from_ucontext.m4
+++ b/m4/pc_from_ucontext.m4
@@ -34,6 +34,7 @@ AC_DEFUN([AC_PC_FROM_UCONTEXT],
pc_fields="$pc_fields uc_mcontext.arm_pc" # Linux (arm arch 5)
pc_fields="$pc_fields uc_mcontext.cr0_hi" # Linux (e2k)
pc_fields="$pc_fields uc_mcontext.gp_regs[[PT_NIP]]" # Suse SLES 11 (ppc64)
+ pc_fields="$pc_fields uc_mcontext.gregs[[PT_NIP]]"
pc_fields="$pc_fields uc_mcontext.mc_eip" # FreeBSD (i386)
pc_fields="$pc_fields uc_mcontext.mc_srr0" # FreeBSD (powerpc, powerpc64)
pc_fields="$pc_fields uc_mcontext.mc_rip" # FreeBSD (x86_64 [untested])
@@ -77,7 +78,8 @@ AC_DEFUN([AC_PC_FROM_UCONTEXT],
pc_field_found=true)
elif test "x$ac_cv_header_ucontext_h" = xyes; then
AC_TRY_COMPILE([#define _GNU_SOURCE 1
- #include <ucontext.h>],
+ #include <ucontext.h>
+ #include <asm/ptrace.h>],
[ucontext_t u; return u.$pc_field == 0;],
AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field,
How to access the PC from a struct ucontext)
--- a/src/getpc.h
+++ b/src/getpc.h
@@ -68,6 +68,9 @@
typedef ucontext ucontext_t;
#endif
+#if defined(__powerpc__) && !defined(PT_NIP)
+#define PT_NIP 32
+#endif
// Take the example where function Foo() calls function Bar(). For
// many architectures, Bar() is responsible for setting up and tearing
--- 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

View File

@ -10,8 +10,6 @@ Upstream-Status: Pending
src/base/linux_syscall_support.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/base/linux_syscall_support.h b/src/base/linux_syscall_support.h
index 70431ca..b23ca59 100644
--- a/src/base/linux_syscall_support.h
+++ b/src/base/linux_syscall_support.h
@@ -164,7 +164,7 @@ extern "C" {

View File

@ -8,16 +8,19 @@ Included are an optimized thread-caching malloc() and cpu and heap profiling uti
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=762732742c73dc6c7fbe8632f06c059a"
SRCREV = "d8eb315fb18f6fb0d6efa923401f166343727bc6"
DEPENDS_append_libc-musl = " libucontext"
SRCREV = "f7c6fb6c8e99d6b1b725e5994373bcd19ffdf8fd"
SRC_URI = "git://github.com/gperftools/gperftools \
file://0001-Support-Atomic-ops-on-clang.patch \
file://0001-fix-build-with-musl-libc.patch \
file://0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch \
file://disable_libunwind_aarch64.patch \
file://sgidef.patch \
file://0001-profile-handler-Specify-libc-specific-thread_id.patch \
"
SRC_URI_append_libc-musl = " file://ppc-musl.patch"
inherit autotools
S = "${WORKDIR}/git"
@ -36,6 +39,7 @@ COMPATIBLE_HOST_riscv32 = "null"
ARM_INSTRUCTION_SET_armv5 = "arm"
ARM_INSTRUCTION_SET_toolchain-clang_arm = "arm"
EXTRA_OECONF_append_libc-musl_powerpc64le = " --disable-cpu-profiler --disable-heap-profiler --disable-heap-checker"
PACKAGECONFIG ?= "libunwind static"
PACKAGECONFIG_remove_arm_libc-musl = "libunwind"
PACKAGECONFIG_remove_riscv64 = "libunwind"
@ -60,4 +64,3 @@ RDEPENDS_${PN} += " \
"
RDEPENDS_${PN} += "libtcmalloc-minimal (= ${EXTENDPKGV})"