valgrind_3.16.1.bb 9.7 KB

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