summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch')
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch54
1 files changed, 54 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