summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-11-23 15:40:35 -0800
committerKhem Raj <raj.khem@gmail.com>2020-11-23 15:43:06 -0800
commit3e6f82dd54b296072d725f5691204618d60a2666 (patch)
treea1151e330ca116c459a251098d203407a9acf2cf
parent0948ba8e496c3ad2e16e4906574fc120db813182 (diff)
downloadmeta-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>
-rw-r--r--meta-oe/recipes-devtools/heaptrack/heaptrack/0001-libheaptrack-Replace-__pid_t-with-pid_t.patch26
-rw-r--r--meta-oe/recipes-devtools/heaptrack/heaptrack/0002-heaptrack_inject-Include-dlfcn.h-for-dlopen-dlclose.patch38
-rw-r--r--meta-oe/recipes-devtools/heaptrack/heaptrack/0003-heaptrack_preload-Make-noexcept-attribute-conditiona.patch118
-rw-r--r--meta-oe/recipes-devtools/heaptrack/heaptrack/0004-backtrace-Always-include-stdint.h.patch42
-rw-r--r--meta-oe/recipes-devtools/heaptrack/heaptrack_1.2.0.bb27
-rw-r--r--meta-oe/recipes-devtools/heaptrack/heaptrack_git.bb18
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 @@
1From 18671cd6028f996c138c6eb4282caf313f3fc605 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 23 Nov 2020 15:25:18 -0800
4Subject: [PATCH] libheaptrack: Replace __pid_t with pid_t
5
6__pid_t is for internal libc use
7
8Upstream-Status: Pending
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 src/track/libheaptrack.cpp | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/src/track/libheaptrack.cpp b/src/track/libheaptrack.cpp
15index 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 @@
1From 8ebcf5f2dd27dbeb6c81e9c40a5d17916cb243e6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 23 Nov 2020 15:26:31 -0800
4Subject: [PATCH] heaptrack_inject: Include dlfcn.h for dlopen/dlclose
5
6Do not use __WORDSIZE which is for libc internal use
7
8Upstream-Status: Pending
9Signed-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
14diff --git a/src/track/heaptrack_inject.cpp b/src/track/heaptrack_inject.cpp
15index 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 @@
1From b8435c6523d9377f04d5e21629f3dc68b8865016 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 23 Nov 2020 15:31:45 -0800
4Subject: [PATCH] heaptrack_preload: Make noexcept attribute conditional
5
6musl does not define these functions with noexcept and hence compiler
7complains about them
8
9Upstream-Status: Pending
10Signed-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
15diff --git a/src/track/heaptrack_preload.cpp b/src/track/heaptrack_preload.cpp
16index 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 @@
1From 200f71ea8c0756594ac7e079ccc686d9a20cea5c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 23 Nov 2020 15:32:58 -0800
4Subject: [PATCH] backtrace: Always include stdint.h
5
6in OE we will always have system headers which supports C99/stdint.h
7
8Upstream-Status: Inappropriate [Unless upstream drops legacy]
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 3rdparty/libbacktrace/backtrace.h | 16 ----------------
12 1 file changed, 16 deletions(-)
13
14diff --git a/3rdparty/libbacktrace/backtrace.h b/3rdparty/libbacktrace/backtrace.h
15index 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 @@
1SUMMARY = "Heap memory profiler for Linux"
2DESCRIPTION = "Heaptrack traces all memory allocations and annotates these \
3events with stack traces. Dedicated analysis tools then allow you to interpret \
4the heap memory profile to find hotspots to reduce memory, leaks, allocation \
5hotspots and temporary allocations"
6HOMEPAGE = "https://phabricator.kde.org/source/heaptrack/"
7LICENSE = "LGPL-2.1"
8LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
9
10DEPENDS = "zlib boost libunwind elfutils"
11
12SRC_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
19SRCREV = "bc9e3744bcc47de978673d1e382f4125a1ab5fa8"
20
21S = "${WORKDIR}/git"
22
23inherit cmake
24
25EXTRA_OECMAKE += "-DHEAPTRACK_BUILD_GUI=OFF"
26
27BBCLASSEXTEND = "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 @@
1DESCRIPTION = "Heaptrack"
2HOMEPAGE = "https://phabricator.kde.org/source/heaptrack/"
3LICENSE = "LGPL-2.1"
4LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
5
6DEPENDS = "zlib boost libunwind elfutils"
7
8SRC_URI = "git://github.com/KDE/heaptrack.git;protocol=https"
9
10SRCREV = "bc9e3744bcc47de978673d1e382f4125a1ab5fa8"
11
12S = "${WORKDIR}/git"
13
14inherit cmake
15
16EXTRA_OECMAKE += "-DHEAPTRACK_BUILD_GUI=OFF"
17
18BBCLASSEXTEND = "native nativesdk"