summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorStacy Gaikovaia <Stacy.Gaikovaia@windriver.com>2020-11-20 11:51:55 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-12-03 23:02:08 +0000
commit307146220b51f2c3d8c1fe517af711d14219488d (patch)
treeead68e3dddf61326f3e8b06848572b15f4558499 /meta/recipes-devtools
parentd754cd3a49568da0bc9674da7f3dcd0dbf84287d (diff)
downloadpoky-307146220b51f2c3d8c1fe517af711d14219488d.tar.gz
valgrind: helgrind: Intercept libc functions
PTH_FUNC definition needs to be modified in order to intercept posix thread functions in both libc and libpthread. In order to handle this in helgrind, weak alias the pthread functions in glibc. Include a special case for musl. See https://bugs.kde.org/show_bug.cgi?id=428909 for additional discussion. Upstream-Status: Submitted (From OE-Core rev: 4c33ce1b1eca9aff0009bf71ce50f6398f7cd281) Signed-off-by: Paul Floyd <paulf@free.fr> Signed-off-by: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 5da46a552d54de34a5243e1d90dcc6f52b7af746) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch54
-rw-r--r--meta/recipes-devtools/valgrind/valgrind_3.16.1.bb1
2 files changed, 55 insertions, 0 deletions
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch b/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch
new file mode 100644
index 0000000000..f66df3d2d2
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch
@@ -0,0 +1,54 @@
1From cdec010444df5a4328e90d07a2024fdeefcc74b5 Mon Sep 17 00:00:00 2001
2From: Paul Floyd <paulf@free.fr>
3Date: Wed, 18 Nov 2020 12:49:20 -0400
4Subject: [PATCH] helgrind: Intercept libc functions
5
6PTH_FUNC definition needs to be modified in order to
7intercept posix thread functions in both libc and
8libpthread. In order to handle this in helgrind, weak alias
9the pthread functions in glibc.
10
11Upstream-Status: Submitted
12
13Signed-off-by: Paul Floyd <paulf@free.fr>
14Signed-off-by: Stacy Gaikovaia <stacy.gaikovaia@windriver.com>
15---
16 helgrind/hg_intercepts.c | 12 ++++++++++++
17 1 file changed, 12 insertions(+)
18
19diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c
20index a10c3a4a3..316140ca6 100644
21--- a/helgrind/hg_intercepts.c
22+++ b/helgrind/hg_intercepts.c
23@@ -77,6 +77,11 @@
24 /*--- ---*/
25 /*----------------------------------------------------------------*/
26
27+#define hg_expand(tok) #tok
28+#define hg_str(tok) hg_expand(tok)
29+# define hg_weak_alias(name, aliasname) \
30+ extern __typeof (name) aliasname __attribute__ ((weak, alias(hg_str(name))))
31+
32 #if defined(VGO_solaris)
33 /* On Solaris, libpthread is just a filter library on top of libc.
34 * Threading and synchronization functions in runtime linker are not
35@@ -91,9 +96,16 @@
36 #define CREQ_PTHREAD_T Word
37 #define SEM_ERROR ret
38 #else
39+#ifdef MUSL_LIBC
40+#define PTH_FUNC(ret_ty, f, args...) \
41+ ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args); \
42+ ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args)
43+#else
44 #define PTH_FUNC(ret_ty, f, args...) \
45 ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args); \
46+ hg_weak_alias(I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f), I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBC_SONAME,f)); \
47 ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args)
48+#endif
49 #define CREQ_PTHREAD_T pthread_t
50 #define SEM_ERROR errno
51 #endif /* VGO_solaris */
52--
532.17.1
54
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
index bcba55f327..5db181ac14 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
@@ -42,6 +42,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
42 file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ 42 file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
43 file://0001-drd-Port-to-Fedora-33.patch \ 43 file://0001-drd-Port-to-Fedora-33.patch \
44 file://0001-drd-musl-fix.patch \ 44 file://0001-drd-musl-fix.patch \
45 file://0001-helgrind-Intercept-libc-functions.patch \
45 " 46 "
46SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589" 47SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589"
47SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca" 48SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca"