diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-07-05 17:50:31 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-11 15:57:08 +0100 |
commit | 23df57b15097dc14f417aa23539dfc1e5265af16 (patch) | |
tree | ea4a5432c6728c4f530a697d052e07287247be9f | |
parent | 155cff6c9ea796d47fa4d69fce9cdcaf7f39afeb (diff) | |
download | poky-23df57b15097dc14f417aa23539dfc1e5265af16.tar.gz |
valgrind: tests build fixes for musl
x86/aarch64 needed minor changes to make few testcases portable
(From OE-Core rev: 459907cd548b97e50b26036e6898d32685cee01e)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
4 files changed, 135 insertions, 0 deletions
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-arm64-Define-__THROW-if-not-already-defined.patch b/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-arm64-Define-__THROW-if-not-already-defined.patch new file mode 100644 index 0000000000..a48d7db070 --- /dev/null +++ b/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-arm64-Define-__THROW-if-not-already-defined.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | From 3409dc35c15bb14c8a525239806322648e079ab1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 5 Jul 2017 17:12:43 -0700 | ||
4 | Subject: [PATCH 1/3] memcheck/arm64: Define __THROW if not already defined | ||
5 | |||
6 | Helps compiling with musl where __THROW is not available | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | Upstream-Status: Submitted | ||
11 | |||
12 | memcheck/tests/arm64-linux/scalar.h | 4 ++++ | ||
13 | 1 file changed, 4 insertions(+) | ||
14 | |||
15 | diff --git a/memcheck/tests/arm64-linux/scalar.h b/memcheck/tests/arm64-linux/scalar.h | ||
16 | index 9008816..8ef050f 100644 | ||
17 | --- a/memcheck/tests/arm64-linux/scalar.h | ||
18 | +++ b/memcheck/tests/arm64-linux/scalar.h | ||
19 | @@ -12,6 +12,10 @@ | ||
20 | #include <sys/types.h> | ||
21 | #include <sys/mman.h> | ||
22 | |||
23 | +#ifndef __THROW | ||
24 | +#define __THROW | ||
25 | +#endif | ||
26 | + | ||
27 | // Since we use vki_unistd.h, we can't include <unistd.h>. So we have to | ||
28 | // declare this ourselves. | ||
29 | extern long int syscall (long int __sysno, ...) __THROW; | ||
30 | -- | ||
31 | 2.13.2 | ||
32 | |||
diff --git a/meta/recipes-devtools/valgrind/valgrind/0002-memcheck-x86-Define-__THROW-if-not-defined.patch b/meta/recipes-devtools/valgrind/valgrind/0002-memcheck-x86-Define-__THROW-if-not-defined.patch new file mode 100644 index 0000000000..5433472291 --- /dev/null +++ b/meta/recipes-devtools/valgrind/valgrind/0002-memcheck-x86-Define-__THROW-if-not-defined.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | From 67d199dbdcbb3feff5f8928f87725fc64c0307d7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 5 Jul 2017 17:36:42 -0700 | ||
4 | Subject: [PATCH 2/3] memcheck/x86: Define __THROW if not defined | ||
5 | |||
6 | musl does not have __THROW, therefore make it null | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | Upstream-Status: Submitted | ||
11 | |||
12 | memcheck/tests/x86-linux/scalar.h | 4 ++++ | ||
13 | 1 file changed, 4 insertions(+) | ||
14 | |||
15 | diff --git a/memcheck/tests/x86-linux/scalar.h b/memcheck/tests/x86-linux/scalar.h | ||
16 | index ef28b03..52f742e 100644 | ||
17 | --- a/memcheck/tests/x86-linux/scalar.h | ||
18 | +++ b/memcheck/tests/x86-linux/scalar.h | ||
19 | @@ -11,6 +11,10 @@ | ||
20 | #include <sys/types.h> | ||
21 | #include <sys/mman.h> | ||
22 | |||
23 | +#ifndef __THROW | ||
24 | +#define __THROW | ||
25 | +#endif | ||
26 | + | ||
27 | // Since we use vki_unistd.h, we can't include <unistd.h>. So we have to | ||
28 | // declare this ourselves. | ||
29 | extern long int syscall (long int __sysno, ...) __THROW; | ||
30 | -- | ||
31 | 2.13.2 | ||
32 | |||
diff --git a/meta/recipes-devtools/valgrind/valgrind/0003-tests-seg_override-Replace-__modify_ldt-with-syscall.patch b/meta/recipes-devtools/valgrind/valgrind/0003-tests-seg_override-Replace-__modify_ldt-with-syscall.patch new file mode 100644 index 0000000000..fa1344c853 --- /dev/null +++ b/meta/recipes-devtools/valgrind/valgrind/0003-tests-seg_override-Replace-__modify_ldt-with-syscall.patch | |||
@@ -0,0 +1,68 @@ | |||
1 | From d103475875858ab8a2e6b53ce178bb2f63883d4c Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 5 Jul 2017 17:37:56 -0700 | ||
4 | Subject: [PATCH 3/3] tests/seg_override: Replace __modify_ldt() with syscall() | ||
5 | |||
6 | __modify_ldt() is specific to glibc, replacing it with syscall() | ||
7 | makes it more portable. | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | Upstream-Status: Submitted | ||
12 | |||
13 | none/tests/x86-linux/seg_override.c | 15 ++++++--------- | ||
14 | 1 file changed, 6 insertions(+), 9 deletions(-) | ||
15 | |||
16 | diff --git a/none/tests/x86-linux/seg_override.c b/none/tests/x86-linux/seg_override.c | ||
17 | index b7619c9..c89874b 100644 | ||
18 | --- a/none/tests/x86-linux/seg_override.c | ||
19 | +++ b/none/tests/x86-linux/seg_override.c | ||
20 | @@ -2,6 +2,8 @@ | ||
21 | #include <stdio.h> | ||
22 | #include <errno.h> | ||
23 | #include <string.h> | ||
24 | +#include <unistd.h> | ||
25 | +#include <syscall.h> | ||
26 | |||
27 | /* Stuff from Wine. */ | ||
28 | |||
29 | @@ -52,14 +54,11 @@ inline static unsigned int wine_ldt_get_limit( const LDT_ENTRY *ent ) | ||
30 | /* our copy of the ldt */ | ||
31 | LDT_ENTRY ldt_copy[8192]; | ||
32 | |||
33 | -/* System call to set LDT entry. */ | ||
34 | -//extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t); | ||
35 | -extern int __modify_ldt (int, void *, size_t); | ||
36 | - | ||
37 | void print_ldt ( void ) | ||
38 | { | ||
39 | int res; | ||
40 | - res = __modify_ldt( 0, ldt_copy, 8192*sizeof(LDT_ENTRY) ); | ||
41 | + /* System call to set LDT entry. */ | ||
42 | + res = syscall(SYS_modify_ldt, 0, ldt_copy, 8192*sizeof(LDT_ENTRY) ); | ||
43 | printf("got %d bytes\n", res ); | ||
44 | perror("error is"); | ||
45 | } | ||
46 | @@ -83,9 +82,6 @@ struct modify_ldt_ldt_s | ||
47 | unsigned int empty:25; | ||
48 | }; | ||
49 | |||
50 | -/* System call to set LDT entry. */ | ||
51 | -//extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t); | ||
52 | - | ||
53 | void set_ldt1 ( void* base ) | ||
54 | { | ||
55 | int stat; | ||
56 | @@ -102,7 +98,8 @@ void set_ldt1 ( void* base ) | ||
57 | ldt_entry.read_exec_only = 0; | ||
58 | ldt_entry.limit_in_pages = 0; | ||
59 | ldt_entry.seg_not_present = 0; | ||
60 | - stat = __modify_ldt (1, &ldt_entry, sizeof (ldt_entry)); | ||
61 | + /* System call to set LDT entry. */ | ||
62 | + stat = syscall(SYS_modify_ldt, 1, &ldt_entry, sizeof (ldt_entry)); | ||
63 | printf("stat = %d\n", stat); | ||
64 | } | ||
65 | |||
66 | -- | ||
67 | 2.13.2 | ||
68 | |||
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.12.0.bb b/meta/recipes-devtools/valgrind/valgrind_3.12.0.bb index 4cf8062031..b63d27861d 100644 --- a/meta/recipes-devtools/valgrind/valgrind_3.12.0.bb +++ b/meta/recipes-devtools/valgrind/valgrind_3.12.0.bb | |||
@@ -32,6 +32,9 @@ SRC_URI = "http://www.valgrind.org/downloads/valgrind-${PV}.tar.bz2 \ | |||
32 | file://0005-tc20_verifywrap.c-Fake-__GLIBC_PREREQ-with-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 \ | 33 | file://0006-pth_detached3.c-Dereference-pthread_t-before-adding-.patch \ |
34 | file://0001-memcheck-tests-Use-ucontext_t-instead-of-struct-ucon.patch \ | 34 | file://0001-memcheck-tests-Use-ucontext_t-instead-of-struct-ucon.patch \ |
35 | file://0001-memcheck-arm64-Define-__THROW-if-not-already-defined.patch \ | ||
36 | file://0002-memcheck-x86-Define-__THROW-if-not-defined.patch \ | ||
37 | file://0003-tests-seg_override-Replace-__modify_ldt-with-syscall.patch \ | ||
35 | " | 38 | " |
36 | SRC_URI_append_libc-musl = "\ | 39 | SRC_URI_append_libc-musl = "\ |
37 | file://0001-fix-build-for-musl-targets.patch \ | 40 | file://0001-fix-build-for-musl-targets.patch \ |