From 2037afbc3289769ce1b02173306b5cdaccfbc255 Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Thu, 21 Mar 2024 19:29:34 +0800 Subject: gperftools: 2.10 -> 2.15 * Remove 0001-Support-Atomic-ops-on-clang.patch because of: commit 54605b8a5807fe893a4b9ff8def982a264cdc6c9 Author: Aliaksey Kandratsenka Date: Wed Jun 21 10:39:18 2023 -0400 amputate old atomic ops implementation * Remove sgidef.patch because of: commit e78238d94d41764dc72edb37e3d6510255d3dcd4 Author: Aliaksey Kandratsenka Date: Wed Jun 21 10:39:38 2023 -0400 reworked heap leak checker for more portability * Remove 0001-Define-off64_t-as-off_t-on-musl.patch because of: commit 8be84e4a5c28c33bfdb7da3ee0c92d9620cd552f Author: Aliaksey Kandratsenka Date: Fri Jul 21 14:18:12 2023 -0400 drop old mmap hooks and introduce internal & simpler mmap_hook.h * Rebased 0001-Support-Atomic-ops-on-clang.patch for 2.15 * Rebased ppc-musl.patch for 2.15 * Add 0001-src-mmap_hook.cc-Fix-build-for-32bit-machine.patch to fix build error for 32bit machine. Signed-off-by: Robert Yang Signed-off-by: Khem Raj --- .../0001-Define-off64_t-as-off_t-on-musl.patch | 33 ----------- .../0001-Support-Atomic-ops-on-clang.patch | 31 ---------- ...heap-checkers-and-debug-allocator-on-musl.patch | 8 ++- ...-mmap_hook.cc-Fix-build-for-32bit-machine.patch | 59 +++++++++++++++++++ .../gperftools/gperftools/ppc-musl.patch | 38 +++--------- .../gperftools/gperftools/sgidef.patch | 23 -------- .../recipes-support/gperftools/gperftools_2.10.bb | 67 ---------------------- .../recipes-support/gperftools/gperftools_2.15.bb | 65 +++++++++++++++++++++ 8 files changed, 137 insertions(+), 187 deletions(-) delete mode 100644 meta-oe/recipes-support/gperftools/gperftools/0001-Define-off64_t-as-off_t-on-musl.patch delete mode 100644 meta-oe/recipes-support/gperftools/gperftools/0001-Support-Atomic-ops-on-clang.patch create mode 100644 meta-oe/recipes-support/gperftools/gperftools/0001-src-mmap_hook.cc-Fix-build-for-32bit-machine.patch delete mode 100644 meta-oe/recipes-support/gperftools/gperftools/sgidef.patch delete mode 100644 meta-oe/recipes-support/gperftools/gperftools_2.10.bb create mode 100644 meta-oe/recipes-support/gperftools/gperftools_2.15.bb (limited to 'meta-oe/recipes-support') diff --git a/meta-oe/recipes-support/gperftools/gperftools/0001-Define-off64_t-as-off_t-on-musl.patch b/meta-oe/recipes-support/gperftools/gperftools/0001-Define-off64_t-as-off_t-on-musl.patch deleted file mode 100644 index 2b782c204..000000000 --- a/meta-oe/recipes-support/gperftools/gperftools/0001-Define-off64_t-as-off_t-on-musl.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 41260e21e271eb1dc8b34f952ea3f90a0dc35e9e Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 25 Dec 2022 20:01:29 -0800 -Subject: [PATCH] Define off64_t as off_t on musl - -Musl's default bitlength for off_t is always 64bit therefore define -off64_t as off_t on musl - -Upstream-Status: Submitted [https://github.com/gperftools/gperftools/pull/1379] -Signed-off-by: Khem Raj ---- - src/malloc_hook_mmap_linux.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h -index c7d8b4b..a10687e 100644 ---- a/src/malloc_hook_mmap_linux.h -+++ b/src/malloc_hook_mmap_linux.h -@@ -45,6 +45,11 @@ - #include - #include - -+// musl's off_t is already 64-bit -+#if defined(__linux__) && !defined(__GLIBC__) -+typedef off_t off64_t; -+#endif -+ - // 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(). --- -2.39.0 - diff --git a/meta-oe/recipes-support/gperftools/gperftools/0001-Support-Atomic-ops-on-clang.patch b/meta-oe/recipes-support/gperftools/gperftools/0001-Support-Atomic-ops-on-clang.patch deleted file mode 100644 index 2fd21c278..000000000 --- a/meta-oe/recipes-support/gperftools/gperftools/0001-Support-Atomic-ops-on-clang.patch +++ /dev/null @@ -1,31 +0,0 @@ -From aa0a63209af6813d87255ec3ab339f2dbbf27d6d Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 6 Mar 2017 13:38:46 -0800 -Subject: [PATCH] Support Atomic ops on clang - -clang pretends to be gcc 4.2 which is a lie -it actually supports a lot more features then -gcc 4.2, here it depends on gcc 4.7 to enable -the atomics and fails for clang - -Signed-off-by: Khem Raj - -Upstream-Status: Pending - ---- - src/base/atomicops.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/base/atomicops.h b/src/base/atomicops.h -index dac95be..390733c 100644 ---- a/src/base/atomicops.h -+++ b/src/base/atomicops.h -@@ -124,7 +124,7 @@ - #include "base/atomicops-internals-linuxppc.h" - #elif defined(__GNUC__) && defined(__mips__) - #include "base/atomicops-internals-mips.h" --#elif defined(__GNUC__) && GCC_VERSION >= 40700 -+#elif defined(__GNUC__) && GCC_VERSION >= 40700 || defined(__clang__) - #include "base/atomicops-internals-gcc.h" - #elif defined(__clang__) && CLANG_VERSION >= 30400 - #include "base/atomicops-internals-gcc.h" diff --git a/meta-oe/recipes-support/gperftools/gperftools/0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch b/meta-oe/recipes-support/gperftools/gperftools/0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch index e3e857f0c..2ea54e48c 100644 --- a/meta-oe/recipes-support/gperftools/gperftools/0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch +++ b/meta-oe/recipes-support/gperftools/gperftools/0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch @@ -11,12 +11,14 @@ 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 - *-cygwin*) default_enable_heap_checker=no; default_enable_cpu_profiler=no;; - *-freebsd*) default_enable_heap_checker=no;; - *-darwin*) default_enable_heap_checker=no;; + 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 diff --git a/meta-oe/recipes-support/gperftools/gperftools/0001-src-mmap_hook.cc-Fix-build-for-32bit-machine.patch b/meta-oe/recipes-support/gperftools/gperftools/0001-src-mmap_hook.cc-Fix-build-for-32bit-machine.patch new file mode 100644 index 000000000..1142df0be --- /dev/null +++ b/meta-oe/recipes-support/gperftools/gperftools/0001-src-mmap_hook.cc-Fix-build-for-32bit-machine.patch @@ -0,0 +1,59 @@ +From d675808d300278a9e7143428cfecf3fda61cc9a2 Mon Sep 17 00:00:00 2001 +From: Robert Yang +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 +--- + 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 + diff --git a/meta-oe/recipes-support/gperftools/gperftools/ppc-musl.patch b/meta-oe/recipes-support/gperftools/gperftools/ppc-musl.patch index 3034e2017..800fa3a84 100644 --- a/meta-oe/recipes-support/gperftools/gperftools/ppc-musl.patch +++ b/meta-oe/recipes-support/gperftools/gperftools/ppc-musl.patch @@ -6,49 +6,27 @@ Subject: [PATCH] Compatibility fixes for musl. --- Upstream-Status: Pending - m4/pc_from_ucontext.m4 | 4 +++- - src/getpc.h | 3 +++ + src/getpc.h | 4 ++++ src/stacktrace_powerpc-linux-inl.h | 8 ++++++-- - 3 files changed, 12 insertions(+), 3 deletions(-) + 2 files changed, 10 insertions(+), 2 deletions(-) -diff --git a/m4/pc_from_ucontext.m4 b/m4/pc_from_ucontext.m4 -index 7f09dd7..5f4ee8c 100644 ---- 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.gregs[[R15]]" # Linux (arm old [untested]) - pc_fields="$pc_fields uc_mcontext.arm_pc" # Linux (arm arch 5) - 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 ], -+ #include -+ #include ], - [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) diff --git a/src/getpc.h b/src/getpc.h -index 9605363..cd8ccfa 100644 +index 87d18b6..c569731 100644 --- a/src/getpc.h +++ b/src/getpc.h -@@ -68,6 +68,9 @@ +@@ -68,6 +68,10 @@ typedef ucontext ucontext_t; #endif +#if defined(__powerpc__) && !defined(PT_NIP) +#define PT_NIP 32 +#endif ++ + namespace tcmalloc { + namespace getpc { - // Take the example where function Foo() calls function Bar(). For - // many architectures, Bar() is responsible for setting up and tearing diff --git a/src/stacktrace_powerpc-linux-inl.h b/src/stacktrace_powerpc-linux-inl.h -index a301a46..efca426 100644 +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 { diff --git a/meta-oe/recipes-support/gperftools/gperftools/sgidef.patch b/meta-oe/recipes-support/gperftools/gperftools/sgidef.patch deleted file mode 100644 index b01cba39c..000000000 --- a/meta-oe/recipes-support/gperftools/gperftools/sgidef.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 259b420444c52463795b4b582a2ab7511149eea7 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 16 Oct 2017 21:26:40 -0700 -Subject: [PATCH] sgidef.h does not exist on musl and its not needed to compile - -Signed-off-by: Khem Raj -Upstream-Status: Pending - ---- - src/base/linux_syscall_support.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/src/base/linux_syscall_support.h -+++ b/src/base/linux_syscall_support.h -@@ -164,7 +164,7 @@ extern "C" { - #include - #include - --#ifdef __mips__ -+#if defined(__mips__) && defined(__glibc__) - /* Include definitions of the ABI currently in use. */ - #include - #endif diff --git a/meta-oe/recipes-support/gperftools/gperftools_2.10.bb b/meta-oe/recipes-support/gperftools/gperftools_2.10.bb deleted file mode 100644 index 8db0cecbf..000000000 --- a/meta-oe/recipes-support/gperftools/gperftools_2.10.bb +++ /dev/null @@ -1,67 +0,0 @@ -SUMMARY = "Fast, multi-threaded malloc() and nifty performance analysis tools" -HOMEPAGE = "https://github.com/gperftools/gperftools" -DESCRIPTION = "The gperftools, previously called google-perftools, package contains some \ -utilities to improve and analyze the performance of C++ programs. \ -Included are an optimized thread-caching malloc() and cpu and heap profiling utilities. \ -" - -LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://COPYING;md5=762732742c73dc6c7fbe8632f06c059a" - -DEPENDS:append:libc-musl = " libucontext" - -SRCREV = "bf8b714bf5075d0a6f2f28504b43095e2b1e11c5" -SRC_URI = "git://github.com/gperftools/gperftools;branch=master;protocol=https \ - file://0001-Support-Atomic-ops-on-clang.patch \ - file://0001-disbale-heap-checkers-and-debug-allocator-on-musl.patch \ - file://disable_libunwind_aarch64.patch \ - file://sgidef.patch \ - file://0001-Define-off64_t-as-off_t-on-musl.patch \ - " - -SRC_URI:append:libc-musl = " file://ppc-musl.patch" - -inherit autotools - -S = "${WORKDIR}/git" - -# On mips, we have the following error. -# do_page_fault(): sending SIGSEGV to ls for invalid read access from 00000008 -# Segmentation fault (core dumped) -COMPATIBLE_HOST:mipsarch = "null" -COMPATIBLE_HOST:riscv64 = "null" -COMPATIBLE_HOST:riscv32 = "null" - -# Disable thumb1 -# {standard input}: Assembler messages: -# {standard input}:434: Error: lo register required -- `ldr pc,[sp]' -# Makefile:4538: recipe for target 'src/base/libtcmalloc_la-linuxthreads.lo' failed -ARM_INSTRUCTION_SET:armv5 = "arm" -ARM_INSTRUCTION_SET:toolchain-clang:arm = "arm" - -EXTRA_OECONF:append:libc-musl:powerpc64le = " --disable-cpu-profiler" -EXTRA_OECONF:append:libc-musl:powerpc = " --disable-cpu-profiler" -PACKAGECONFIG ?= "libunwind static" -PACKAGECONFIG:remove:arm:libc-musl = "libunwind" -PACKAGECONFIG:remove:riscv64 = "libunwind" -PACKAGECONFIG:remove:riscv32 = "libunwind" - -PACKAGECONFIG[libunwind] = "--enable-libunwind,--disable-libunwind,libunwind" -PACKAGECONFIG[static] = "--enable-static,--disable-static," - -PACKAGE_BEFORE_PN += "libtcmalloc-minimal" -FILES:libtcmalloc-minimal = "${libdir}/libtcmalloc_minimal*${SOLIBS} ${libdir}/libtcmalloc_minimal_debug*${SOLIBS}" - -# pprof tool requires Getopt::long and POSIX perl5 modules. -# Also runs `objdump` on each cpuprofile data file -RDEPENDS:${PN} += " \ - binutils \ - curl \ - perl-module-carp \ - perl-module-cwd \ - perl-module-getopt-long \ - perl-module-overloading \ - perl-module-posix \ -" - -RDEPENDS:${PN} += "libtcmalloc-minimal (= ${EXTENDPKGV})" diff --git a/meta-oe/recipes-support/gperftools/gperftools_2.15.bb b/meta-oe/recipes-support/gperftools/gperftools_2.15.bb new file mode 100644 index 000000000..bd3b2afae --- /dev/null +++ b/meta-oe/recipes-support/gperftools/gperftools_2.15.bb @@ -0,0 +1,65 @@ +SUMMARY = "Fast, multi-threaded malloc() and nifty performance analysis tools" +HOMEPAGE = "https://github.com/gperftools/gperftools" +DESCRIPTION = "The gperftools, previously called google-perftools, package contains some \ +utilities to improve and analyze the performance of C++ programs. \ +Included are an optimized thread-caching malloc() and cpu and heap profiling utilities. \ +" + +LICENSE = "BSD-3-Clause" +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 \ + " + +SRC_URI:append:libc-musl = " file://ppc-musl.patch" + +inherit autotools + +S = "${WORKDIR}/git" + +# On mips, we have the following error. +# do_page_fault(): sending SIGSEGV to ls for invalid read access from 00000008 +# Segmentation fault (core dumped) +COMPATIBLE_HOST:mipsarch = "null" +COMPATIBLE_HOST:riscv64 = "null" +COMPATIBLE_HOST:riscv32 = "null" + +# Disable thumb1 +# {standard input}: Assembler messages: +# {standard input}:434: Error: lo register required -- `ldr pc,[sp]' +# Makefile:4538: recipe for target 'src/base/libtcmalloc_la-linuxthreads.lo' failed +ARM_INSTRUCTION_SET:armv5 = "arm" +ARM_INSTRUCTION_SET:toolchain-clang:arm = "arm" + +EXTRA_OECONF:append:libc-musl:powerpc64le = " --disable-cpu-profiler" +EXTRA_OECONF:append:libc-musl:powerpc = " --disable-cpu-profiler" +PACKAGECONFIG ?= "libunwind static" +PACKAGECONFIG:remove:arm:libc-musl = "libunwind" +PACKAGECONFIG:remove:riscv64 = "libunwind" +PACKAGECONFIG:remove:riscv32 = "libunwind" + +PACKAGECONFIG[libunwind] = "--enable-libunwind,--disable-libunwind,libunwind" +PACKAGECONFIG[static] = "--enable-static,--disable-static," + +PACKAGE_BEFORE_PN += "libtcmalloc-minimal" +FILES:libtcmalloc-minimal = "${libdir}/libtcmalloc_minimal*${SOLIBS} ${libdir}/libtcmalloc_minimal_debug*${SOLIBS}" + +# pprof tool requires Getopt::long and POSIX perl5 modules. +# Also runs `objdump` on each cpuprofile data file +RDEPENDS:${PN} += " \ + binutils \ + curl \ + perl-module-carp \ + perl-module-cwd \ + perl-module-getopt-long \ + perl-module-overloading \ + perl-module-posix \ +" + +RDEPENDS:${PN} += "libtcmalloc-minimal (= ${EXTENDPKGV})" -- cgit v1.2.3-54-g00ecf