diff options
| author | Khem Raj <raj.khem@gmail.com> | 2020-11-23 15:40:35 -0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2020-11-23 15:43:06 -0800 |
| commit | 3e6f82dd54b296072d725f5691204618d60a2666 (patch) | |
| tree | a1151e330ca116c459a251098d203407a9acf2cf | |
| parent | 0948ba8e496c3ad2e16e4906574fc120db813182 (diff) | |
| download | meta-openembedded-3e6f82dd54b296072d725f5691204618d60a2666.tar.gz | |
heaptrack: Fix build on musl
Improve upon summary and description fields
Add PV to the recipe
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Sinan Kaya <okaya@kernel.org>
6 files changed, 251 insertions, 18 deletions
diff --git a/meta-oe/recipes-devtools/heaptrack/heaptrack/0001-libheaptrack-Replace-__pid_t-with-pid_t.patch b/meta-oe/recipes-devtools/heaptrack/heaptrack/0001-libheaptrack-Replace-__pid_t-with-pid_t.patch new file mode 100644 index 0000000000..9681086a52 --- /dev/null +++ b/meta-oe/recipes-devtools/heaptrack/heaptrack/0001-libheaptrack-Replace-__pid_t-with-pid_t.patch | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | From 18671cd6028f996c138c6eb4282caf313f3fc605 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 23 Nov 2020 15:25:18 -0800 | ||
| 4 | Subject: [PATCH] libheaptrack: Replace __pid_t with pid_t | ||
| 5 | |||
| 6 | __pid_t is for internal libc use | ||
| 7 | |||
| 8 | Upstream-Status: Pending | ||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | ||
| 11 | src/track/libheaptrack.cpp | 2 +- | ||
| 12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 13 | |||
| 14 | diff --git a/src/track/libheaptrack.cpp b/src/track/libheaptrack.cpp | ||
| 15 | index e138bce..4120ecd 100644 | ||
| 16 | --- a/src/track/libheaptrack.cpp | ||
| 17 | +++ b/src/track/libheaptrack.cpp | ||
| 18 | @@ -79,7 +79,7 @@ chrono::milliseconds elapsedTime() | ||
| 19 | return chrono::duration_cast<chrono::milliseconds>(clock::now() - startTime()); | ||
| 20 | } | ||
| 21 | |||
| 22 | -__pid_t gettid() | ||
| 23 | +pid_t gettid() | ||
| 24 | { | ||
| 25 | return syscall(SYS_gettid); | ||
| 26 | } | ||
diff --git a/meta-oe/recipes-devtools/heaptrack/heaptrack/0002-heaptrack_inject-Include-dlfcn.h-for-dlopen-dlclose.patch b/meta-oe/recipes-devtools/heaptrack/heaptrack/0002-heaptrack_inject-Include-dlfcn.h-for-dlopen-dlclose.patch new file mode 100644 index 0000000000..5fa802cb38 --- /dev/null +++ b/meta-oe/recipes-devtools/heaptrack/heaptrack/0002-heaptrack_inject-Include-dlfcn.h-for-dlopen-dlclose.patch | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | From 8ebcf5f2dd27dbeb6c81e9c40a5d17916cb243e6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 23 Nov 2020 15:26:31 -0800 | ||
| 4 | Subject: [PATCH] heaptrack_inject: Include dlfcn.h for dlopen/dlclose | ||
| 5 | |||
| 6 | Do not use __WORDSIZE which is for libc internal use | ||
| 7 | |||
| 8 | Upstream-Status: Pending | ||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | ||
| 11 | src/track/heaptrack_inject.cpp | 6 ++++-- | ||
| 12 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/src/track/heaptrack_inject.cpp b/src/track/heaptrack_inject.cpp | ||
| 15 | index 325d87e..fb1c154 100644 | ||
| 16 | --- a/src/track/heaptrack_inject.cpp | ||
| 17 | +++ b/src/track/heaptrack_inject.cpp | ||
| 18 | @@ -28,6 +28,7 @@ | ||
| 19 | #include <link.h> | ||
| 20 | #include <malloc.h> | ||
| 21 | #include <unistd.h> | ||
| 22 | +#include <dlfcn.h> | ||
| 23 | |||
| 24 | #include <sys/mman.h> | ||
| 25 | |||
| 26 | @@ -39,9 +40,10 @@ | ||
| 27 | * @brief Experimental support for symbol overloading after runtime injection. | ||
| 28 | */ | ||
| 29 | |||
| 30 | -#if __WORDSIZE == 64 | ||
| 31 | +#include <limits.h> | ||
| 32 | +#if ULONG_MAX == 0xffffffffffffffff | ||
| 33 | #define ELF_R_SYM(i) ELF64_R_SYM(i) | ||
| 34 | -#elif __WORDSIZE == 32 | ||
| 35 | +#elif ULONG_MAX == 0xffffffff | ||
| 36 | #define ELF_R_SYM(i) ELF32_R_SYM(i) | ||
| 37 | #else | ||
| 38 | #error unsupported word size | ||
diff --git a/meta-oe/recipes-devtools/heaptrack/heaptrack/0003-heaptrack_preload-Make-noexcept-attribute-conditiona.patch b/meta-oe/recipes-devtools/heaptrack/heaptrack/0003-heaptrack_preload-Make-noexcept-attribute-conditiona.patch new file mode 100644 index 0000000000..c3c852e39e --- /dev/null +++ b/meta-oe/recipes-devtools/heaptrack/heaptrack/0003-heaptrack_preload-Make-noexcept-attribute-conditiona.patch | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | From b8435c6523d9377f04d5e21629f3dc68b8865016 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 23 Nov 2020 15:31:45 -0800 | ||
| 4 | Subject: [PATCH] heaptrack_preload: Make noexcept attribute conditional | ||
| 5 | |||
| 6 | musl does not define these functions with noexcept and hence compiler | ||
| 7 | complains about them | ||
| 8 | |||
| 9 | Upstream-Status: Pending | ||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | src/track/heaptrack_preload.cpp | 26 ++++++++++++++++---------- | ||
| 13 | 1 file changed, 16 insertions(+), 10 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/src/track/heaptrack_preload.cpp b/src/track/heaptrack_preload.cpp | ||
| 16 | index 63110ce..ee85331 100644 | ||
| 17 | --- a/src/track/heaptrack_preload.cpp | ||
| 18 | +++ b/src/track/heaptrack_preload.cpp | ||
| 19 | @@ -171,11 +171,17 @@ void init() | ||
| 20 | } | ||
| 21 | } | ||
| 22 | |||
| 23 | +#ifdef __GLIBC__ | ||
| 24 | +#define NOEXECPT noexcept | ||
| 25 | +#else | ||
| 26 | +#define NOEXECPT | ||
| 27 | +#endif | ||
| 28 | + | ||
| 29 | extern "C" { | ||
| 30 | |||
| 31 | /// TODO: memalign, pvalloc, ...? | ||
| 32 | |||
| 33 | -void* malloc(size_t size) noexcept | ||
| 34 | +void* malloc(size_t size) NOEXECPT | ||
| 35 | { | ||
| 36 | if (!hooks::malloc) { | ||
| 37 | hooks::init(); | ||
| 38 | @@ -186,7 +192,7 @@ void* malloc(size_t size) noexcept | ||
| 39 | return ptr; | ||
| 40 | } | ||
| 41 | |||
| 42 | -void free(void* ptr) noexcept | ||
| 43 | +void free(void* ptr) NOEXECPT | ||
| 44 | { | ||
| 45 | if (!hooks::free) { | ||
| 46 | hooks::init(); | ||
| 47 | @@ -204,7 +210,7 @@ void free(void* ptr) noexcept | ||
| 48 | hooks::free(ptr); | ||
| 49 | } | ||
| 50 | |||
| 51 | -void* realloc(void* ptr, size_t size) noexcept | ||
| 52 | +void* realloc(void* ptr, size_t size) NOEXECPT | ||
| 53 | { | ||
| 54 | if (!hooks::realloc) { | ||
| 55 | hooks::init(); | ||
| 56 | @@ -219,7 +225,7 @@ void* realloc(void* ptr, size_t size) noexcept | ||
| 57 | return ret; | ||
| 58 | } | ||
| 59 | |||
| 60 | -void* calloc(size_t num, size_t size) noexcept | ||
| 61 | +void* calloc(size_t num, size_t size) NOEXECPT | ||
| 62 | { | ||
| 63 | if (!hooks::calloc) { | ||
| 64 | hooks::init(); | ||
| 65 | @@ -235,7 +241,7 @@ void* calloc(size_t num, size_t size) noexcept | ||
| 66 | } | ||
| 67 | |||
| 68 | #if HAVE_CFREE | ||
| 69 | -void cfree(void* ptr) noexcept | ||
| 70 | +void cfree(void* ptr) NOEXECPT | ||
| 71 | { | ||
| 72 | if (!hooks::cfree) { | ||
| 73 | hooks::init(); | ||
| 74 | @@ -252,7 +258,7 @@ void cfree(void* ptr) noexcept | ||
| 75 | } | ||
| 76 | #endif | ||
| 77 | |||
| 78 | -int posix_memalign(void** memptr, size_t alignment, size_t size) noexcept | ||
| 79 | +int posix_memalign(void** memptr, size_t alignment, size_t size) NOEXECPT | ||
| 80 | { | ||
| 81 | if (!hooks::posix_memalign) { | ||
| 82 | hooks::init(); | ||
| 83 | @@ -268,7 +274,7 @@ int posix_memalign(void** memptr, size_t alignment, size_t size) noexcept | ||
| 84 | } | ||
| 85 | |||
| 86 | #if HAVE_ALIGNED_ALLOC | ||
| 87 | -void* aligned_alloc(size_t alignment, size_t size) noexcept | ||
| 88 | +void* aligned_alloc(size_t alignment, size_t size) NOEXECPT | ||
| 89 | { | ||
| 90 | if (!hooks::aligned_alloc) { | ||
| 91 | hooks::init(); | ||
| 92 | @@ -285,7 +291,7 @@ void* aligned_alloc(size_t alignment, size_t size) noexcept | ||
| 93 | #endif | ||
| 94 | |||
| 95 | #if HAVE_VALLOC | ||
| 96 | -void* valloc(size_t size) noexcept | ||
| 97 | +void* valloc(size_t size) NOEXECPT | ||
| 98 | { | ||
| 99 | if (!hooks::valloc) { | ||
| 100 | hooks::init(); | ||
| 101 | @@ -301,7 +307,7 @@ void* valloc(size_t size) noexcept | ||
| 102 | } | ||
| 103 | #endif | ||
| 104 | |||
| 105 | -void* dlopen(const char* filename, int flag) noexcept | ||
| 106 | +void* dlopen(const char* filename, int flag) NOEXECPT | ||
| 107 | { | ||
| 108 | if (!hooks::dlopen) { | ||
| 109 | hooks::init(); | ||
| 110 | @@ -316,7 +322,7 @@ void* dlopen(const char* filename, int flag) noexcept | ||
| 111 | return ret; | ||
| 112 | } | ||
| 113 | |||
| 114 | -int dlclose(void* handle) noexcept | ||
| 115 | +int dlclose(void* handle) NOEXECPT | ||
| 116 | { | ||
| 117 | if (!hooks::dlclose) { | ||
| 118 | hooks::init(); | ||
diff --git a/meta-oe/recipes-devtools/heaptrack/heaptrack/0004-backtrace-Always-include-stdint.h.patch b/meta-oe/recipes-devtools/heaptrack/heaptrack/0004-backtrace-Always-include-stdint.h.patch new file mode 100644 index 0000000000..3db03cf85d --- /dev/null +++ b/meta-oe/recipes-devtools/heaptrack/heaptrack/0004-backtrace-Always-include-stdint.h.patch | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | From 200f71ea8c0756594ac7e079ccc686d9a20cea5c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 23 Nov 2020 15:32:58 -0800 | ||
| 4 | Subject: [PATCH] backtrace: Always include stdint.h | ||
| 5 | |||
| 6 | in OE we will always have system headers which supports C99/stdint.h | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [Unless upstream drops legacy] | ||
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 10 | --- | ||
| 11 | 3rdparty/libbacktrace/backtrace.h | 16 ---------------- | ||
| 12 | 1 file changed, 16 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/3rdparty/libbacktrace/backtrace.h b/3rdparty/libbacktrace/backtrace.h | ||
| 15 | index 14863cf..d0ac38f 100644 | ||
| 16 | --- a/3rdparty/libbacktrace/backtrace.h | ||
| 17 | +++ b/3rdparty/libbacktrace/backtrace.h | ||
| 18 | @@ -36,24 +36,8 @@ POSSIBILITY OF SUCH DAMAGE. */ | ||
| 19 | #include <stddef.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | |||
| 22 | -/* We want to get a definition for uintptr_t, but we still care about | ||
| 23 | - systems that don't have <stdint.h>. */ | ||
| 24 | -#if defined(__GLIBC__) && __GLIBC__ >= 2 | ||
| 25 | - | ||
| 26 | -#include <stdint.h> | ||
| 27 | - | ||
| 28 | -#elif defined(HAVE_STDINT_H) | ||
| 29 | - | ||
| 30 | #include <stdint.h> | ||
| 31 | |||
| 32 | -#else | ||
| 33 | - | ||
| 34 | -/* Systems that don't have <stdint.h> must provide gstdint.h, e.g., | ||
| 35 | - from GCC_HEADER_STDINT in configure.ac. */ | ||
| 36 | -#include "gstdint.h" | ||
| 37 | - | ||
| 38 | -#endif | ||
| 39 | - | ||
| 40 | #ifdef __cplusplus | ||
| 41 | extern "C" { | ||
| 42 | #endif | ||
diff --git a/meta-oe/recipes-devtools/heaptrack/heaptrack_1.2.0.bb b/meta-oe/recipes-devtools/heaptrack/heaptrack_1.2.0.bb new file mode 100644 index 0000000000..14d3983ca6 --- /dev/null +++ b/meta-oe/recipes-devtools/heaptrack/heaptrack_1.2.0.bb | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | SUMMARY = "Heap memory profiler for Linux" | ||
| 2 | DESCRIPTION = "Heaptrack traces all memory allocations and annotates these \ | ||
| 3 | events with stack traces. Dedicated analysis tools then allow you to interpret \ | ||
| 4 | the heap memory profile to find hotspots to reduce memory, leaks, allocation \ | ||
| 5 | hotspots and temporary allocations" | ||
| 6 | HOMEPAGE = "https://phabricator.kde.org/source/heaptrack/" | ||
| 7 | LICENSE = "LGPL-2.1" | ||
| 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" | ||
| 9 | |||
| 10 | DEPENDS = "zlib boost libunwind elfutils" | ||
| 11 | |||
| 12 | SRC_URI = "git://github.com/KDE/heaptrack.git;protocol=https \ | ||
| 13 | file://0001-libheaptrack-Replace-__pid_t-with-pid_t.patch \ | ||
| 14 | file://0002-heaptrack_inject-Include-dlfcn.h-for-dlopen-dlclose.patch \ | ||
| 15 | file://0003-heaptrack_preload-Make-noexcept-attribute-conditiona.patch \ | ||
| 16 | file://0004-backtrace-Always-include-stdint.h.patch \ | ||
| 17 | " | ||
| 18 | |||
| 19 | SRCREV = "bc9e3744bcc47de978673d1e382f4125a1ab5fa8" | ||
| 20 | |||
| 21 | S = "${WORKDIR}/git" | ||
| 22 | |||
| 23 | inherit cmake | ||
| 24 | |||
| 25 | EXTRA_OECMAKE += "-DHEAPTRACK_BUILD_GUI=OFF" | ||
| 26 | |||
| 27 | BBCLASSEXTEND = "native nativesdk" | ||
diff --git a/meta-oe/recipes-devtools/heaptrack/heaptrack_git.bb b/meta-oe/recipes-devtools/heaptrack/heaptrack_git.bb deleted file mode 100644 index 30d7b65bd7..0000000000 --- a/meta-oe/recipes-devtools/heaptrack/heaptrack_git.bb +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | DESCRIPTION = "Heaptrack" | ||
| 2 | HOMEPAGE = "https://phabricator.kde.org/source/heaptrack/" | ||
| 3 | LICENSE = "LGPL-2.1" | ||
| 4 | LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" | ||
| 5 | |||
| 6 | DEPENDS = "zlib boost libunwind elfutils" | ||
| 7 | |||
| 8 | SRC_URI = "git://github.com/KDE/heaptrack.git;protocol=https" | ||
| 9 | |||
| 10 | SRCREV = "bc9e3744bcc47de978673d1e382f4125a1ab5fa8" | ||
| 11 | |||
| 12 | S = "${WORKDIR}/git" | ||
| 13 | |||
| 14 | inherit cmake | ||
| 15 | |||
| 16 | EXTRA_OECMAKE += "-DHEAPTRACK_BUILD_GUI=OFF" | ||
| 17 | |||
| 18 | BBCLASSEXTEND = "native nativesdk" | ||
