gperftools: upgrade from 2.15 to 2.16

disable_libunwind_aarch64.patch is dropped because from my runtime
testing, this patch is no longer needed.

0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch is
dropped because I don't see it necessary now. Things still build
without it.

0001-src-mmap_hook.cc-Fix-build-for-32bit-machine.patch is dropped
because this oe specific patch is no longer needed because of the
following two commits:
02adc8c also disable _TIME_BITS in mmap_hook.cc
198b3dd disable _FILE_OFFSET_BITS in mmap_hook.cc

ppc-musl.patch is rebased.

0002-src-base-elf_mem_image.cc-fix-build-for-musl.patch is added
to fix build failure for musl + ppc64.

0003-Makefile.am-disable-building-noinst-tests-for-musl.patch is
added as a workaround to fix build failure on musl + ppc64.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Chen Qi 2025-02-27 20:19:45 -08:00 committed by Khem Raj
parent 59f822ceb7
commit 59dacb6d4d
No known key found for this signature in database
GPG Key ID: BB053355919D3314
7 changed files with 83 additions and 125 deletions

View File

@ -1,26 +0,0 @@
From 06605158852f9364519391fa11070ba5ec4303e9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 2 Sep 2017 08:07:17 -0700
Subject: [PATCH] disbale heap checkers and debug allocator on musl
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Pending
---
configure.ac | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configure.ac b/configure.ac
index 68fd51c..4cb71fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,8 @@ case "$host" in
need_nanosleep=no;;
*-cygwin*) default_enable_cpu_profiler=no;;
*-linux*) default_enable_heap_checker=yes; heap_checker_supported=yes;;
+ *-musl*) default_enable_heap_checker=no; default_enable_heap_profiler=no;
+ default_enable_debugalloc=no; default_enable_libunwind=no;
esac
# Currently only backtrace works on s390 and OSX.

View File

@ -1,59 +0,0 @@
From d675808d300278a9e7143428cfecf3fda61cc9a2 Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Thu, 21 Mar 2024 10:59:29 +0000
Subject: [PATCH] src/mmap_hook.cc: Fix build for 32bit machine
Fixed build error on 32bit machine:
../git/src/mmap_hook.cc:309:31: error: static assertion failed
309 | static_assert(sizeof(int32_t) == sizeof(off_t), "");
This is because oe's off_t is 64bit on both 32 and 64bit system, which is the
default value of glibc, so the assertion would be failed on 32bit system, and
remove mmap() and mmap64() to fix the redefined error.
Upstream-Status: Inappropriate [OE-Specific]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
src/mmap_hook.cc | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/src/mmap_hook.cc b/src/mmap_hook.cc
index 0a0f62f..27425e4 100644
--- a/src/mmap_hook.cc
+++ b/src/mmap_hook.cc
@@ -302,30 +302,8 @@ void* mmap(void* start, size_t length, int prot, int flags, int fd, off_t off) _
#define HOOKED_MMAP
-#elif defined(DEFINED_DO_MMAP) && defined(__linux__) && !GOOD_LINUX_SYSTEM
-// Linuxes with 32-bit off_t. We're being careful with mmap64 being
-// 64-bit and mmap being 32-bit.
-
-static_assert(sizeof(int32_t) == sizeof(off_t), "");
-
-extern "C" void* mmap64(void* start, size_t length, int prot, int flags, int fd, int64_t off)
- __THROW ATTRIBUTE_SECTION(malloc_hook);
-extern "C" void* mmap(void* start, size_t length, int prot, int flags, int fd, off_t off)
- __THROW ATTRIBUTE_SECTION(malloc_hook);
-
-void* mmap(void *start, size_t length, int prot, int flags, int fd, off_t off) __THROW {
- return do_mmap_with_hooks(start, length, prot, flags, fd, off);
-}
-
-void* mmap64(void *start, size_t length, int prot, int flags, int fd, int64_t off) __THROW {
- return do_mmap_with_hooks(start, length, prot, flags, fd, off);
-}
-
-#define HOOKED_MMAP
-
#endif // Linux/32-bit off_t case
-
#ifdef HOOKED_MMAP
extern "C" int munmap(void* start, size_t length) __THROW ATTRIBUTE_SECTION(malloc_hook);
--
2.35.5

View File

@ -0,0 +1,35 @@
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

View File

@ -0,0 +1,32 @@
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

View File

@ -1,28 +0,0 @@
From 564f800e3e24647c095f7a321bf3ebdccfbf762d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 2 Sep 2017 12:02:04 -0700
Subject: [PATCH] Disable libunwind on aarch64
Fixes hangs when using libtcmalloc.so
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 5 +++++
1 file changed, 5 insertions(+)
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,11 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [re
[default_enable_libunwind=yes
default_tcmalloc_pagesize=8])
+# Disable libunwind linking on aarch64 by default.
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __aarch64__])],
+ [default_enable_libunwind=no],
+ [default_enable_libunwind=yes])
+
AC_ARG_ENABLE([cpu-profiler],
[AS_HELP_STRING([--disable-cpu-profiler],
[do not build the cpu profiler])],

View File

@ -1,20 +1,21 @@
From 328805fd16930deefda400a77e9c2c5d17d04d29 Mon Sep 17 00:00:00 2001
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] Compatibility fixes for musl.
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 87d18b6..c569731 100644
index c14c9d0..cf4866b 100644
--- a/src/getpc.h
+++ b/src/getpc.h
@@ -68,6 +68,10 @@
@@ -61,6 +61,10 @@
typedef ucontext ucontext_t;
#endif
@ -59,3 +60,6 @@ index 883e7d2..212bd25 100644
}
#endif
--
2.25.1

View File

@ -10,14 +10,14 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=762732742c73dc6c7fbe8632f06c059a"
DEPENDS:append:libc-musl = " libucontext"
SRCREV = "365060c4213a48adb27f63d5dfad41b3dfbdd62e"
SRC_URI = "git://github.com/gperftools/gperftools;branch=master;protocol=https \
file://0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch \
file://disable_libunwind_aarch64.patch \
file://0001-src-mmap_hook.cc-Fix-build-for-32bit-machine.patch \
"
SRCREV = "e1014dead2029b341d06027b4f2b5562d799d5b1"
SRC_URI = "git://github.com/gperftools/gperftools;branch=master;protocol=https"
SRC_URI:append:libc-musl = " file://ppc-musl.patch"
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