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