aboutsummaryrefslogtreecommitdiffstats
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
parentaa558bc2e839edc6dd816b2ce301d8fe0de87a69 (diff)
downloadmeta-openembedded-contrib-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>
-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 0000000000..b56e690e90
--- /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 @@
+From dad8537110c27b45795f8879a3e0a54aa77546b9 Mon Sep 17 00:00:00 2001
+From: Siarhei Siamashka <siarhei.siamashka@nokia.com>
+Date: Tue, 11 Jan 2011 18:10:39 +0200
+Subject: [PATCH] ARM: qemu related workarounds in cpu features detection code
+
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ pixman/pixman-cpu.c | 67 +++++++++++++++++++++++++++++++++++++++++---------
+ 1 files changed, 55 insertions(+), 12 deletions(-)
+
+diff --git a/pixman/pixman-cpu.c b/pixman/pixman-cpu.c
+index aa9036f..a8f2494 100644
+--- a/pixman/pixman-cpu.c
++++ b/pixman/pixman-cpu.c
+@@ -333,15 +333,30 @@ pixman_arm_read_auxv_or_cpu_features ()
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/mman.h>
++#include <sys/utsname.h>
+ #include <fcntl.h>
+ #include <string.h>
+ #include <elf.h>
+
++/*
++ * The whole CPU capabilities detection is a bit ugly: when running in
++ * userspace qemu, we see /proc/self/auxv from the host system. To make
++ * everything even worse, the size of each value is 64-bit when running
++ * on a 64-bit host system. So the data is totally bogus because we expect
++ * 32-bit values. As AT_PLATFORM value is used as a pointer, it may cause
++ * segfault (null pointer dereference on x86-64 host). So in order to be
++ * on a safe side, we require that AT_PLATFORM value is found only once,
++ * and it has non-zero value (this is still not totally reliable for a big
++ * endian 64-bit host system running qemu and may theoretically fail).
++ */
+ static void
+ pixman_arm_read_auxv_or_cpu_features ()
+ {
+ int fd;
+ Elf32_auxv_t aux;
++ uint32_t hwcap = 0;
++ const char *plat = NULL;
++ int plat_cnt = 0;
+
+ fd = open ("/proc/self/auxv", O_RDONLY);
+ if (fd >= 0)
+@@ -350,32 +365,60 @@ pixman_arm_read_auxv_or_cpu_features ()
+ {
+ if (aux.a_type == AT_HWCAP)
+ {
+- uint32_t hwcap = aux.a_un.a_val;
+- /* hardcode these values to avoid depending on specific
+- * versions of the hwcap header, e.g. HWCAP_NEON
+- */
+- arm_has_vfp = (hwcap & 64) != 0;
+- arm_has_iwmmxt = (hwcap & 512) != 0;
+- /* this flag is only present on kernel 2.6.29 */
+- arm_has_neon = (hwcap & 4096) != 0;
++ hwcap = aux.a_un.a_val;
+ }
+ else if (aux.a_type == AT_PLATFORM)
+ {
+- const char *plat = (const char*) aux.a_un.a_val;
+- if (strncmp (plat, "v7l", 3) == 0)
++ plat = (const char*) aux.a_un.a_val;
++ plat_cnt++;
++ }
++ }
++ close (fd);
++
++ if (plat == NULL || plat_cnt != 1 || *plat != 'v')
++ {
++ /*
++ * Something seems to be really wrong, most likely we are
++ * running under qemu. Let's use machine type from "uname" for
++ * CPU capabilities detection:
++ * http://www.mail-archive.com/qemu-devel at nongnu.org/msg22212.html
++ */
++ struct utsname u;
++ hwcap = 0; /* clear hwcap, because it is bogus */
++ if (uname (&u) == 0)
++ {
++ if (strcmp (u.machine, "armv7l") == 0)
+ {
+ arm_has_v7 = TRUE;
+ arm_has_v6 = TRUE;
++ hwcap |= 64; /* qemu is supposed to emulate vfp */
++ hwcap |= 4096; /* qemu is supposed to emulate neon */
+ }
+- else if (strncmp (plat, "v6l", 3) == 0)
++ else if (strcmp (u.machine, "armv6l") == 0)
+ {
+ arm_has_v6 = TRUE;
++ hwcap |= 64; /* qemu is supposed to emulate vfp */
+ }
+ }
+ }
+- close (fd);
++ else if (strncmp (plat, "v7l", 3) == 0)
++ {
++ arm_has_v7 = TRUE;
++ arm_has_v6 = TRUE;
++ }
++ else if (strncmp (plat, "v6l", 3) == 0)
++ {
++ arm_has_v6 = TRUE;
++ }
+ }
+
++ /* hardcode these values to avoid depending on specific
++ * versions of the hwcap header, e.g. HWCAP_NEON
++ */
++ arm_has_vfp = (hwcap & 64) != 0;
++ arm_has_iwmmxt = (hwcap & 512) != 0;
++ arm_has_neon = (hwcap & 4096) != 0;
++
+ arm_tests_initialized = TRUE;
+ }
+
+--
+1.7.8.6
+
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 579d5081e3..b5be2b50ca 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 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${P}:"
-PRINC := "${@int(PRINC) + 9}"
+PRINC := "${@int(PRINC) + 10}"
-SRC_URI += " file://0008-Generic-C-implementation-of-pixman_blt-with-overlapp.patch"
+SRC_URI += " file://0008-Generic-C-implementation-of-pixman_blt-with-overlapp.patch \
+ file://0001-ARM-qemu-related-workarounds-in-cpu-features-detecti.patch \
+"
NEON = " --disable-arm-neon "
NEON_armv7a = " "