Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | SUMMARY = "Valgrind memory debugger and instrumentation framework" |
| 2 | HOMEPAGE = "http://valgrind.org/" |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 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." |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 4 | BUGTRACKER = "http://valgrind.org/support/bug_reports.html" |
| 5 | LICENSE = "GPLv2 & GPLv2+ & BSD" |
| 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ |
Andrew Geissler | 4ed12e1 | 2020-06-05 18:00:41 -0500 | [diff] [blame] | 7 | file://include/pub_tool_basics.h;beginline=6;endline=29;md5=41c410e8d3f305aee7aaa666b2e4f366 \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 8 | file://include/valgrind.h;beginline=1;endline=56;md5=ad3b317f3286b6b704575d9efe6ca5df \ |
| 9 | file://COPYING.DOCS;md5=24ea4c7092233849b4394699333b5c56" |
| 10 | |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 11 | DEPENDS = " \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 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 \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 19 | file://remove-for-aarch64 \ |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 20 | file://remove-for-all \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 21 | file://0004-Fix-out-of-tree-builds.patch \ |
| 22 | file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \ |
| 23 | file://0001-Remove-tests-that-fail-to-build-on-some-PPC32-config.patch \ |
| 24 | file://use-appropriate-march-mcpu-mfpu-for-ARM-test-apps.patch \ |
| 25 | file://avoid-neon-for-targets-which-don-t-support-it.patch \ |
| 26 | file://valgrind-make-ld-XXX.so-strlen-intercept-optional.patch \ |
| 27 | file://0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch \ |
| 28 | file://0001-str_tester.c-Limit-rawmemchr-test-to-glibc.patch \ |
| 29 | file://0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch \ |
| 30 | file://0002-context-APIs-are-not-available-on-musl.patch \ |
| 31 | file://0003-correct-include-directive-path-for-config.h.patch \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 32 | file://0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-musl.patch \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 33 | file://0001-memcheck-arm64-Define-__THROW-if-not-already-defined.patch \ |
| 34 | file://0002-memcheck-x86-Define-__THROW-if-not-defined.patch \ |
| 35 | file://0003-tests-seg_override-Replace-__modify_ldt-with-syscall.patch \ |
| 36 | file://0001-fix-opcode-not-supported-on-mips32-linux.patch \ |
| 37 | file://0001-Guard-against-__GLIBC_PREREQ-for-musl-libc.patch \ |
| 38 | file://0001-Make-local-functions-static-to-avoid-assembler-error.patch \ |
| 39 | file://0001-Return-a-valid-exit_code-from-vg_regtest.patch \ |
| 40 | file://0001-valgrind-filter_xml_frames-do-not-filter-usr.patch \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 41 | file://0001-memcheck-vgtests-remove-fullpath-after-flags.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 42 | file://s390x_vec_op_t.patch \ |
| 43 | file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 44 | file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 45 | file://0001-drd-Port-to-Fedora-33.patch \ |
| 46 | file://0001-drd-musl-fix.patch \ |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 47 | file://0001-helgrind-Intercept-libc-functions.patch \ |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 48 | file://0001-Fix-nlcontrolc.vgtest-hanging-on-newer-glibc-and-or-.patch \ |
| 49 | file://0001-lmw-lswi-and-related-PowerPC-insns-aren-t-allowed-on.patch \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 50 | " |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 51 | SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589" |
| 52 | SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 53 | UPSTREAM_CHECK_REGEX = "valgrind-(?P<pver>\d+(\.\d+)+)\.tar" |
| 54 | |
| 55 | COMPATIBLE_HOST = '(i.86|x86_64|arm|aarch64|mips|powerpc|powerpc64).*-linux' |
| 56 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 57 | # patch 0001-memcheck-vgtests-remove-fullpath-after-flags.patch removes relative path |
| 58 | # argument. Change expected stderr files accordingly. |
| 59 | do_patch_append() { |
| 60 | bb.build.exec_func('do_sed_paths', d) |
| 61 | } |
| 62 | |
| 63 | do_sed_paths() { |
| 64 | sed -i -e 's|tests/||' ${S}/memcheck/tests/badfree3.stderr.exp |
| 65 | sed -i -e 's|tests/||' ${S}/memcheck/tests/varinfo5.stderr.exp |
| 66 | } |
| 67 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 68 | # valgrind supports armv7 and above |
| 69 | COMPATIBLE_HOST_armv4 = 'null' |
| 70 | COMPATIBLE_HOST_armv5 = 'null' |
| 71 | COMPATIBLE_HOST_armv6 = 'null' |
| 72 | |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 73 | # valgrind fails with powerpc soft-float |
| 74 | COMPATIBLE_HOST_powerpc = "${@bb.utils.contains('TARGET_FPU', 'soft', 'null', '.*-linux', d)}" |
| 75 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 76 | # X32 isn't supported by valgrind at this time |
| 77 | COMPATIBLE_HOST_linux-gnux32 = 'null' |
| 78 | COMPATIBLE_HOST_linux-muslx32 = 'null' |
| 79 | |
| 80 | # Disable for some MIPS variants |
| 81 | COMPATIBLE_HOST_mipsarchr6 = 'null' |
| 82 | COMPATIBLE_HOST_linux-gnun32 = 'null' |
| 83 | |
| 84 | # Disable for powerpc64 with musl |
| 85 | COMPATIBLE_HOST_libc-musl_powerpc64 = 'null' |
| 86 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 87 | # brokenseip is unfortunately required by ptests to pass |
| 88 | inherit autotools-brokensep ptest multilib_header |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 89 | |
| 90 | EXTRA_OECONF = "--enable-tls --without-mpicc" |
| 91 | EXTRA_OECONF += "${@['--enable-only32bit','--enable-only64bit'][d.getVar('SITEINFO_BITS') != '32']}" |
| 92 | |
| 93 | # valgrind checks host_cpu "armv7*)", so we need to over-ride the autotools.bbclass default --host option |
| 94 | EXTRA_OECONF_append_arm = " --host=armv7${HOST_VENDOR}-${HOST_OS}" |
| 95 | |
| 96 | EXTRA_OEMAKE = "-w" |
| 97 | |
| 98 | CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" |
| 99 | |
| 100 | # valgrind likes to control its own optimisation flags. It generally defaults |
| 101 | # to -O2 but uses -O0 for some specific test apps etc. Passing our own flags |
| 102 | # (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it |
| 103 | # which fixes build path issue in DWARF. |
| 104 | SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}" |
| 105 | |
| 106 | do_configure_prepend () { |
| 107 | rm -rf ${S}/config.h |
| 108 | sed -i -e 's:$(abs_top_builddir):$(pkglibdir)/ptest:g' ${S}/none/tests/Makefile.am |
| 109 | sed -i -e 's:$(top_builddir):$(pkglibdir)/ptest:g' ${S}/memcheck/tests/Makefile.am |
| 110 | } |
| 111 | |
| 112 | do_install_append () { |
| 113 | install -m 644 ${B}/default.supp ${D}/${libdir}/valgrind/ |
| 114 | oe_multilib_header valgrind/config.h |
| 115 | } |
| 116 | |
| 117 | VALGRINDARCH ?= "${TARGET_ARCH}" |
| 118 | VALGRINDARCH_aarch64 = "arm64" |
| 119 | VALGRINDARCH_x86-64 = "amd64" |
| 120 | VALGRINDARCH_x86 = "x86" |
| 121 | VALGRINDARCH_mips = "mips32" |
| 122 | VALGRINDARCH_mipsel = "mips32" |
| 123 | VALGRINDARCH_mips64el = "mips64" |
| 124 | VALGRINDARCH_powerpc = "ppc" |
| 125 | VALGRINDARCH_powerpc64 = "ppc64" |
| 126 | VALGRINDARCH_powerpc64el = "ppc64le" |
| 127 | |
| 128 | INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${libdir}/valgrind/vgpreload_memcheck-${VALGRINDARCH}-linux.so" |
| 129 | |
| 130 | RDEPENDS_${PN} += "perl" |
| 131 | |
| 132 | # valgrind needs debug information for ld.so at runtime in order to |
| 133 | # redirect functions like strlen. |
| 134 | RRECOMMENDS_${PN} += "${TCLIBC}-dbg" |
| 135 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 136 | RDEPENDS_${PN}-ptest += " bash coreutils file \ |
| 137 | gdb libgomp \ |
| 138 | perl \ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 139 | perl-module-file-basename perl-module-file-glob perl-module-getopt-long \ |
| 140 | perl-module-overloading \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 141 | procps sed ${PN}-dbg ${PN}-src" |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 142 | RDEPENDS_${PN}-ptest_append_libc-glibc = " glibc-utils" |
| 143 | |
| 144 | # One of the tests contains a bogus interpreter path on purpose. |
| 145 | # Skip file dependency check |
| 146 | SKIP_FILEDEPS_${PN}-ptest = '1' |
| 147 | INSANE_SKIP_${PN}-ptest = "debug-deps" |
| 148 | |
| 149 | do_compile_ptest() { |
| 150 | oe_runmake check |
| 151 | } |
| 152 | |
| 153 | do_install_ptest() { |
| 154 | chmod +x ${B}/tests/vg_regtest |
| 155 | |
| 156 | # The test application binaries are not automatically installed. |
| 157 | # Grab them from the build directory. |
| 158 | # |
| 159 | # The regression tests require scripts and data files that are not |
| 160 | # copied to the build directory. They must be copied from the |
| 161 | # source directory. |
| 162 | saved_dir=$PWD |
| 163 | for parent_dir in ${S} ${B} ; do |
| 164 | cd $parent_dir |
| 165 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 166 | subdirs=" \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 167 | .in_place \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 168 | cachegrind/tests \ |
| 169 | callgrind/tests \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 170 | dhat/tests \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 171 | drd/tests \ |
| 172 | gdbserver_tests \ |
| 173 | helgrind/tests \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 174 | lackey/tests \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 175 | massif/tests \ |
| 176 | memcheck/tests \ |
| 177 | none/tests \ |
| 178 | tests \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 179 | exp-bbv/tests \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 180 | " |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 181 | # Get the vg test scripts, filters, and expected files |
| 182 | for dir in $subdirs ; do |
| 183 | find $dir | cpio -pvdu ${D}${PTEST_PATH} |
| 184 | done |
| 185 | cd $saved_dir |
| 186 | done |
| 187 | |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 188 | # The scripts reference config.h so add it to the top ptest dir. |
| 189 | cp ${B}/config.h ${D}${PTEST_PATH} |
| 190 | install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 191 | install -D ${WORKDIR}/remove-for-all ${D}${PTEST_PATH} |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 192 | |
| 193 | # Add an executable need by none/tests/bigcode |
| 194 | mkdir ${D}${PTEST_PATH}/perf |
| 195 | cp ${B}/perf/bigcode ${D}${PTEST_PATH}/perf |
| 196 | |
| 197 | # Add an executable needed by memcheck/tests/vcpu_bz2 |
| 198 | cp ${B}/perf/bz2 ${D}${PTEST_PATH}/perf |
| 199 | |
| 200 | # Make the ptest dir look like the top level valgrind src dir |
| 201 | # This is checked by the gdbserver_tests/make_local_links script |
| 202 | mkdir ${D}${PTEST_PATH}/coregrind |
| 203 | cp ${B}/coregrind/vgdb ${D}${PTEST_PATH}/coregrind |
| 204 | |
| 205 | # Add an executable needed by massif tests |
| 206 | cp ${B}/massif/ms_print ${D}${PTEST_PATH}/massif/ms_print |
| 207 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 208 | find ${D}${PTEST_PATH} \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 209 | \( \ |
| 210 | -name "Makefile*" \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 211 | -o -name "*.o" \ |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 212 | \) \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 213 | -exec rm {} \; |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 214 | |
| 215 | # These files need to be newer so touch them. |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 216 | touch ${D}${PTEST_PATH}/cachegrind/tests/a.c -r ${D}${PTEST_PATH}/cachegrind/tests/cgout-test |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 217 | |
| 218 | # find *_annotate in ${bindir} for yocto build |
| 219 | sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann1.vgtest |
| 220 | sed -i s:\.\./\.\./cachegrind/cg_annotate:${bindir}/cg_annotate: ${D}${PTEST_PATH}/cachegrind/tests/ann2.vgtest |
| 221 | |
| 222 | sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann1.vgtest |
| 223 | sed -i s:\.\./\.\./callgrind/callgrind_annotate:${bindir}/callgrind_annotate: ${D}${PTEST_PATH}/callgrind/tests/ann2.vgtest |
| 224 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 225 | # handle multilib |
| 226 | sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 227 | sed -i s:@bindir@:${bindir}:g ${D}${PTEST_PATH}/run-ptest |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 228 | |
| 229 | # This test fails on the host as well, using both 3.15 and git master (as of Jan 24 2020) |
| 230 | # https://bugs.kde.org/show_bug.cgi?id=402833 |
| 231 | rm ${D}${PTEST_PATH}/memcheck/tests/overlap.vgtest |
| 232 | |
| 233 | # As the binary isn't stripped or debug-splitted, the source file isn't fetched |
| 234 | # via dwarfsrcfiles either, so it needs to be installed manually. |
| 235 | mkdir -p ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/${BP}/none/tests/ |
| 236 | install ${S}/none/tests/tls.c ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/${BP}/none/tests/ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 237 | } |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 238 | |
| 239 | # avoid stripping some generated binaries otherwise some of the tests will fail |
| 240 | # run-strip-reloc.sh, run-strip-strmerge.sh and so on will fail |
| 241 | INHIBIT_PACKAGE_STRIP_FILES = "\ |
| 242 | ${PKGD}${PTEST_PATH}/none/tests/tls \ |
| 243 | ${PKGD}${PTEST_PATH}/none/tests/tls.so \ |
| 244 | ${PKGD}${PTEST_PATH}/none/tests/tls2.so \ |
| 245 | ${PKGD}${PTEST_PATH}/helgrind/tests/tc09_bad_unlock \ |
| 246 | ${PKGD}${PTEST_PATH}/memcheck/tests/manuel1 \ |
| 247 | ${PKGD}${PTEST_PATH}/drd/tests/pth_detached3 \ |
| 248 | " |