summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-06-12 07:59:05 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-13 10:46:34 +0100
commit98a967d10d11dd3d086604c822385a71b21031f9 (patch)
tree2f81f250edf796c854d1ed7de8a967d58ed86410 /meta/recipes-devtools
parent93ddbfd17ddcfb94d3dda9d68dab1e58ea618860 (diff)
downloadpoky-98a967d10d11dd3d086604c822385a71b21031f9.tar.gz
valgrind: Fix ptest build with musl
musl unearthed a problem when building out of tree, config.h was being used from $(srcdir) instead of generated config.h in $(builddir) this assumed functions e.g. mallinfo() and more which are not in musl as a result tests broke. Also add fixes to build remaining tests when building on musl pass -fno-pie as it cant use PIE especially in ptests/x86_64 (From OE-Core rev: 8ab1828f073b5eab606161681a5f260cc0e77bf1) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch31
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0001-str_tester.c-Limit-rawmemchr-test-to-glibc.patch39
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0002-context-APIs-are-not-available-on-musl.patch49
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0003-correct-include-directive-path-for-config.h.patch45
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0004-pth_atfork1.c-Define-error-API-for-musl.patch37
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-musl.patch30
-rw-r--r--meta/recipes-devtools/valgrind/valgrind/0006-pth_detached3.c-Dereference-pthread_t-before-adding-.patch32
-rw-r--r--meta/recipes-devtools/valgrind/valgrind_3.12.0.bb12
8 files changed, 275 insertions, 0 deletions
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch b/meta/recipes-devtools/valgrind/valgrind/0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch
new file mode 100644
index 0000000000..27366153f7
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch
@@ -0,0 +1,31 @@
1From 64ad2744acfb4fa40b1c114633a053f87125a203 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 10 Jun 2017 00:46:39 -0700
4Subject: [PATCH 1/6] sigqueue: Rename _sifields to __si_fields on musl
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 memcheck/tests/linux/sigqueue.c | 5 +++++
11 1 file changed, 5 insertions(+)
12
13diff --git a/memcheck/tests/linux/sigqueue.c b/memcheck/tests/linux/sigqueue.c
14index d18bd72..acb7cba 100644
15--- a/memcheck/tests/linux/sigqueue.c
16+++ b/memcheck/tests/linux/sigqueue.c
17@@ -8,6 +8,11 @@
18 #include <syscall.h>
19 #include <unistd.h>
20
21+/* musl libc defines siginfo_t __si_fields instead of _sifields */
22+#if defined(__linux__) && !defined(__GLIBC__)
23+#define _sifields __si_fields
24+#endif
25+
26 int main(int argc, char **argv)
27 {
28 siginfo_t *si;
29--
302.13.1
31
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-str_tester.c-Limit-rawmemchr-test-to-glibc.patch b/meta/recipes-devtools/valgrind/valgrind/0001-str_tester.c-Limit-rawmemchr-test-to-glibc.patch
new file mode 100644
index 0000000000..185b8f9e60
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-str_tester.c-Limit-rawmemchr-test-to-glibc.patch
@@ -0,0 +1,39 @@
1From de692e359801a1f0488c76267e4f904dd2efe754 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 10 Jun 2017 00:39:07 -0700
4Subject: [PATCH] str_tester.c: Limit rawmemchr() test to glibc
5
6rawmemchr() is a GNU extention therefore mark it so
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Pending
11
12 memcheck/tests/str_tester.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/memcheck/tests/str_tester.c b/memcheck/tests/str_tester.c
16index 9f7790a..47e4b4a 100644
17--- a/memcheck/tests/str_tester.c
18+++ b/memcheck/tests/str_tester.c
19@@ -504,7 +504,7 @@ test_strchrnul (void)
20 #endif
21
22 // DDD: better done by testing for the function.
23-#if !defined(__APPLE__) && !defined(__sun)
24+#if !defined(__APPLE__) && !defined(__sun) && defined(__GLIBC__)
25 static void
26 test_rawmemchr (void)
27 {
28@@ -1442,7 +1442,7 @@ main (void)
29 test_strchrnul ();
30 # endif
31
32-# if !defined(__APPLE__) && !defined(__sun)
33+# if !defined(__APPLE__) && !defined(__sun) && defined(__GLIBC__)
34 /* rawmemchr. */
35 test_rawmemchr ();
36 # endif
37--
382.13.1
39
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
new file mode 100644
index 0000000000..3f9f33b487
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0002-context-APIs-are-not-available-on-musl.patch
@@ -0,0 +1,49 @@
1From 862b807076d57f2f58ed9d572ddac8bb402774a2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 10 Jun 2017 01:01:10 -0700
4Subject: [PATCH 2/6] context APIs are not available on musl
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 memcheck/tests/linux/stack_changes.c | 7 ++++++-
11 1 file changed, 6 insertions(+), 1 deletion(-)
12
13diff --git a/memcheck/tests/linux/stack_changes.c b/memcheck/tests/linux/stack_changes.c
14index a978fc2..ffb49c6 100644
15--- a/memcheck/tests/linux/stack_changes.c
16+++ b/memcheck/tests/linux/stack_changes.c
17@@ -10,6 +10,7 @@
18 // This test is checking the libc context calls (setcontext, etc.) and
19 // checks that Valgrind notices their stack changes properly.
20
21+#ifdef __GLIBC__
22 typedef struct ucontext mycontext;
23
24 mycontext ctx1, ctx2, oldc;
25@@ -51,9 +52,11 @@ int init_context(mycontext *uc)
26
27 return ret;
28 }
29+#endif
30
31 int main(int argc, char **argv)
32 {
33+#ifdef __GLIBC__
34 int c1 = init_context(&ctx1);
35 int c2 = init_context(&ctx2);
36
37@@ -66,6 +69,8 @@ int main(int argc, char **argv)
38 //free(ctx1.uc_stack.ss_sp);
39 VALGRIND_STACK_DEREGISTER(c2);
40 //free(ctx2.uc_stack.ss_sp);
41-
42+#else
43+ printf("libc context call APIs e.g. getcontext() are deprecated by posix\n");
44+#endif
45 return 0;
46 }
47--
482.13.1
49
diff --git a/meta/recipes-devtools/valgrind/valgrind/0003-correct-include-directive-path-for-config.h.patch b/meta/recipes-devtools/valgrind/valgrind/0003-correct-include-directive-path-for-config.h.patch
new file mode 100644
index 0000000000..c2965c40df
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0003-correct-include-directive-path-for-config.h.patch
@@ -0,0 +1,45 @@
1From ecbdea7bd8b08205f1bc3f6b72d4b4a80f313fcb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 10 Jun 2017 01:03:17 -0700
4Subject: [PATCH 3/6] correct include directive path for config.h
5
6when building out of source tree, it can not find
7the generated config.h otherwise
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 memcheck/tests/linux/syscalls-2007.c | 2 +-
14 memcheck/tests/linux/syslog-syscall.c | 2 +-
15 2 files changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/memcheck/tests/linux/syscalls-2007.c b/memcheck/tests/linux/syscalls-2007.c
18index b61c6d5..cc3fd62 100644
19--- a/memcheck/tests/linux/syscalls-2007.c
20+++ b/memcheck/tests/linux/syscalls-2007.c
21@@ -10,7 +10,7 @@
22
23 #define _GNU_SOURCE
24
25-#include "../../config.h"
26+#include "config.h"
27 #include <fcntl.h>
28 #include <signal.h>
29 #include <stdint.h>
30diff --git a/memcheck/tests/linux/syslog-syscall.c b/memcheck/tests/linux/syslog-syscall.c
31index 1143722..21e758b 100644
32--- a/memcheck/tests/linux/syslog-syscall.c
33+++ b/memcheck/tests/linux/syslog-syscall.c
34@@ -6,7 +6,7 @@
35 * klogctl().
36 */
37
38-#include "../../config.h"
39+#include "config.h"
40 #include <stdio.h>
41 #if defined(HAVE_SYS_KLOG_H)
42 #include <sys/klog.h>
43--
442.13.1
45
diff --git a/meta/recipes-devtools/valgrind/valgrind/0004-pth_atfork1.c-Define-error-API-for-musl.patch b/meta/recipes-devtools/valgrind/valgrind/0004-pth_atfork1.c-Define-error-API-for-musl.patch
new file mode 100644
index 0000000000..1cb7062545
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0004-pth_atfork1.c-Define-error-API-for-musl.patch
@@ -0,0 +1,37 @@
1From fb77fef4f866dac7bcc6d1ae025da60564869f84 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 10 Jun 2017 01:06:11 -0700
4Subject: [PATCH 4/6] pth_atfork1.c: Define error() API for musl
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 none/tests/pth_atfork1.c | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13diff --git a/none/tests/pth_atfork1.c b/none/tests/pth_atfork1.c
14index 34201ef..b7f5f2d 100644
15--- a/none/tests/pth_atfork1.c
16+++ b/none/tests/pth_atfork1.c
17@@ -18,7 +18,7 @@
18 Boston, MA 02111-1307, USA. */
19
20 #include <errno.h>
21-#if !defined(__APPLE__) && !defined(__sun)
22+#if !defined(__APPLE__) && !defined(__sun) && defined(__GLIBC__)
23 # include <error.h>
24 #endif
25 #include <stdlib.h>
26@@ -27,7 +27,7 @@
27 #include <sys/wait.h>
28 #include <stdio.h>
29
30-#if defined(__APPLE__) || defined(__sun)
31+#if defined(__APPLE__) || defined(__sun) || (defined(__linux__) && !defined(__GLIBC__))
32 #include <string.h> /* strerror */
33 static void error (int status, int errnum, char* msg)
34 {
35--
362.13.1
37
diff --git a/meta/recipes-devtools/valgrind/valgrind/0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-musl.patch b/meta/recipes-devtools/valgrind/valgrind/0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-musl.patch
new file mode 100644
index 0000000000..6176640e42
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-musl.patch
@@ -0,0 +1,30 @@
1From b4b9f072c22f96844e02cb9d68f7ff2408680817 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 10 Jun 2017 01:07:59 -0700
4Subject: [PATCH 5/6] tc20_verifywrap.c: Fake __GLIBC_PREREQ with musl
5
6similar to sun
7
8Upstream-Status: Pending
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 helgrind/tests/tc20_verifywrap.c | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/helgrind/tests/tc20_verifywrap.c b/helgrind/tests/tc20_verifywrap.c
16index c110000..a311a49 100644
17--- a/helgrind/tests/tc20_verifywrap.c
18+++ b/helgrind/tests/tc20_verifywrap.c
19@@ -20,7 +20,7 @@
20
21 #if !defined(__APPLE__)
22
23-#if defined(__sun__)
24+#if defined(__sun__) || (defined(__linux__) && !defined(__GLIBC__))
25 /* Fake __GLIBC_PREREQ on Solaris. Pretend glibc >= 2.4. */
26 # define __GLIBC_PREREQ
27 #else
28--
292.13.1
30
diff --git a/meta/recipes-devtools/valgrind/valgrind/0006-pth_detached3.c-Dereference-pthread_t-before-adding-.patch b/meta/recipes-devtools/valgrind/valgrind/0006-pth_detached3.c-Dereference-pthread_t-before-adding-.patch
new file mode 100644
index 0000000000..05886c743d
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0006-pth_detached3.c-Dereference-pthread_t-before-adding-.patch
@@ -0,0 +1,32 @@
1From a6547fc17c120dbd95b852f50b0c4bdee4fedb9a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 10 Jun 2017 01:20:32 -0700
4Subject: [PATCH 6/6] pth_detached3.c: Dereference pthread_t before adding
5 offset to it
6
7Fixes
8error: invalid use of undefined type 'struct __pthread'
9
10Upstream-Status: Pending
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 drd/tests/pth_detached3.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/drd/tests/pth_detached3.c b/drd/tests/pth_detached3.c
18index c02eef1..35d43a6 100644
19--- a/drd/tests/pth_detached3.c
20+++ b/drd/tests/pth_detached3.c
21@@ -21,7 +21,7 @@ int main(int argc, char** argv)
22 pthread_detach(thread);
23
24 /* Invoke pthread_detach() with an invalid thread ID. */
25- pthread_detach(thread + 8);
26+ pthread_detach((pthread_t*)(&thread + 8));
27
28 fprintf(stderr, "Finished.\n");
29
30--
312.13.1
32
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.12.0.bb b/meta/recipes-devtools/valgrind/valgrind_3.12.0.bb
index d5a8dda487..d7b6d77000 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.12.0.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.12.0.bb
@@ -24,6 +24,13 @@ SRC_URI = "http://www.valgrind.org/downloads/valgrind-${PV}.tar.bz2 \
24 file://avoid-neon-for-targets-which-don-t-support-it.patch \ 24 file://avoid-neon-for-targets-which-don-t-support-it.patch \
25 file://valgrind-make-ld-XXX.so-strlen-intercept-optional.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 \ 26 file://0001-makefiles-Drop-setting-mcpu-to-cortex-a8-on-arm-arch.patch \
27 file://0001-str_tester.c-Limit-rawmemchr-test-to-glibc.patch \
28 file://0001-sigqueue-Rename-_sifields-to-__si_fields-on-musl.patch \
29 file://0002-context-APIs-are-not-available-on-musl.patch \
30 file://0003-correct-include-directive-path-for-config.h.patch \
31 file://0004-pth_atfork1.c-Define-error-API-for-musl.patch \
32 file://0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-musl.patch \
33 file://0006-pth_detached3.c-Dereference-pthread_t-before-adding-.patch \
27 " 34 "
28SRC_URI_append_libc-musl = "\ 35SRC_URI_append_libc-musl = "\
29 file://0001-fix-build-for-musl-targets.patch \ 36 file://0001-fix-build-for-musl-targets.patch \
@@ -67,6 +74,7 @@ CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
67SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}" 74SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}"
68 75
69CFLAGS_append_libc-uclibc = " -D__UCLIBC__ " 76CFLAGS_append_libc-uclibc = " -D__UCLIBC__ "
77CFLAGS += "-no-pie"
70 78
71def get_mcpu(d): 79def get_mcpu(d):
72 for arg in (d.getVar('TUNE_CCARGS') or '').split(): 80 for arg in (d.getVar('TUNE_CCARGS') or '').split():
@@ -76,6 +84,10 @@ def get_mcpu(d):
76 continue 84 continue
77 return "" 85 return ""
78 86
87do_configure_prepend () {
88 rm -rf ${S}/config.h
89}
90
79do_install_append () { 91do_install_append () {
80 install -m 644 ${B}/default.supp ${D}/${libdir}/valgrind/ 92 install -m 644 ${B}/default.supp ${D}/${libdir}/valgrind/
81} 93}