Skip to contentSkip to conversation

gmp: misc reformatting + fix gmp_4.2.1 for MIPS

PATCH New Andre McCurdy 1 participant 5 messages Feb 5, 2016

lore
Share & tools
lore
#0 lore raw

cover gmp: misc reformatting + fix gmp_4.2.1 for MIPS

Andre McCurdy (4):
gmp: move SRC_URI out of gmp.inc + minor reformatting
gmp: move BBCLASSEXTEND = "native nativesdk" from gmp.inc into 6.1.0 recipe gmp.inc: limit ARM_INSTRUCTION_SET over-rides to armv4/armv5 gmp_4.2.1: fix build for MIPS

 .../avoid-h-asm-constraint-for-MIPS.patch          | 57 ++++++++++++++++++++++
 meta/recipes-support/gmp/gmp.inc                   | 12 ++---
 meta/recipes-support/gmp/gmp_4.2.1.bb              |  8 +--
 meta/recipes-support/gmp/gmp_6.1.0.bb              |  5 +-
 4 files changed, 70 insertions(+), 12 deletions(-)
 create mode 100644 meta/recipes-support/gmp/gmp-4.2.1/avoid-h-asm-constraint-for-MIPS.patch
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/4 gmp: move SRC_URI out of gmp.inc + minor reformatting

The base SRC_URI in gmp.inc was wrong for gmp 4.2.1 and was not being used by gmp 6.1.0. Remove it and make each recipe responsible for defining its own SRC_URI.

---
 meta/recipes-support/gmp/gmp.inc      | 11 ++++-------
 meta/recipes-support/gmp/gmp_4.2.1.bb |  7 ++++---
 meta/recipes-support/gmp/gmp_6.1.0.bb |  5 +++--
 3 files changed, 11 insertions(+), 12 deletions(-)
meta/recipes-support/gmp/gmp.inc +4 -7
index 6752a39..1e3e2a0 100644
@@ -1,16 +1,13 @@
-SECTION = "devel"
 SUMMARY = "GNU multiprecision arithmetic library"
 DESCRIPTION = "GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers"
 HOMEPAGE = "http://gmplib.org/"
-
-REVISION ?= ""
-SRC_URI = "https://gmplib.org/download/${BPN}/${BP}${REVISION}.tar.bz2"
+SECTION = "devel"
 
 inherit autotools texinfo
 
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[readline] = "--with-readline=yes,--with-readline=no,readline"
+
 ARM_INSTRUCTION_SET = "arm"
 
 BBCLASSEXTEND = "native nativesdk"
-
-PACKAGECONFIG ??= ""
-PACKAGECONFIG[readline] = "--with-readline=yes,--with-readline=no,readline"
meta/recipes-support/gmp/gmp_4.2.1.bb +4 -3
index bfc6a38..c25e5ea 100644
@@ -7,9 +7,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a \
                     file://COPYING.LIB;md5=fbc093901857fcd118f065f900982c24 \
                     file://gmp-h.in;beginline=6;endline=21;md5=e056f74a12c3277d730dbcfb85d2ca34"
 
-SRC_URI += "file://Use-__gnu_inline__-attribute.patch \
-            file://gmp_fix_for_automake-1.12.patch \
-            "
+SRC_URI = "https://gmplib.org/download/${BPN}/archive/${BP}.tar.bz2 \
+           file://Use-__gnu_inline__-attribute.patch \
+           file://gmp_fix_for_automake-1.12.patch \
+"
 
 SRC_URI[md5sum] = "091c56e0e1cca6b09b17b69d47ef18e3"
 SRC_URI[sha256sum] = "d07ffcb37eecec35c5ec72516d10b35fdf6e6fef1fcf1dcd37e30b8cbf8bf941"
meta/recipes-support/gmp/gmp_6.1.0.bb +3 -2
index b26b4d5..44bd8a2 100644
@@ -1,17 +1,19 @@
 require gmp.inc
 
-LICENSE="GPLv2+ | LGPLv3+"
+LICENSE = "GPLv2+ | LGPLv3+"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
                    file://COPYING.LESSERv3;md5=6a6a8e020838b23406c81b19c1d46df6 \
                    file://COPYINGv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
 "
 
+REVISION = ""
 SRC_URI = "https://gmplib.org/download/${BPN}/${BP}${REVISION}.tar.bz2 \
            file://amd64.patch \
            file://use-includedir.patch \
            file://0001-Append-the-user-provided-flags-to-the-auto-detected-.patch \
            "
+
 SRC_URI[md5sum] = "86ee6e54ebfc4a90b643a65e402c4048"
 SRC_URI[sha256sum] = "498449a994efeba527885c10405993427995d3f86b8768d8cdf8d9dd7c6b73e8"
 
@@ -27,4 +29,3 @@ do_install_append_class-target() {
 }
 
 SSTATE_SCAN_FILES += "gmp.h"
-
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/4 gmp: move BBCLASSEXTEND = "native nativesdk" from gmp.inc into 6.1.0 recipe

In reply to Andre McCurdy

It's unlikely that native builds of gmp 4.2.1 (ie the last LGPLv2 version) would ever be required (and given that recent versions of gcc require gmp >= 4.3.2, native builds of gmp 4.2.1 are unlikely to work very well). Restrict native and nativesdk builds to gmp 6.1.0 only.

https://gcc.gnu.org/install/prerequisites.html

