summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2012-07-31 03:29:46 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2012-07-31 03:47:15 +0200
commit72e02b4625dceb0cc72e1edfc28215786c7de63a (patch)
treec9a666402eae063b1926b2ca6b721b7268b5d26f /meta-oe/recipes-graphics
parentaa558bc2e839edc6dd816b2ce301d8fe0de87a69 (diff)
downloadmeta-openembedded-72e02b4625dceb0cc72e1edfc28215786c7de63a.tar.gz
pixman: add patch to fix SEGFAULT when parsing auxv
* without this patch emacs won't build * temacs is executed in qemu and fails like this: qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault which is actually: Program received signal SIGSEGV, Segmentation fault. __GI_strncmp (s1=s1@entry=0x0, s2=s2@entry=0x40d68638 "v7l", n=n@entry=3) at strncmp.c:64 64 strncmp.c: No such file or directory. (gdb) bt Backtrace stopped: previous frame identical to this frame (corrupt stack?) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-graphics')
-rw-r--r--meta-oe/recipes-graphics/xorg-lib/pixman-0.26.2/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch121
-rw-r--r--meta-oe/recipes-graphics/xorg-lib/pixman_0.26.2.bbappend6
2 files changed, 125 insertions, 2 deletions
diff --git a/meta-oe/recipes-graphics/xorg-lib/pixman-0.26.2/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch b/meta-oe/recipes-graphics/xorg-lib/pixman-0.26.2/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch
new file mode 100644
index 000000000..b56e690e9
--- /dev/null
+++ b/meta-oe/recipes-graphics/xorg-lib/pixman-0.26.2/0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch
@@ -0,0 +1,121 @@
1From dad8537110c27b45795f8879a3e0a54aa77546b9 Mon Sep 17 00:00:00 2001
2From: Siarhei Siamashka <siarhei.siamashka@nokia.com>
3Date: Tue, 11 Jan 2011 18:10:39 +0200
4Subject: [PATCH] ARM: qemu related workarounds in cpu features detection code
5
6Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
7---
8 pixman/pixman-cpu.c | 67 +++++++++++++++++++++++++++++++++++++++++---------
9 1 files changed, 55 insertions(+), 12 deletions(-)
10
11diff --git a/pixman/pixman-cpu.c b/pixman/pixman-cpu.c
12index aa9036f..a8f2494 100644
13--- a/pixman/pixman-cpu.c
14+++ b/pixman/pixman-cpu.c
15@@ -333,15 +333,30 @@ pixman_arm_read_auxv_or_cpu_features ()
16 #include <sys/types.h>
17 #include <sys/stat.h>
18 #include <sys/mman.h>
19+#include <sys/utsname.h>
20 #include <fcntl.h>
21 #include <string.h>
22 #include <elf.h>
23
24+/*
25+ * The whole CPU capabilities detection is a bit ugly: when running in
26+ * userspace qemu, we see /proc/self/auxv from the host system. To make
27+ * everything even worse, the size of each value is 64-bit when running
28+ * on a 64-bit host system. So the data is totally bogus because we expect
29+ * 32-bit values. As AT_PLATFORM value is used as a pointer, it may cause
30+ * segfault (null pointer dereference on x86-64 host). So in order to be
31+ * on a safe side, we require that AT_PLATFORM value is found only once,
32+ * and it has non-zero value (this is still not totally reliable for a big
33+ * endian 64-bit host system running qemu and may theoretically fail).
34+ */
35 static void
36 pixman_arm_read_auxv_or_cpu_features ()
37 {
38 int fd;
39 Elf32_auxv_t aux;
40+ uint32_t hwcap = 0;
41+ const char *plat = NULL;
42+ int plat_cnt = 0;
43
44 fd = open ("/proc/self/auxv", O_RDONLY);
45 if (fd >= 0)
46@@ -350,32 +365,60 @@ pixman_arm_read_auxv_or_cpu_features ()
47 {
48 if (aux.a_type == AT_HWCAP)
49 {
50- uint32_t hwcap = aux.a_un.a_val;
51- /* hardcode these values to avoid depending on specific
52- * versions of the hwcap header, e.g. HWCAP_NEON
53- */
54- arm_has_vfp = (hwcap & 64) != 0;
55- arm_has_iwmmxt = (hwcap & 512) != 0;
56- /* this flag is only present on kernel 2.6.29 */
57- arm_has_neon = (hwcap & 4096) != 0;
58+ hwcap = aux.a_un.a_val;
59 }
60 else if (aux.a_type == AT_PLATFORM)
61 {
62- const char *plat = (const char*) aux.a_un.a_val;
63- if (strncmp (plat, "v7l", 3) == 0)
64+ plat = (const char*) aux.a_un.a_val;
65+ plat_cnt++;
66+ }
67+ }
68+ close (fd);
69+
70+ if (plat == NULL || plat_cnt != 1 || *plat != 'v')
71+ {
72+ /*
73+ * Something seems to be really wrong, most likely we are
74+ * running under qemu. Let's use machine type from "uname" for
75+ * CPU capabilities detection:
76+ * http://www.mail-archive.com/qemu-devel at nongnu.org/msg22212.html
77+ */
78+ struct utsname u;
79+ hwcap = 0; /* clear hwcap, because it is bogus */
80+ if (uname (&u) == 0)
81+ {
82+ if (strcmp (u.machine, "armv7l") == 0)
83 {
84 arm_has_v7 = TRUE;
85 arm_has_v6 = TRUE;
86+ hwcap |= 64; /* qemu is supposed to emulate vfp */
87+ hwcap |= 4096; /* qemu is supposed to emulate neon */
88 }
89- else if (strncmp (plat, "v6l", 3) == 0)
90+ else if (strcmp (u.machine, "armv6l") == 0)
91 {
92 arm_has_v6 = TRUE;
93+ hwcap |= 64; /* qemu is supposed to emulate vfp */
94 }
95 }
96 }
97- close (fd);
98+ else if (strncmp (plat, "v7l", 3) == 0)
99+ {
100+ arm_has_v7 = TRUE;
101+ arm_has_v6 = TRUE;
102+ }
103+ else if (strncmp (plat, "v6l", 3) == 0)
104+ {
105+ arm_has_v6 = TRUE;
106+ }
107 }
108
109+ /* hardcode these values to avoid depending on specific
110+ * versions of the hwcap header, e.g. HWCAP_NEON
111+ */
112+ arm_has_vfp = (hwcap & 64) != 0;
113+ arm_has_iwmmxt = (hwcap & 512) != 0;
114+ arm_has_neon = (hwcap & 4096) != 0;
115+
116 arm_tests_initialized = TRUE;
117 }
118
119--
1201.7.8.6
121
diff --git a/meta-oe/recipes-graphics/xorg-lib/pixman_0.26.2.bbappend b/meta-oe/recipes-graphics/xorg-lib/pixman_0.26.2.bbappend
index 579d5081e..b5be2b50c 100644
--- a/meta-oe/recipes-graphics/xorg-lib/pixman_0.26.2.bbappend
+++ b/meta-oe/recipes-graphics/xorg-lib/pixman_0.26.2.bbappend
@@ -1,8 +1,10 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${P}:" 1FILESEXTRAPATHS_prepend := "${THISDIR}/${P}:"
2 2
3PRINC := "${@int(PRINC) + 9}" 3PRINC := "${@int(PRINC) + 10}"
4 4
5SRC_URI += " file://0008-Generic-C-implementation-of-pixman_blt-with-overlapp.patch" 5SRC_URI += " file://0008-Generic-C-implementation-of-pixman_blt-with-overlapp.patch \
6 file://0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch \
7"
6 8
7NEON = " --disable-arm-neon " 9NEON = " --disable-arm-neon "
8NEON_armv7a = " " 10NEON_armv7a = " "