From 04625c92a12800b36df564247644c2e821793d98 Mon Sep 17 00:00:00 2001 From: Randy MacLeod Date: Mon, 12 Feb 2024 14:05:00 -0800 Subject: valgrind: update from 3.21.0 to 3.22.0 Full release notes: https://valgrind.org/docs/manual/dist.news.html In summary, there is a new configure option: --with-gdbscripts-dir that lets you install the gdb valgrind python monitor scripts in a specific location. It's not used in the valgrind recipe yet. Also, there were a few Memcheck and Cachegrind improvements made and many bugs fixed. The update required removing the patch: 0001-none-tests-x86-linux-seg_override.c-add-missing-incl.patch as it's dealt with by these commits: f7e4bb4af Bug 382034 - Testcases build fixes for musl 306232d40 musl: another fix for building testcases as described on: https://bugs.kde.org/show_bug.cgi?id=382034 Drop: 002-context-APIs-are-not-available-on-musl.patch since this is handled in a different way by the following upstream commits: c9e88f345 configure, drd: Only build the swapcontext test if swapcontext() is available 7cd4d7816 memcheck/tests/linux/stack_changes: Only run this test if setcontext() is available And the that tracked the error: https://bugs.kde.org/show_bug.cgi?id=434775 is closed. No regression in musl qemux86-64/kvm ptest results. Drop: 0001-fix-opcode-not-supported-on-mips32-linux.patch The resolved (works for me) upstream defect rejected this patch: https://bugs.kde.org/show_bug.cgi?id=396905 and suggested using CFLAGS="-mips32". With this patch dropped, the qemumips build succeeds perhaps due to using -march=mips32r2 Drop: 0001-Make-local-functions-static-to-avoid-assembler-error.patch since this was fixed upstream by commit: d6da48fe5 mips: use local labels for do_acasW() Confirmed with: MACHINE=qemumips TCLIBC=musl bitbake valgrind Ptest Resutls for qemux86-64/kvm glibc: === Test Summary === TOTAL: 792 PASSED: 759 FAILED: 14 SKIPPED: 19 musl: === Test Summary === TOTAL: 792 PASSED: 559 FAILED: 211 SKIPPED: 22 (From OE-Core rev: a04c7714e9f69b7a3fc36adecf7e55c0fcfaa891) Signed-off-by: Randy MacLeod Signed-off-by: Randy MacLeod Signed-off-by: Richard Purdie --- ...functions-static-to-avoid-assembler-error.patch | 182 -------------- ...-fix-opcode-not-supported-on-mips32-linux.patch | 82 ------- ...x86-linux-seg_override.c-add-missing-incl.patch | 30 --- ...02-context-APIs-are-not-available-on-musl.patch | 92 ------- meta/recipes-devtools/valgrind/valgrind_3.21.0.bb | 266 --------------------- meta/recipes-devtools/valgrind/valgrind_3.22.0.bb | 262 ++++++++++++++++++++ 6 files changed, 262 insertions(+), 652 deletions(-) delete mode 100644 meta/recipes-devtools/valgrind/valgrind/0001-Make-local-functions-static-to-avoid-assembler-error.patch delete mode 100644 meta/recipes-devtools/valgrind/valgrind/0001-fix-opcode-not-supported-on-mips32-linux.patch delete mode 100644 meta/recipes-devtools/valgrind/valgrind/0001-none-tests-x86-linux-seg_override.c-add-missing-incl.patch delete mode 100644 meta/recipes-devtools/valgrind/valgrind/0002-context-APIs-are-not-available-on-musl.patch delete mode 100644 meta/recipes-devtools/valgrind/valgrind_3.21.0.bb create mode 100644 meta/recipes-devtools/valgrind/valgrind_3.22.0.bb (limited to 'meta/recipes-devtools/valgrind') diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-Make-local-functions-static-to-avoid-assembler-error.patch b/meta/recipes-devtools/valgrind/valgrind/0001-Make-local-functions-static-to-avoid-assembler-error.patch deleted file mode 100644 index 8d2ca5733e..0000000000 --- a/meta/recipes-devtools/valgrind/valgrind/0001-Make-local-functions-static-to-avoid-assembler-error.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 2155c1b2cf00e744e280c493eb74bf457dfcc3b1 Mon Sep 17 00:00:00 2001 -From: Randy MacLeod -Date: Sun, 21 Oct 2018 15:09:31 -0400 -Subject: [PATCH] Make local functions static to avoid assembler error - -Avoid mips32 x-compiler warnings such as: - -| ../../../valgrind-3.14.0/helgrind/tests/annotate_hbefore.c:360:6: warning: no previous prototype for 'do_signal' [-Wmissing-prototypes] -| void do_signal ( UWord* w ) -| ^~~~~~~~~ - -by making functions and global variables that are file scope be static -and more importantly also avoid an assembler error: - -/tmp/cce22iiw.s: Assembler messages: -/tmp/cce22iiw.s:446: Error: symbol `exit_0' is already defined -/tmp/cce22iiw.s:448: Error: symbol `exit' is already defined -/tmp/cce22iiw.s:915: Error: symbol `exit_0' is already defined -/tmp/cce22iiw.s:917: Error: symbol `exit' is already defined - -Upstream-Status: Submitted https://bugs.kde.org/show_bug.cgi?id=400164 - -Signed-off-by: Randy MacLeod ---- - helgrind/tests/annotate_hbefore.c | 34 +++++++++++++++---------------- - 1 file changed, 17 insertions(+), 17 deletions(-) - -diff --git a/helgrind/tests/annotate_hbefore.c b/helgrind/tests/annotate_hbefore.c -index e311714f7..f55514e45 100644 ---- a/helgrind/tests/annotate_hbefore.c -+++ b/helgrind/tests/annotate_hbefore.c -@@ -24,7 +24,7 @@ typedef unsigned long int UWord; - - // ppc64 - /* return 1 if success, 0 if failure */ --UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) -+static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - { - UWord old, success; - -@@ -57,7 +57,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - - // ppc32 - /* return 1 if success, 0 if failure */ --UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) -+static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - { - UWord old, success; - -@@ -90,7 +90,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - - // amd64 - /* return 1 if success, 0 if failure */ --UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) -+static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - { - UWord block[4] = { (UWord)addr, expected, nyu, 2 }; - __asm__ __volatile__( -@@ -113,7 +113,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - - // x86 - /* return 1 if success, 0 if failure */ --UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) -+static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - { - UWord block[4] = { (UWord)addr, expected, nyu, 2 }; - __asm__ __volatile__( -@@ -138,7 +138,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - - // arm - /* return 1 if success, 0 if failure */ --UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) -+static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - { - UWord old, success; - UWord block[2] = { (UWord)addr, nyu }; -@@ -171,7 +171,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - - // arm64 - /* return 1 if success, 0 if failure */ --UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) -+static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - { - UWord old, success; - UWord block[2] = { (UWord)addr, nyu }; -@@ -204,7 +204,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - - // s390x - /* return 1 if success, 0 if failure */ --UWord do_acasW(UWord* addr, UWord expected, UWord nyu ) -+static UWord do_acasW(UWord* addr, UWord expected, UWord nyu ) - { - int cc; - -@@ -223,7 +223,7 @@ UWord do_acasW(UWord* addr, UWord expected, UWord nyu ) - - // mips32 - /* return 1 if success, 0 if failure */ --UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) -+static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - { - UWord success; - UWord block[3] = { (UWord)addr, nyu, expected}; -@@ -256,7 +256,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - - // mips64 - /* return 1 if success, 0 if failure */ --UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) -+static UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - { - UWord success; - UWord block[3] = { (UWord)addr, nyu, expected}; -@@ -287,7 +287,7 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) - - #endif - --void atomic_incW ( UWord* w ) -+static void atomic_incW ( UWord* w ) - { - while (1) { - UWord old = *w; -@@ -301,7 +301,7 @@ void atomic_incW ( UWord* w ) - - #define NNN 1000000 - --void* thread_fn ( void* arg ) -+static void* thread_fn ( void* arg ) - { - UWord* w = (UWord*)arg; - int i; -@@ -331,10 +331,10 @@ int main ( void ) - - #endif - --int shared_var = 0; // is not raced upon -+static int shared_var = 0; // is not raced upon - - --void delayXms ( int i ) -+static void delayXms ( int i ) - { - struct timespec ts = { 0, 1 * 1000 * 1000 }; - // We do the sleep in small pieces to have scheduling -@@ -348,7 +348,7 @@ void delayXms ( int i ) - } - } - --void do_wait ( UWord* w ) -+static void do_wait ( UWord* w ) - { - UWord w0 = *w; - UWord volatile * wV = w; -@@ -357,7 +357,7 @@ void do_wait ( UWord* w ) - ANNOTATE_HAPPENS_AFTER(w); - } - --void do_signal ( UWord* w ) -+static void do_signal ( UWord* w ) - { - ANNOTATE_HAPPENS_BEFORE(w); - atomic_incW(w); -@@ -365,7 +365,7 @@ void do_signal ( UWord* w ) - - - --void* thread_fn1 ( void* arg ) -+static void* thread_fn1 ( void* arg ) - { - UWord* w = (UWord*)arg; - delayXms(500); // ensure t2 gets to its wait first -@@ -376,7 +376,7 @@ void* thread_fn1 ( void* arg ) - return NULL; - } - --void* thread_fn2 ( void* arg ) -+static void* thread_fn2 ( void* arg ) - { - UWord* w = (UWord*)arg; - do_wait(w); // wait for h-b edge from first thread --- -2.17.0 - diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-fix-opcode-not-supported-on-mips32-linux.patch b/meta/recipes-devtools/valgrind/valgrind/0001-fix-opcode-not-supported-on-mips32-linux.patch deleted file mode 100644 index 39b624d9f6..0000000000 --- a/meta/recipes-devtools/valgrind/valgrind/0001-fix-opcode-not-supported-on-mips32-linux.patch +++ /dev/null @@ -1,82 +0,0 @@ -From fb5362f205b37c5060fcd764a7ed393abe4f2f3d Mon Sep 17 00:00:00 2001 -From: Hongxu Jia -Date: Fri, 27 Jul 2018 17:39:37 +0800 -Subject: [PATCH 1/2] fix opcode not supported on mips32-linux - -While build tests(`make check') on mips32-linux, there are -serial failures such as: -[snip] -| mips-wrsmllib32-linux-gcc -meb -mabi=32 -mhard-float -c --o atomic_incs-atomic_incs.o `test -f 'atomic_incs.c' || echo -'../../../valgrind-3.13.0/memcheck/tests/'`atomic_incs.c -| /tmp/ccqrmINN.s: Assembler messages: -| /tmp/ccqrmINN.s:247: Error: opcode not supported on this -processor: mips1 (mips1) `ll $t3,0($t1)' -| /tmp/ccqrmINN.s:249: Error: opcode not supported on this -processor: mips1 (mips1) `sc $t3,0($t1)' -[snip] - -Since the following commit applied, it defines CLFAGS for mips32, -but missed to pass them to tests which caused the above failure -... -3e344c57f Merge in a port for mips32-linux -... - -Upstream-Status: Submitted [https://bugs.kde.org/show_bug.cgi?id=396905] -Signed-off-by: Hongxu Jia ---- - helgrind/tests/Makefile.am | 5 +++++ - memcheck/tests/Makefile.am | 5 +++++ - none/tests/mips32/Makefile.am | 4 ++++ - 3 files changed, 14 insertions(+) - -diff --git a/helgrind/tests/Makefile.am b/helgrind/tests/Makefile.am -index ad1af191a..6209d35a7 100644 ---- a/helgrind/tests/Makefile.am -+++ b/helgrind/tests/Makefile.am -@@ -214,6 +214,11 @@ check_PROGRAMS += annotate_rwlock - endif - - AM_CFLAGS += $(AM_FLAG_M3264_PRI) -+ -+if VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX -+AM_CFLAGS += $(AM_CFLAGS_MIPS32_LINUX) -+endif -+ - AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) - - LDADD = -lpthread -diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am -index 84e49405f..aff861a32 100644 ---- a/memcheck/tests/Makefile.am -+++ b/memcheck/tests/Makefile.am -@@ -443,6 +443,11 @@ check_PROGRAMS += reach_thread_register - endif - - AM_CFLAGS += $(AM_FLAG_M3264_PRI) -+ -+if VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX -+AM_CFLAGS += $(AM_CFLAGS_MIPS32_LINUX) -+endif -+ - AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) - - if VGCONF_PLATFORMS_INCLUDE_ARM_LINUX -diff --git a/none/tests/mips32/Makefile.am b/none/tests/mips32/Makefile.am -index d11591d45..602cd26f6 100644 ---- a/none/tests/mips32/Makefile.am -+++ b/none/tests/mips32/Makefile.am -@@ -99,6 +99,10 @@ check_PROGRAMS = \ - round_fpu64 \ - fpu_branches - -+if VGCONF_PLATFORMS_INCLUDE_MIPS32_LINUX -+AM_CFLAGS += $(AM_CFLAGS_MIPS32_LINUX) -+endif -+ - AM_CFLAGS += @FLAG_M32@ - AM_CXXFLAGS += @FLAG_M32@ - AM_CCASFLAGS += @FLAG_M32@ --- -2.17.1 - diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-none-tests-x86-linux-seg_override.c-add-missing-incl.patch b/meta/recipes-devtools/valgrind/valgrind/0001-none-tests-x86-linux-seg_override.c-add-missing-incl.patch deleted file mode 100644 index 5e36c28523..0000000000 --- a/meta/recipes-devtools/valgrind/valgrind/0001-none-tests-x86-linux-seg_override.c-add-missing-incl.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 978d9ed7f857f2cdcd2a8632f3c2feb56b99c825 Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Mon, 8 May 2023 11:56:35 +0200 -Subject: [PATCH] none/tests/x86-linux/seg_override.c: add missing include for - musl builds - -Otherwise SYS_modify_ldt is undefined. - -Upstream-Status: Submitted [https://bugs.kde.org/show_bug.cgi?id=382034] -Signed-off-by: Alexander Kanavin - ---- - none/tests/x86-linux/seg_override.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/none/tests/x86-linux/seg_override.c b/none/tests/x86-linux/seg_override.c -index ca8fbfe..4ef4394 100644 ---- a/none/tests/x86-linux/seg_override.c -+++ b/none/tests/x86-linux/seg_override.c -@@ -3,6 +3,10 @@ - #include - #include - #include "../../../config.h" -+#if defined(MUSL_LIBC) -+#include -+#include -+#endif - - - /* Stuff from Wine. */ diff --git a/meta/recipes-devtools/valgrind/valgrind/0002-context-APIs-are-not-available-on-musl.patch b/meta/recipes-devtools/valgrind/valgrind/0002-context-APIs-are-not-available-on-musl.patch deleted file mode 100644 index 7f0e38cb95..0000000000 --- a/meta/recipes-devtools/valgrind/valgrind/0002-context-APIs-are-not-available-on-musl.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 26c104adf6c5162572b7aa2fac89d0835b7f8f0b Mon Sep 17 00:00:00 2001 -From: Randy MacLeod -Date: Tue, 16 Oct 2018 21:27:46 -0400 -Subject: [PATCH] context APIs are not available on musl - -Updated patch for valgrind-3.14 - -Signed-off-by: Khem Raj -Signed-off-by: Randy MacLeod - -Apply same patch to drd/tests/swapcontext.c -for valgrind-3.17. - -Upstream-Status: Submitted [https://bugs.kde.org/show_bug.cgi?id=434775] - -Signed-off-by: Yi Fan Yu ---- - drd/tests/swapcontext.c | 6 ++++++ - memcheck/tests/linux/stack_changes.c | 7 ++++++- - 2 files changed, 12 insertions(+), 1 deletion(-) - -diff --git a/drd/tests/swapcontext.c b/drd/tests/swapcontext.c -index 622c70bc5..5e72bb0f3 100644 ---- a/drd/tests/swapcontext.c -+++ b/drd/tests/swapcontext.c -@@ -20,6 +20,7 @@ - - #define STACKSIZE (PTHREAD_STACK_MIN + 4096) - -+#ifdef __GLIBC__ - typedef struct thread_local { - ucontext_t uc[3]; - size_t nrsw; -@@ -67,9 +68,11 @@ void *worker(void *data) - swapcontext(&tlocal->uc[0], &tlocal->uc[1]); - return NULL; - } -+#endif - - int main(int argc, char *argv[]) - { -+#ifdef __GLIBC__ - enum { NR = 32 }; - thread_local_t tlocal[NR]; - pthread_t thread[NR]; -@@ -94,6 +97,9 @@ int main(int argc, char *argv[]) - - for (i = 0; i < NR; i++) - pthread_join(thread[i], NULL); -+#else -+ printf("libc context call APIs e.g. getcontext() are deprecated by posix\n"); -+#endif - - return 0; - } -diff --git a/memcheck/tests/linux/stack_changes.c b/memcheck/tests/linux/stack_changes.c -index 7f97b90a5..a26cb4ae6 100644 ---- a/memcheck/tests/linux/stack_changes.c -+++ b/memcheck/tests/linux/stack_changes.c -@@ -10,6 +10,7 @@ - // This test is checking the libc context calls (setcontext, etc.) and - // checks that Valgrind notices their stack changes properly. - -+#ifdef __GLIBC__ - typedef ucontext_t mycontext; - - mycontext ctx1, ctx2, oldc; -@@ -51,9 +52,11 @@ int init_context(mycontext *uc) - - return ret; - } -+#endif - - int main(int argc, char **argv) - { -+#ifdef __GLIBC__ - int c1 = init_context(&ctx1); - int c2 = init_context(&ctx2); - -@@ -66,6 +69,8 @@ int main(int argc, char **argv) - //free(ctx1.uc_stack.ss_sp); - VALGRIND_STACK_DEREGISTER(c2); - //free(ctx2.uc_stack.ss_sp); -- -+#else -+ printf("libc context call APIs e.g. getcontext() are deprecated by posix\n"); -+#endif - return 0; - } --- -2.17.1 - diff --git a/meta/recipes-devtools/valgrind/valgrind_3.21.0.bb b/meta/recipes-devtools/valgrind/valgrind_3.21.0.bb deleted file mode 100644 index 0903008e61..0000000000 --- a/meta/recipes-devtools/valgrind/valgrind_3.21.0.bb +++ /dev/null @@ -1,266 +0,0 @@ -SUMMARY = "Valgrind memory debugger and instrumentation framework" -HOMEPAGE = "http://valgrind.org/" -DESCRIPTION = "Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail." -BUGTRACKER = "http://valgrind.org/support/bug_reports.html" -LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://include/pub_tool_basics.h;beginline=6;endline=29;md5=41c410e8d3f305aee7aaa666b2e4f366 \ - file://include/valgrind.h;beginline=1;endline=56;md5=ad3b317f3286b6b704575d9efe6ca5df \ - file://COPYING.DOCS;md5=24ea4c7092233849b4394699333b5c56" - -DEPENDS = " \ - ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'boost', '', d)} \ - " - -SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \ - file://fixed-perl-path.patch \ - file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch \ - file://run-ptest \ - file://remove-for-aarch64 \ - file://remove-for-all \ - file://taskset_nondeterministic_tests \ - file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \ - file://use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch \ - file://avoid-neon-for-targets-which-don-t-support-it.patch \ - file://valgrind-make-ld-XXX.so-strlen-intercept-optional.patch \ - file://0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch \ - file://0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch \ - file://0002-context-APIs-are-not-available-on-musl.patch \ - file://0003-correct-include-directive-path-for-config.h.patch \ - file://0001-fix-opcode-not-supported-on-mips32-linux.patch \ - file://0001-Make-local-functions-static-to-avoid-assembler-error.patch \ - file://0001-Return-a-valid-exit_code-from-vg_regtest.patch \ - file://0001-valgrind-filter_xml_frames-do-not-filter-usr.patch \ - file://0001-memcheck-vgtests-remove-fullpath-after-flags.patch \ - file://s390x_vec_op_t.patch \ - file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \ - file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ - file://0001-docs-Disable-manual-validation.patch \ - file://0001-none-tests-x86-linux-seg_override.c-add-missing-incl.patch \ - " -SRC_URI[sha256sum] = "10ce1618bb3e33fad16eb79552b0a3e1211762448a0d7fce11c8a6243b9ac971" -UPSTREAM_CHECK_REGEX = "valgrind-(?P\d+(\.\d+)+)\.tar" - -COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux' - -# patch 0001-memcheck-vgtests-remove-fullpath-after-flags.patch removes relative path -# argument. Change expected stderr files accordingly. -do_patch:append() { - bb.build.exec_func('do_sed_paths', d) -} - -do_sed_paths() { - sed -i -e 's|tests/||' ${S}/memcheck/tests/badfree3.stderr.exp - sed -i -e 's|tests/||' ${S}/memcheck/tests/varinfo5.stderr.exp -} - -# valgrind supports armv7 and above -COMPATIBLE_HOST:armv4 = 'null' -COMPATIBLE_HOST:armv5 = 'null' -COMPATIBLE_HOST:armv6 = 'null' - -# valgrind fails with powerpc soft-float -COMPATIBLE_HOST:powerpc = "${@bb.utils.contains('TARGET_FPU', 'soft', 'null', '.*-linux', d)}" - -# X32 isn't supported by valgrind at this time -COMPATIBLE_HOST:linux-gnux32 = 'null' -COMPATIBLE_HOST:linux-muslx32 = 'null' - -# Disable for some MIPS variants -COMPATIBLE_HOST:mipsarchr6 = 'null' -COMPATIBLE_HOST:linux-gnun32 = 'null' - -# Disable for powerpc64 with musl -COMPATIBLE_HOST:libc-musl:powerpc64 = 'null' - -# brokenseip is unfortunately required by ptests to pass -inherit autotools-brokensep ptest multilib_header - -EXTRA_OECONF = "--enable-tls --without-mpicc" -EXTRA_OECONF += "${@['--enable-only32bit','--enable-only64bit'][d.getVar('SITEINFO_BITS') != '32']}" - -# valgrind checks host_cpu "armv7*)", so we need to over-ride the autotools.bbclass default --host option -EXTRA_OECONF:append:arm = " --host=armv7${HOST_VENDOR}-${HOST_OS}" - -EXTRA_OEMAKE = "-w" - -CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" - -# valgrind likes to control its own optimisation flags. It generally defaults -# to -O2 but uses -O0 for some specific test apps etc. Passing our own flags -# (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it -# which fixes build path issue in DWARF. -SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}" - -# Split out various helper scripts to separate packages to avoid the -# main package depending on perl and python. -PACKAGES =+ "${PN}-cachegrind ${PN}-massif ${PN}-callgrind" - -FILES:${PN}-cachegrind = "${bindir}/cg_*" -FILES:${PN}-massif = "${bindir}/ms_*" -FILES:${PN}-callgrind = "${bindir}/callgrind_*" - -RDEPENDS:${PN}-cachegrind = "${PN} python3-core" -RDEPENDS:${PN}-massif = "${PN} perl" -RDEPENDS:${PN}-callgrind = "${PN} perl" - -do_configure:prepend () { - rm -rf ${S}/config.h - sed -i -e 's:$(abs_top_builddir):$(pkglibdir)/ptest:g' ${S}/none/tests/Makefile.am - sed -i -e 's:$(top_builddir):$(pkglibdir)/ptest:g' ${S}/memcheck/tests/Makefile.am -} - -do_install:append () { - install -m 644 ${B}/default.supp ${D}/${libexecdir}/valgrind/ - oe_multilib_header valgrind/config.h -} - -VALGRINDARCH ?= "${TARGET_ARCH}" -VALGRINDARCH:aarch64 = "arm64" -VALGRINDARCH:x86-64 = "amd64" -VALGRINDARCH:x86 = "x86" -VALGRINDARCH:mips = "mips32" -VALGRINDARCH:mipsel = "mips32" -VALGRINDARCH:mips64el = "mips64" -VALGRINDARCH:powerpc = "ppc" -VALGRINDARCH:powerpc64 = "ppc64" -VALGRINDARCH:powerpc64le = "ppc64le" - -INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${libexecdir}/valgrind/vgpreload_memcheck-${VALGRINDARCH}-linux.so" - -# valgrind needs debug information for ld.so at runtime in order to -# redirect functions like strlen. -RRECOMMENDS:${PN} += "${TCLIBC}-dbg" - -RDEPENDS:${PN}-ptest += " bash coreutils curl file \ - gdb libgomp \ - perl \ - perl-module-file-basename perl-module-file-glob perl-module-getopt-long \ - perl-module-overloading perl-module-cwd perl-module-ipc-open3 \ - perl-module-carp perl-module-symbol \ - procps sed ${PN}-dbg ${PN}-src ${TCLIBC}-src gcc-runtime-dbg \ - util-linux-taskset \ - ${PN}-cachegrind ${PN}-massif ${PN}-callgrind \ -" -RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-gconv-utf-32" - -# One of the tests contains a bogus interpreter path on purpose. -# Skip file dependency check -SKIP_FILEDEPS:${PN}-ptest = '1' -INSANE_SKIP:${PN}-ptest = "debug-deps" - -do_compile_ptest() { - oe_runmake check -} - - -do_install_ptest() { - chmod +x ${B}/tests/vg_regtest - - # The test application binaries are not automatically installed. - # Grab them from the build directory. - # - # The regression tests require scripts and data files that are not - # copied to the build directory. They must be copied from the - # source directory. - saved_dir=$PWD - for parent_dir in ${S} ${B} ; do - cd $parent_dir - - subdirs=" \ - .in_place \ - cachegrind/tests \ - callgrind/tests \ - dhat/tests \ - drd/tests \ - gdbserver_tests \ - helgrind/tests \ - lackey/tests \ - massif/tests \ - memcheck/tests \ - none/tests \ - tests \ - exp-bbv/tests \ - " - # Get the vg test scripts, filters, and expected files - for dir in $subdirs ; do - find $dir | cpio -pvdu ${D}${PTEST_PATH} - done - cd $saved_dir - done - - # The scripts reference config.h so add it to the top ptest dir. - cp ${B}/config.h ${D}${PTEST_PATH} - install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} - install -D ${WORKDIR}/remove-for-all ${D}${PTEST_PATH} - install -D ${WORKDIR}/taskset_nondeterministic_tests ${D}${PTEST_PATH} - - # Add an executable need by none/tests/bigcode - mkdir ${D}${PTEST_PATH}/perf - cp ${B}/perf/bigcode ${D}${PTEST_PATH}/perf - - # Add an executable needed by memcheck/tests/vcpu_bz2 - cp ${B}/perf/bz2 ${D}${PTEST_PATH}/perf - - # Make the ptest dir look like the top level valgrind src dir - # This is checked by the gdbserver_tests/make_local_links script - mkdir ${D}${PTEST_PATH}/coregrind - cp ${B}/coregrind/vgdb ${D}${PTEST_PATH}/coregrind - - # Add an executable needed by massif tests - cp ${B}/massif/ms_print ${D}${PTEST_PATH}/massif/ms_print - - find ${D}${PTEST_PATH} \ - \( \ - -name "Makefile*" \ - -o -name "*.o" \ - \) \ - -exec rm {} \; - - sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann1.vgtest - sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann2.vgtest - - # point the expanded @abs_top_builddir@ of the host to PTEST_PATH - sed -i s:${S}:${PTEST_PATH}:g \ - ${D}${PTEST_PATH}/memcheck/tests/linux/debuginfod-check.vgtest - - # handle multilib - sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest - sed -i s:@libexecdir@:${libexecdir}:g ${D}${PTEST_PATH}/run-ptest - sed -i s:@bindir@:${bindir}:g ${D}${PTEST_PATH}/run-ptest - - # This test fails on the host as well, using both 3.15 and git master (as of Jan 24 2020) - # https://bugs.kde.org/show_bug.cgi?id=402833 - rm ${D}${PTEST_PATH}/memcheck/tests/overlap.vgtest - - # This is known failure see https://bugs.kde.org/show_bug.cgi?id=435732 - rm ${D}${PTEST_PATH}/memcheck/tests/leak_cpp_interior.vgtest - - # https://bugs.kde.org/show_bug.cgi?id=445743 - rm ${D}${PTEST_PATH}/drd/tests/pth_mutex_signal - - # As the binary isn't stripped or debug-splitted, the source file isn't fetched - # via dwarfsrcfiles either, so it needs to be installed manually. - mkdir -p ${D}${TARGET_DBGSRC_DIR}/none/tests/ - install ${S}/none/tests/tls.c ${D}${TARGET_DBGSRC_DIR}/none/tests/ -} - -do_install_ptest:append:x86-64 () { - # https://bugs.kde.org/show_bug.cgi?id=463456 - rm ${D}${PTEST_PATH}/memcheck/tests/origin6-fp.vgtest - # https://bugs.kde.org/show_bug.cgi?id=463458 - rm ${D}${PTEST_PATH}/memcheck/tests/vcpu_fnfns.vgtest - # https://bugs.kde.org/show_bug.cgi?id=463463 - rm ${D}${PTEST_PATH}/none/tests/amd64/fma.vgtest -} - -# avoid stripping some generated binaries otherwise some of the tests will fail -# run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail -INHIBIT_PACKAGE_STRIP_FILES += "\ - ${PKGD}${PTEST_PATH}/none/tests/tls \ - ${PKGD}${PTEST_PATH}/none/tests/tls.so \ - ${PKGD}${PTEST_PATH}/none/tests/tls2.so \ - ${PKGD}${PTEST_PATH}/helgrind/tests/tc09_bad_unlock \ - ${PKGD}${PTEST_PATH}/memcheck/tests/manuel1 \ - ${PKGD}${PTEST_PATH}/drd/tests/pth_detached3 \ -" diff --git a/meta/recipes-devtools/valgrind/valgrind_3.22.0.bb b/meta/recipes-devtools/valgrind/valgrind_3.22.0.bb new file mode 100644 index 0000000000..dc00edb24e --- /dev/null +++ b/meta/recipes-devtools/valgrind/valgrind_3.22.0.bb @@ -0,0 +1,262 @@ +SUMMARY = "Valgrind memory debugger and instrumentation framework" +HOMEPAGE = "http://valgrind.org/" +DESCRIPTION = "Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail." +BUGTRACKER = "http://valgrind.org/support/bug_reports.html" +LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://include/pub_tool_basics.h;beginline=6;endline=29;md5=41c410e8d3f305aee7aaa666b2e4f366 \ + file://include/valgrind.h;beginline=1;endline=56;md5=ad3b317f3286b6b704575d9efe6ca5df \ + file://COPYING.DOCS;md5=24ea4c7092233849b4394699333b5c56" + +DEPENDS = " \ + ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'boost', '', d)} \ + " + +SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \ + file://fixed-perl-path.patch \ + file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch \ + file://run-ptest \ + file://remove-for-aarch64 \ + file://remove-for-all \ + file://taskset_nondeterministic_tests \ + file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \ + file://use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch \ + file://avoid-neon-for-targets-which-don-t-support-it.patch \ + file://valgrind-make-ld-XXX.so-strlen-intercept-optional.patch \ + file://0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch \ + file://0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch \ + file://0003-correct-include-directive-path-for-config.h.patch \ + file://0001-Return-a-valid-exit_code-from-vg_regtest.patch \ + file://0001-valgrind-filter_xml_frames-do-not-filter-usr.patch \ + file://0001-memcheck-vgtests-remove-fullpath-after-flags.patch \ + file://s390x_vec_op_t.patch \ + file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \ + file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ + file://0001-docs-Disable-manual-validation.patch \ + " +SRC_URI[sha256sum] = "c811db5add2c5f729944caf47c4e7a65dcaabb9461e472b578765dd7bf6d2d4c" +UPSTREAM_CHECK_REGEX = "valgrind-(?P\d+(\.\d+)+)\.tar" + +COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux' + +# patch 0001-memcheck-vgtests-remove-fullpath-after-flags.patch removes relative path +# argument. Change expected stderr files accordingly. +do_patch:append() { + bb.build.exec_func('do_sed_paths', d) +} + +do_sed_paths() { + sed -i -e 's|tests/||' ${S}/memcheck/tests/badfree3.stderr.exp + sed -i -e 's|tests/||' ${S}/memcheck/tests/varinfo5.stderr.exp +} + +# valgrind supports armv7 and above +COMPATIBLE_HOST:armv4 = 'null' +COMPATIBLE_HOST:armv5 = 'null' +COMPATIBLE_HOST:armv6 = 'null' + +# valgrind fails with powerpc soft-float +COMPATIBLE_HOST:powerpc = "${@bb.utils.contains('TARGET_FPU', 'soft', 'null', '.*-linux', d)}" + +# X32 isn't supported by valgrind at this time +COMPATIBLE_HOST:linux-gnux32 = 'null' +COMPATIBLE_HOST:linux-muslx32 = 'null' + +# Disable for some MIPS variants +COMPATIBLE_HOST:mipsarchr6 = 'null' +COMPATIBLE_HOST:linux-gnun32 = 'null' + +# Disable for powerpc64 with musl +COMPATIBLE_HOST:libc-musl:powerpc64 = 'null' + +# brokenseip is unfortunately required by ptests to pass +inherit autotools-brokensep ptest multilib_header + +EXTRA_OECONF = "--enable-tls --without-mpicc" +EXTRA_OECONF += "${@['--enable-only32bit','--enable-only64bit'][d.getVar('SITEINFO_BITS') != '32']}" + +# valgrind checks host_cpu "armv7*)", so we need to over-ride the autotools.bbclass default --host option +EXTRA_OECONF:append:arm = " --host=armv7${HOST_VENDOR}-${HOST_OS}" + +EXTRA_OEMAKE = "-w" + +CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" + +# valgrind likes to control its own optimisation flags. It generally defaults +# to -O2 but uses -O0 for some specific test apps etc. Passing our own flags +# (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it +# which fixes build path issue in DWARF. +SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}" + +# Split out various helper scripts to separate packages to avoid the +# main package depending on perl and python. +PACKAGES =+ "${PN}-cachegrind ${PN}-massif ${PN}-callgrind" + +FILES:${PN}-cachegrind = "${bindir}/cg_*" +FILES:${PN}-massif = "${bindir}/ms_*" +FILES:${PN}-callgrind = "${bindir}/callgrind_*" + +RDEPENDS:${PN}-cachegrind = "${PN} python3-core" +RDEPENDS:${PN}-massif = "${PN} perl" +RDEPENDS:${PN}-callgrind = "${PN} perl" + +do_configure:prepend () { + rm -rf ${S}/config.h + sed -i -e 's:$(abs_top_builddir):$(pkglibdir)/ptest:g' ${S}/none/tests/Makefile.am + sed -i -e 's:$(top_builddir):$(pkglibdir)/ptest:g' ${S}/memcheck/tests/Makefile.am +} + +do_install:append () { + install -m 644 ${B}/default.supp ${D}/${libexecdir}/valgrind/ + oe_multilib_header valgrind/config.h +} + +VALGRINDARCH ?= "${TARGET_ARCH}" +VALGRINDARCH:aarch64 = "arm64" +VALGRINDARCH:x86-64 = "amd64" +VALGRINDARCH:x86 = "x86" +VALGRINDARCH:mips = "mips32" +VALGRINDARCH:mipsel = "mips32" +VALGRINDARCH:mips64el = "mips64" +VALGRINDARCH:powerpc = "ppc" +VALGRINDARCH:powerpc64 = "ppc64" +VALGRINDARCH:powerpc64le = "ppc64le" + +INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${libexecdir}/valgrind/vgpreload_memcheck-${VALGRINDARCH}-linux.so" + +# valgrind needs debug information for ld.so at runtime in order to +# redirect functions like strlen. +RRECOMMENDS:${PN} += "${TCLIBC}-dbg" + +RDEPENDS:${PN}-ptest += " bash coreutils curl file \ + gdb libgomp \ + perl \ + perl-module-file-basename perl-module-file-glob perl-module-getopt-long \ + perl-module-overloading perl-module-cwd perl-module-ipc-open3 \ + perl-module-carp perl-module-symbol \ + procps sed ${PN}-dbg ${PN}-src ${TCLIBC}-src gcc-runtime-dbg \ + util-linux-taskset \ + ${PN}-cachegrind ${PN}-massif ${PN}-callgrind \ +" +RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-gconv-utf-32" + +# One of the tests contains a bogus interpreter path on purpose. +# Skip file dependency check +SKIP_FILEDEPS:${PN}-ptest = '1' +INSANE_SKIP:${PN}-ptest = "debug-deps" + +do_compile_ptest() { + oe_runmake check +} + + +do_install_ptest() { + chmod +x ${B}/tests/vg_regtest + + # The test application binaries are not automatically installed. + # Grab them from the build directory. + # + # The regression tests require scripts and data files that are not + # copied to the build directory. They must be copied from the + # source directory. + saved_dir=$PWD + for parent_dir in ${S} ${B} ; do + cd $parent_dir + + subdirs=" \ + .in_place \ + cachegrind/tests \ + callgrind/tests \ + dhat/tests \ + drd/tests \ + gdbserver_tests \ + helgrind/tests \ + lackey/tests \ + massif/tests \ + memcheck/tests \ + none/tests \ + tests \ + exp-bbv/tests \ + " + # Get the vg test scripts, filters, and expected files + for dir in $subdirs ; do + find $dir | cpio -pvdu ${D}${PTEST_PATH} + done + cd $saved_dir + done + + # The scripts reference config.h so add it to the top ptest dir. + cp ${B}/config.h ${D}${PTEST_PATH} + install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} + install -D ${WORKDIR}/remove-for-all ${D}${PTEST_PATH} + install -D ${WORKDIR}/taskset_nondeterministic_tests ${D}${PTEST_PATH} + + # Add an executable need by none/tests/bigcode + mkdir ${D}${PTEST_PATH}/perf + cp ${B}/perf/bigcode ${D}${PTEST_PATH}/perf + + # Add an executable needed by memcheck/tests/vcpu_bz2 + cp ${B}/perf/bz2 ${D}${PTEST_PATH}/perf + + # Make the ptest dir look like the top level valgrind src dir + # This is checked by the gdbserver_tests/make_local_links script + mkdir ${D}${PTEST_PATH}/coregrind + cp ${B}/coregrind/vgdb ${D}${PTEST_PATH}/coregrind + + # Add an executable needed by massif tests + cp ${B}/massif/ms_print ${D}${PTEST_PATH}/massif/ms_print + + find ${D}${PTEST_PATH} \ + \( \ + -name "Makefile*" \ + -o -name "*.o" \ + \) \ + -exec rm {} \; + + sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann1.vgtest + sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann2.vgtest + + # point the expanded @abs_top_builddir@ of the host to PTEST_PATH + sed -i s:${S}:${PTEST_PATH}:g \ + ${D}${PTEST_PATH}/memcheck/tests/linux/debuginfod-check.vgtest + + # handle multilib + sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest + sed -i s:@libexecdir@:${libexecdir}:g ${D}${PTEST_PATH}/run-ptest + sed -i s:@bindir@:${bindir}:g ${D}${PTEST_PATH}/run-ptest + + # This test fails on the host as well, using both 3.15 and git master (as of Jan 24 2020) + # https://bugs.kde.org/show_bug.cgi?id=402833 + rm ${D}${PTEST_PATH}/memcheck/tests/overlap.vgtest + + # This is known failure see https://bugs.kde.org/show_bug.cgi?id=435732 + rm ${D}${PTEST_PATH}/memcheck/tests/leak_cpp_interior.vgtest + + # https://bugs.kde.org/show_bug.cgi?id=445743 + rm ${D}${PTEST_PATH}/drd/tests/pth_mutex_signal + + # As the binary isn't stripped or debug-splitted, the source file isn't fetched + # via dwarfsrcfiles either, so it needs to be installed manually. + mkdir -p ${D}${TARGET_DBGSRC_DIR}/none/tests/ + install ${S}/none/tests/tls.c ${D}${TARGET_DBGSRC_DIR}/none/tests/ +} + +do_install_ptest:append:x86-64 () { + # https://bugs.kde.org/show_bug.cgi?id=463456 + rm ${D}${PTEST_PATH}/memcheck/tests/origin6-fp.vgtest + # https://bugs.kde.org/show_bug.cgi?id=463458 + rm ${D}${PTEST_PATH}/memcheck/tests/vcpu_fnfns.vgtest + # https://bugs.kde.org/show_bug.cgi?id=463463 + rm ${D}${PTEST_PATH}/none/tests/amd64/fma.vgtest +} + +# avoid stripping some generated binaries otherwise some of the tests will fail +# run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail +INHIBIT_PACKAGE_STRIP_FILES += "\ + ${PKGD}${PTEST_PATH}/none/tests/tls \ + ${PKGD}${PTEST_PATH}/none/tests/tls.so \ + ${PKGD}${PTEST_PATH}/none/tests/tls2.so \ + ${PKGD}${PTEST_PATH}/helgrind/tests/tc09_bad_unlock \ + ${PKGD}${PTEST_PATH}/memcheck/tests/manuel1 \ + ${PKGD}${PTEST_PATH}/drd/tests/pth_detached3 \ +" -- cgit v1.2.3-54-g00ecf