pixman: add patch to fix Microblaze build failure
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 22 Feb 2014 22:23:33 +0000 (23:23 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Sat, 22 Feb 2014 22:48:11 +0000 (23:48 +0100)
The Microblaze build of pixman was failing due to FE_DIVBYZERO not
being implemented. It turns out that the usage of it, like fenv.h and
feenableexcept() is optional. So the patch simply adds a configure
check and disables the appropriate code (which is only use in the
tests anyway).

This commit also renames the existing patch to follow the patch naming
convention, and get a reliable ordering when applying patches.

Fixes:

  http://autobuild.buildroot.org/results/806/8064092cdbac85fbf4322429d29d5d11dc51860f/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/pixman/pixman-01-loongson-cflags.patch [new file with mode: 0644]
package/pixman/pixman-02-check-fe-divbyzero.patch [new file with mode: 0644]
package/pixman/pixman-loongson-cflags.patch [deleted file]

diff --git a/package/pixman/pixman-01-loongson-cflags.patch b/package/pixman/pixman-01-loongson-cflags.patch
new file mode 100644 (file)
index 0000000..fc53be2
--- /dev/null
@@ -0,0 +1,38 @@
+configure.ac: Verify that the Loongson MMI code can link
+
+The Loongson MMI code modifies -march and as a result it breaks linking
+when the rest of the code is built with a different -match/-mtune.
+This patch fixes the problem by trying to link the code instead of just
+compiling it. This patch is already committed upstream.
+
+Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
+
+From d77d75cc6e5de14d027d22b70389a4d0c71048b9 Mon Sep 17 00:00:00 2001
+From: Markos Chandras <markos.chandras@imgtec.com>
+Date: Wed, 15 May 2013 16:51:20 +0000
+Subject: Use AC_LINK_IFELSE to check if the Loongson MMI code can link
+
+The Loongson code is compiled with -march=loongson2f to enable the MMI
+instructions, but binutils refuses to link object code compiled with
+different -march settings, leading to link failures later in the
+compile. This avoids that problem by checking if we can link code
+compiled for Loongson.
+
+Reviewed-by: Matt Turner <mattst88@gmail.com>
+Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
+---
+diff --git a/configure.ac b/configure.ac
+index c43a0d2..221179f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -279,7 +279,7 @@ AC_MSG_CHECKING(whether to use Loongson MMI assembler)
+ xserver_save_CFLAGS=$CFLAGS
+ CFLAGS=" $LS_CFLAGS $CFLAGS -I$srcdir"
+-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
++AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ #ifndef __mips_loongson_vector_rev
+ #error "Loongson Multimedia Instructions are only available on Loongson"
+ #endif
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/package/pixman/pixman-02-check-fe-divbyzero.patch b/package/pixman/pixman-02-check-fe-divbyzero.patch
new file mode 100644 (file)
index 0000000..44dd691
--- /dev/null
@@ -0,0 +1,41 @@
+Add a check for FE_DIVBYZERO
+
+Some architectures (namely Microblaze) do have fenv.h and
+feenableexcept, but they don't have the FE_DIVBYZERO definition. This
+patch adds a configure check for FE_DIVBYZERO, and only uses it if
+it's available.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -838,6 +838,11 @@
+    AC_DEFINE(HAVE_FEENABLEEXCEPT, 1, [Whether we have feenableexcept()])
+ fi
++AC_CHECK_DECL([FE_DIVBYZERO], [], [], [[#include <fenv.h>]])
++if test x$have_fe_divbyzero = xyes; then
++   AC_DEFINE(HAVE_FEDIVBYZERO, 1, [Whether we have FE_DIVBYZERO])
++fi
++
+ AC_CHECK_FUNC(gettimeofday, have_gettimeofday=yes, have_gettimeofday=no)
+ AC_CHECK_HEADER(sys/time.h, have_sys_time_h=yes, have_sys_time_h=no)
+ if test x$have_gettimeofday = xyes && test x$have_sys_time_h = xyes; then
+Index: b/test/utils.c
+===================================================================
+--- a/test/utils.c
++++ b/test/utils.c
+@@ -776,9 +776,11 @@
+ {
+ #ifdef HAVE_FENV_H
+ #ifdef HAVE_FEENABLEEXCEPT
++#ifdef HAVE_FE_DIVBYZERO
+     feenableexcept (FE_DIVBYZERO);
+ #endif
+ #endif
++#endif
+ }
+ void *
diff --git a/package/pixman/pixman-loongson-cflags.patch b/package/pixman/pixman-loongson-cflags.patch
deleted file mode 100644 (file)
index fc53be2..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-configure.ac: Verify that the Loongson MMI code can link
-
-The Loongson MMI code modifies -march and as a result it breaks linking
-when the rest of the code is built with a different -match/-mtune.
-This patch fixes the problem by trying to link the code instead of just
-compiling it. This patch is already committed upstream.
-
-Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
-
-From d77d75cc6e5de14d027d22b70389a4d0c71048b9 Mon Sep 17 00:00:00 2001
-From: Markos Chandras <markos.chandras@imgtec.com>
-Date: Wed, 15 May 2013 16:51:20 +0000
-Subject: Use AC_LINK_IFELSE to check if the Loongson MMI code can link
-
-The Loongson code is compiled with -march=loongson2f to enable the MMI
-instructions, but binutils refuses to link object code compiled with
-different -march settings, leading to link failures later in the
-compile. This avoids that problem by checking if we can link code
-compiled for Loongson.
-
-Reviewed-by: Matt Turner <mattst88@gmail.com>
-Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
----
-diff --git a/configure.ac b/configure.ac
-index c43a0d2..221179f 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -279,7 +279,7 @@ AC_MSG_CHECKING(whether to use Loongson MMI assembler)
- xserver_save_CFLAGS=$CFLAGS
- CFLAGS=" $LS_CFLAGS $CFLAGS -I$srcdir"
--AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
-+AC_LINK_IFELSE([AC_LANG_SOURCE([[
- #ifndef __mips_loongson_vector_rev
- #error "Loongson Multimedia Instructions are only available on Loongson"
- #endif
---
-cgit v0.9.0.2-2-gbebe