---
 meta/recipes-support/gmp/gmp.inc      | 2 --
 meta/recipes-support/gmp/gmp_6.1.0.bb | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-support/gmp/gmp.inc +0 -2
index 1e3e2a0..2beea26 100644
@@ -9,5 +9,3 @@ PACKAGECONFIG ??= ""
 PACKAGECONFIG[readline] = "--with-readline=yes,--with-readline=no,readline"
 
 ARM_INSTRUCTION_SET = "arm"
-
-BBCLASSEXTEND = "native nativesdk"
meta/recipes-support/gmp/gmp_6.1.0.bb +2 -0
index 44bd8a2..de827f5 100644
@@ -29,3 +29,5 @@ do_install_append_class-target() {
 }
 
 SSTATE_SCAN_FILES += "gmp.h"
+
+BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/4 gmp.inc: limit ARM_INSTRUCTION_SET over-rides to armv4/armv5

In reply to Andre McCurdy

The original over-ride dates back to 2008:

http://git.openembedded.org/openembedded-core/commit/?id=b3dddcdde5d10f382f71413aad67f7ef2e2420a2

There are no obvious issues seen now when building either of the current gmp recipes (4.2.1 or 6.1.0) in thumb2 for Cortex A15.

---
 meta/recipes-support/gmp/gmp.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-support/gmp/gmp.inc +2 -1
index 2beea26..abac8cf 100644
@@ -8,4 +8,5 @@ inherit autotools texinfo
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[readline] = "--with-readline=yes,--with-readline=no,readline"
 
-ARM_INSTRUCTION_SET = "arm"
+ARM_INSTRUCTION_SET_armv4 = "arm"
+ARM_INSTRUCTION_SET_armv5 = "arm"
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/4 gmp_4.2.1: fix build for MIPS

In reply to Andre McCurdy

The h asm constrain (to extract the high part of a multiplication result) has not been recognised since gcc 4.4:

https://gcc.gnu.org/gcc-4.4/changes.html

Drop the MIPS umul_ppmm() implementations which rely on "=h" and fall back to the older implementations (which use explicit mfhi and mflo instructions to move the high and low parts of the multiplication result into their destinations).

---
 .../avoid-h-asm-constraint-for-MIPS.patch          | 57 ++++++++++++++++++++++
 meta/recipes-support/gmp/gmp_4.2.1.bb              |  1 +
 2 files changed, 58 insertions(+)
 create mode 100644 meta/recipes-support/gmp/gmp-4.2.1/avoid-h-asm-constraint-for-MIPS.patch
meta/recipes-support/gmp/gmp-4.2.1/avoid-h-asm-constraint-for-MIPS.patch new file +57 -0
new file mode 100644
index 0000000..6da0be9
@@ -0,0 +1,57 @@
+From d50686de0406a88ef9112f5252103f799982e84a Mon Sep 17 00:00:00 2001
+From: Andre McCurdy <[email protected]>
+Date: Thu, 4 Feb 2016 14:00:00 -0800
+Subject: [PATCH] avoid h asm constraint for MIPS
+
+The h asm constrain (to extract the high part of a multiplication
+result) has not been recognised since gcc 4.4:
+
+  https://gcc.gnu.org/gcc-4.4/changes.html
+
+Drop the MIPS umul_ppmm() implementations which rely on "=h" and fall
+back to the older implementations (which use explicit mfhi and mflo
+instructions to move the high and low parts of the multiplication
+result into their destinations).
+
+Upstream-Status: Inappropriate [upstream has a different solution]
+
+Signed-off-by: Andre McCurdy <[email protected]>
+---
+ longlong.h | 10 ----------
+ 1 file changed, 10 deletions(-)
+
+diff --git a/longlong.h b/longlong.h
+index b53fbee..0193abb 100644
+--- a/longlong.h
++++ b/longlong.h
+@@ -1011,27 +1011,17 @@ extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype));
+ #endif /* __m88000__ */
+ 
+ #if defined (__mips) && W_TYPE_SIZE == 32
+-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+-#define umul_ppmm(w1, w0, u, v) \
+-  __asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
+-#else
+ #define umul_ppmm(w1, w0, u, v) \
+   __asm__ ("multu %2,%3\n\tmflo %0\n\tmfhi %1"				\
+ 	   : "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
+-#endif
+ #define UMUL_TIME 10
+ #define UDIV_TIME 100
+ #endif /* __mips */
+ 
+ #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
+-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+-#define umul_ppmm(w1, w0, u, v) \
+-  __asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
+-#else
+ #define umul_ppmm(w1, w0, u, v) \
+   __asm__ ("dmultu %2,%3\n\tmflo %0\n\tmfhi %1"				\
+ 	   : "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
+-#endif
+ #define UMUL_TIME 20
+ #define UDIV_TIME 140
+ #endif /* __mips */
+-- 
+1.9.1
+
meta/recipes-support/gmp/gmp_4.2.1.bb +1 -0
index c25e5ea..5e8ee29 100644
@@ -10,6 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=892f569a555ba9c07a568a7c0c4fa63a \
 SRC_URI = "https://gmplib.org/download/${BPN}/archive/${BP}.tar.bz2 \
            file://Use-__gnu_inline__-attribute.patch \
            file://gmp_fix_for_automake-1.12.patch \
+           file://avoid-h-asm-constraint-for-MIPS.patch \
 "
 
 SRC_URI[md5sum] = "091c56e0e1cca6b09b17b69d47ef18e3"
Signature · 1 line
1.9.1