diff options
Diffstat (limited to 'meta-oe/recipes-support/gperftools')
9 files changed, 192 insertions, 153 deletions
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 2fd21c2783..0000000000 --- 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 <raj.khem@gmail.com> -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 <raj.khem@gmail.com> - -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 ab3ceb964f..2ea54e48c9 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 @@ -12,15 +12,15 @@ Upstream-Status: Pending 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac -index 70b49a3..8154c5c 100644 +index 68fd51c..4cb71fe 100644 --- a/configure.ac +++ b/configure.ac -@@ -51,6 +51,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;; +@@ -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. + # Currently only backtrace works on s390 and OSX. diff --git a/meta-oe/recipes-support/gperftools/gperftools/0001-fix-build-with-musl-libc.patch b/meta-oe/recipes-support/gperftools/gperftools/0001-fix-build-with-musl-libc.patch deleted file mode 100644 index 49d5c21676..0000000000 --- a/meta-oe/recipes-support/gperftools/gperftools/0001-fix-build-with-musl-libc.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 696674a800cb6d2070897a565b92d7e63022a8f1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sun, 16 Jul 2017 15:51:28 -0700 -Subject: [PATCH] fix build with musl libc - -Patch from https://github.com/gperftools/gperftools/pull/765/ - -Signed-off-by: Khem Raj <raj.khem@gmail.com> - ---- - configure.ac | 1 + - src/malloc_hook_mmap_linux.h | 8 ++++++-- - 2 files changed, 7 insertions(+), 2 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 497103e..f9efc3e 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -188,6 +188,7 @@ AC_HEADER_STDC - AC_CHECK_TYPES([__int64]) # defined in some windows platforms - AC_CHECK_TYPES([struct mallinfo],,, [#include <malloc.h>]) - AC_CHECK_TYPES([Elf32_Versym],,, [#include <elf.h>]) # for vdso_support.h -+AC_CHECK_FUNCS(__sbrk) # for intercepting glibc memory allocator - AC_CHECK_FUNCS(sbrk) # for tcmalloc to get memory - AC_CHECK_FUNCS(geteuid) # for turning off services when run as root - AC_CHECK_FUNCS(fork) # for the pthread_atfork setup -diff --git a/src/malloc_hook_mmap_linux.h b/src/malloc_hook_mmap_linux.h -index 2f6116f..0605855 100755 ---- 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" - -+#ifndef __GLIBC__ -+typedef off64_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(). -@@ -168,7 +172,7 @@ extern "C" void* mmap64(void *start, size_t length, int prot, int flags, - return result; - } - --# if !defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH) -+# if defined(__GLIBC__) && (!defined(__USE_FILE_OFFSET64) || !defined(__REDIRECT_NTH)) - - extern "C" void* mmap(void *start, size_t length, int prot, int flags, - int fd, off_t offset) __THROW { -@@ -206,7 +210,7 @@ extern "C" void* mremap(void* old_addr, size_t old_size, size_t new_size, - return result; - } - --#ifndef __UCLIBC__ -+#if HAVE___SBRK - // libc's version: - extern "C" void* __sbrk(intptr_t increment); - 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 0000000000..1142df0be9 --- /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 <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 + diff --git a/meta-oe/recipes-support/gperftools/gperftools/disable_libunwind_aarch64.patch b/meta-oe/recipes-support/gperftools/gperftools/disable_libunwind_aarch64.patch index c3c5784186..15eacc8993 100644 --- a/meta-oe/recipes-support/gperftools/gperftools/disable_libunwind_aarch64.patch +++ b/meta-oe/recipes-support/gperftools/gperftools/disable_libunwind_aarch64.patch @@ -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]) diff --git a/meta-oe/recipes-support/gperftools/gperftools/ppc-musl.patch b/meta-oe/recipes-support/gperftools/gperftools/ppc-musl.patch new file mode 100644 index 0000000000..800fa3a84f --- /dev/null +++ b/meta-oe/recipes-support/gperftools/gperftools/ppc-musl.patch @@ -0,0 +1,61 @@ +From 328805fd16930deefda400a77e9c2c5d17d04d29 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. + +--- +Upstream-Status: Pending + + 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 +--- a/src/getpc.h ++++ b/src/getpc.h +@@ -68,6 +68,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 + 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 10274a6dec..0000000000 --- a/meta-oe/recipes-support/gperftools/gperftools/sgidef.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 259b420444c52463795b4b582a2ab7511149eea7 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -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 <raj.khem@gmail.com> -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" { - #include <endian.h> - #include <fcntl.h> - --#ifdef __mips__ -+#if defined(__mips__) && defined(__glibc__) - /* Include definitions of the ABI currently in use. */ - #include <sgidefs.h> - #endif 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 0000000000..bd3b2afaea --- /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})" diff --git a/meta-oe/recipes-support/gperftools/gperftools_2.7.bb b/meta-oe/recipes-support/gperftools/gperftools_2.7.bb deleted file mode 100644 index e9fcc4cc98..0000000000 --- a/meta-oe/recipes-support/gperftools/gperftools_2.7.bb +++ /dev/null @@ -1,29 +0,0 @@ -SUMMARY = "Fast, multi-threaded malloc() and nifty performance analysis tools" -HOMEPAGE = "https://github.com/gperftools/gperftools" -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://COPYING;md5=762732742c73dc6c7fbe8632f06c059a" -DEPENDS += "libunwind" - -SRCREV = "9608fa3bcf8020d35f59fbf70cd3cbe4b015b972" -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 \ - " - -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_libc-glibc = "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" - |