Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 1 | SUMMARY = "Valgrind memory debugger and instrumentation framework" |
| 2 | HOMEPAGE = "http://valgrind.org/" |
| 3 | 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." |
| 4 | BUGTRACKER = "http://valgrind.org/support/bug_reports.html" |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 5 | LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ |
| 7 | file://include/pub_tool_basics.h;beginline=6;endline=29;md5=41c410e8d3f305aee7aaa666b2e4f366 \ |
| 8 | file://include/valgrind.h;beginline=1;endline=56;md5=ad3b317f3286b6b704575d9efe6ca5df \ |
| 9 | file://COPYING.DOCS;md5=24ea4c7092233849b4394699333b5c56" |
| 10 | |
| 11 | DEPENDS = " \ |
| 12 | ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'boost', '', d)} \ |
| 13 | " |
| 14 | |
| 15 | SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \ |
| 16 | file://fixed-perl-path.patch \ |
| 17 | file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch \ |
| 18 | file://run-ptest \ |
| 19 | file://remove-for-aarch64 \ |
| 20 | file://remove-for-all \ |
| 21 | file://taskset_nondeterministic_tests \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 22 | file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 23 | file://use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch \ |
| 24 | file://avoid-neon-for-targets-which-don-t-support-it.patch \ |
| 25 | file://valgrind-make-ld-XXX.so-strlen-intercept-optional.patch \ |
| 26 | file://0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 27 | file://0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch \ |
| 28 | file://0002-context-APIs-are-not-available-on-musl.patch \ |
| 29 | file://0003-correct-include-directive-path-for-config.h.patch \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 30 | file://0001-fix-opcode-not-supported-on-mips32-linux.patch \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 31 | file://0001-Make-local-functions-static-to-avoid-assembler-error.patch \ |
| 32 | file://0001-Return-a-valid-exit_code-from-vg_regtest.patch \ |
| 33 | file://0001-valgrind-filter_xml_frames-do-not-filter-usr.patch \ |
| 34 | file://0001-memcheck-vgtests-remove-fullpath-after-flags.patch \ |
| 35 | file://s390x_vec_op_t.patch \ |
| 36 | file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \ |
| 37 | file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 38 | file://0001-docs-Disable-manual-validation.patch \ |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 39 | file://0001-none-tests-x86-linux-seg_override.c-add-missing-incl.patch \ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 40 | " |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 41 | SRC_URI[sha256sum] = "10ce1618bb3e33fad16eb79552b0a3e1211762448a0d7fce11c8a6243b9ac971" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 42 | UPSTREAM_CHECK_REGEX = "valgrind-(?P<pver>\d+(\.\d+)+)\.tar" |
| 43 | |
| 44 | COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux' |
| 45 | |
| 46 | # patch 0001-memcheck-vgtests-remove-fullpath-after-flags.patch removes relative path |
| 47 | # argument. Change expected stderr files accordingly. |
| 48 | do_patch:append() { |
| 49 | bb.build.exec_func('do_sed_paths', d) |
| 50 | } |
| 51 | |
| 52 | do_sed_paths() { |
| 53 | sed -i -e 's|tests/||' ${S}/memcheck/tests/badfree3.stderr.exp |
| 54 | sed -i -e 's|tests/||' ${S}/memcheck/tests/varinfo5.stderr.exp |
| 55 | } |
| 56 | |
| 57 | # valgrind supports armv7 and above |
| 58 | COMPATIBLE_HOST:armv4 = 'null' |
| 59 | COMPATIBLE_HOST:armv5 = 'null' |
| 60 | COMPATIBLE_HOST:armv6 = 'null' |
| 61 | |
| 62 | # valgrind fails with powerpc soft-float |
| 63 | COMPATIBLE_HOST:powerpc = "${@bb.utils.contains('TARGET_FPU', 'soft', 'null', '.*-linux', d)}" |
| 64 | |
| 65 | # X32 isn't supported by valgrind at this time |
| 66 | COMPATIBLE_HOST:linux-gnux32 = 'null' |
| 67 | COMPATIBLE_HOST:linux-muslx32 = 'null' |
| 68 | |
| 69 | # Disable for some MIPS variants |
| 70 | COMPATIBLE_HOST:mipsarchr6 = 'null' |
| 71 | COMPATIBLE_HOST:linux-gnun32 = 'null' |
| 72 | |
| 73 | # Disable for powerpc64 with musl |
| 74 | COMPATIBLE_HOST:libc-musl:powerpc64 = 'null' |
| 75 | |
| 76 | # brokenseip is unfortunately required by ptests to pass |
| 77 | inherit autotools-brokensep ptest multilib_header |
| 78 | |
| 79 | EXTRA_OECONF = "--enable-tls --without-mpicc" |
| 80 | EXTRA_OECONF += "${@['--enable-only32bit','--enable-only64bit'][d.getVar('SITEINFO_BITS') != '32']}" |
| 81 | |
| 82 | # valgrind checks host_cpu "armv7*)", so we need to over-ride the autotools.bbclass default --host option |
| 83 | EXTRA_OECONF:append:arm = " --host=armv7${HOST_VENDOR}-${HOST_OS}" |
| 84 | |
| 85 | EXTRA_OEMAKE = "-w" |
| 86 | |
| 87 | CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" |
| 88 | |
| 89 | # valgrind likes to control its own optimisation flags. It generally defaults |
| 90 | # to -O2 but uses -O0 for some specific test apps etc. Passing our own flags |
| 91 | # (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it |
| 92 | # which fixes build path issue in DWARF. |
| 93 | SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}" |
| 94 | |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 95 | # Split out various helper scripts to separate packages to avoid the |
| 96 | # main package depending on perl and python. |
| 97 | PACKAGES =+ "${PN}-cachegrind ${PN}-massif ${PN}-callgrind" |
| 98 | |
| 99 | FILES:${PN}-cachegrind = "${bindir}/cg_*" |
| 100 | FILES:${PN}-massif = "${bindir}/ms_*" |
| 101 | FILES:${PN}-callgrind = "${bindir}/callgrind_*" |
| 102 | |
| 103 | RDEPENDS:${PN}-cachegrind = "${PN} python3-core" |
| 104 | RDEPENDS:${PN}-massif = "${PN} perl" |
| 105 | RDEPENDS:${PN}-callgrind = "${PN} perl" |
| 106 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 107 | do_configure:prepend () { |
| 108 | rm -rf ${S}/config.h |
| 109 | sed -i -e 's:$(abs_top_builddir):$(pkglibdir)/ptest:g' ${S}/none/tests/Makefile.am |
| 110 | sed -i -e 's:$(top_builddir):$(pkglibdir)/ptest:g' ${S}/memcheck/tests/Makefile.am |
| 111 | } |
| 112 | |
| 113 | do_install:append () { |
| 114 | install -m 644 ${B}/default.supp ${D}/${libexecdir}/valgrind/ |
| 115 | oe_multilib_header valgrind/config.h |
| 116 | } |
| 117 | |
| 118 | VALGRINDARCH ?= "${TARGET_ARCH}" |
| 119 | VALGRINDARCH:aarch64 = "arm64" |
| 120 | VALGRINDARCH:x86-64 = "amd64" |
| 121 | VALGRINDARCH:x86 = "x86" |
| 122 | VALGRINDARCH:mips = "mips32" |
| 123 | VALGRINDARCH:mipsel = "mips32" |
| 124 | VALGRINDARCH:mips64el = "mips64" |
| 125 | VALGRINDARCH:powerpc = "ppc" |
| 126 | VALGRINDARCH:powerpc64 = "ppc64" |
| 127 | VALGRINDARCH:powerpc64le = "ppc64le" |
| 128 | |
| 129 | INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${libexecdir}/valgrind/vgpreload_memcheck-${VALGRINDARCH}-linux.so" |
| 130 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 131 | # valgrind needs debug information for ld.so at runtime in order to |
| 132 | # redirect functions like strlen. |
| 133 | RRECOMMENDS:${PN} += "${TCLIBC}-dbg" |
| 134 | |
| 135 | RDEPENDS:${PN}-ptest += " bash coreutils curl file \ |
| 136 | gdb libgomp \ |
| 137 | perl \ |
| 138 | perl-module-file-basename perl-module-file-glob perl-module-getopt-long \ |
| 139 | perl-module-overloading perl-module-cwd perl-module-ipc-open3 \ |
| 140 | perl-module-carp perl-module-symbol \ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 141 | procps sed ${PN}-dbg ${PN}-src ${TCLIBC}-src gcc-runtime-dbg \ |
| 142 | util-linux-taskset" |
Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 143 | RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils glibc-gconv-utf-32" |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 144 | |
| 145 | # One of the tests contains a bogus interpreter path on purpose. |
| 146 | # Skip file dependency check |
| 147 | SKIP_FILEDEPS:${PN}-ptest = '1' |
| 148 | INSANE_SKIP:${PN}-ptest = "debug-deps" |
| 149 | |
| 150 | do_compile_ptest() { |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 151 | oe_runmake check |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 152 | } |
| 153 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 154 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 155 | do_install_ptest() { |
| 156 | chmod +x ${B}/tests/vg_regtest |
| 157 | |
| 158 | # The test application binaries are not automatically installed. |
| 159 | # Grab them from the build directory. |
| 160 | # |
| 161 | # The regression tests require scripts and data files that are not |
| 162 | # copied to the build directory. They must be copied from the |
| 163 | # source directory. |
| 164 | saved_dir=$PWD |
| 165 | for parent_dir in ${S} ${B} ; do |
| 166 | cd $parent_dir |
| 167 | |
| 168 | subdirs=" \ |
| 169 | .in_place \ |
| 170 | cachegrind/tests \ |
| 171 | callgrind/tests \ |
| 172 | dhat/tests \ |
| 173 | drd/tests \ |
| 174 | gdbserver_tests \ |
| 175 | helgrind/tests \ |
| 176 | lackey/tests \ |
| 177 | massif/tests \ |
| 178 | memcheck/tests \ |
| 179 | none/tests \ |
| 180 | tests \ |
| 181 | exp-bbv/tests \ |
| 182 | " |
| 183 | # Get the vg test scripts, filters, and expected files |
| 184 | for dir in $subdirs ; do |
| 185 | find $dir | cpio -pvdu ${D}${PTEST_PATH} |
| 186 | done |
| 187 | cd $saved_dir |
| 188 | done |
| 189 | |
| 190 | # The scripts reference config.h so add it to the top ptest dir. |
| 191 | cp ${B}/config.h ${D}${PTEST_PATH} |
| 192 | install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} |
| 193 | install -D ${WORKDIR}/remove-for-all ${D}${PTEST_PATH} |
| 194 | install -D ${WORKDIR}/taskset_nondeterministic_tests ${D}${PTEST_PATH} |
| 195 | |
| 196 | # Add an executable need by none/tests/bigcode |
| 197 | mkdir ${D}${PTEST_PATH}/perf |
| 198 | cp ${B}/perf/bigcode ${D}${PTEST_PATH}/perf |
| 199 | |
| 200 | # Add an executable needed by memcheck/tests/vcpu_bz2 |
| 201 | cp ${B}/perf/bz2 ${D}${PTEST_PATH}/perf |
| 202 | |
| 203 | # Make the ptest dir look like the top level valgrind src dir |
| 204 | # This is checked by the gdbserver_tests/make_local_links script |
| 205 | mkdir ${D}${PTEST_PATH}/coregrind |
| 206 | cp ${B}/coregrind/vgdb ${D}${PTEST_PATH}/coregrind |
| 207 | |
| 208 | # Add an executable needed by massif tests |
| 209 | cp ${B}/massif/ms_print ${D}${PTEST_PATH}/massif/ms_print |
| 210 | |
| 211 | find ${D}${PTEST_PATH} \ |
| 212 | \( \ |
| 213 | -name "Makefile*" \ |
| 214 | -o -name "*.o" \ |
| 215 | \) \ |
| 216 | -exec rm {} \; |
| 217 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 218 | sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann1.vgtest |
| 219 | sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann2.vgtest |
| 220 | |
| 221 | # point the expanded @abs_top_builddir@ of the host to PTEST_PATH |
| 222 | sed -i s:${S}:${PTEST_PATH}:g \ |
| 223 | ${D}${PTEST_PATH}/memcheck/tests/linux/debuginfod-check.vgtest |
| 224 | |
| 225 | # handle multilib |
| 226 | sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest |
| 227 | sed -i s:@libexecdir@:${libexecdir}:g ${D}${PTEST_PATH}/run-ptest |
| 228 | sed -i s:@bindir@:${bindir}:g ${D}${PTEST_PATH}/run-ptest |
| 229 | |
| 230 | # This test fails on the host as well, using both 3.15 and git master (as of Jan 24 2020) |
| 231 | # https://bugs.kde.org/show_bug.cgi?id=402833 |
| 232 | rm ${D}${PTEST_PATH}/memcheck/tests/overlap.vgtest |
| 233 | |
| 234 | # This is known failure see https://bugs.kde.org/show_bug.cgi?id=435732 |
| 235 | rm ${D}${PTEST_PATH}/memcheck/tests/leak_cpp_interior.vgtest |
| 236 | |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 237 | # https://bugs.kde.org/show_bug.cgi?id=445743 |
| 238 | rm ${D}${PTEST_PATH}/drd/tests/pth_mutex_signal |
| 239 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 240 | # As the binary isn't stripped or debug-splitted, the source file isn't fetched |
| 241 | # via dwarfsrcfiles either, so it needs to be installed manually. |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 242 | mkdir -p ${D}${TARGET_DBGSRC_DIR}/none/tests/ |
| 243 | install ${S}/none/tests/tls.c ${D}${TARGET_DBGSRC_DIR}/none/tests/ |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 244 | } |
| 245 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 246 | do_install_ptest:append:x86-64 () { |
| 247 | # https://bugs.kde.org/show_bug.cgi?id=463456 |
| 248 | rm ${D}${PTEST_PATH}/memcheck/tests/origin6-fp.vgtest |
| 249 | # https://bugs.kde.org/show_bug.cgi?id=463458 |
| 250 | rm ${D}${PTEST_PATH}/memcheck/tests/vcpu_fnfns.vgtest |
| 251 | # https://bugs.kde.org/show_bug.cgi?id=463463 |
| 252 | rm ${D}${PTEST_PATH}/none/tests/amd64/fma.vgtest |
| 253 | } |
| 254 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 255 | # avoid stripping some generated binaries otherwise some of the tests will fail |
| 256 | # run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail |
| 257 | INHIBIT_PACKAGE_STRIP_FILES += "\ |
| 258 | ${PKGD}${PTEST_PATH}/none/tests/tls \ |
| 259 | ${PKGD}${PTEST_PATH}/none/tests/tls.so \ |
| 260 | ${PKGD}${PTEST_PATH}/none/tests/tls2.so \ |
| 261 | ${PKGD}${PTEST_PATH}/helgrind/tests/tc09_bad_unlock \ |
| 262 | ${PKGD}${PTEST_PATH}/memcheck/tests/manuel1 \ |
| 263 | ${PKGD}${PTEST_PATH}/drd/tests/pth_detached3 \ |
| 264 | " |