Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Andre McCurdy <armccurdy@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [daisy][PATCH 3/6] gmp_4.2.1: fix build for MIPS
Date: Tue, 20 Mar 2018 19:42:26 -0700	[thread overview]
Message-ID: <1521600149-3894-4-git-send-email-armccurdy@gmail.com> (raw)
In-Reply-To: <1521600149-3894-1-git-send-email-armccurdy@gmail.com>

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).

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
(cherry picked from commit f8b2eb5eb09a1314ef59e58df95e81c1c1ccf1f4)
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
---
 .../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

diff --git a/meta/recipes-support/gmp/gmp-4.2.1/avoid-h-asm-constraint-for-MIPS.patch b/meta/recipes-support/gmp/gmp-4.2.1/avoid-h-asm-constraint-for-MIPS.patch
new file mode 100644
index 0000000..6da0be9
--- /dev/null
+++ b/meta/recipes-support/gmp/gmp-4.2.1/avoid-h-asm-constraint-for-MIPS.patch
@@ -0,0 +1,57 @@
+From d50686de0406a88ef9112f5252103f799982e84a Mon Sep 17 00:00:00 2001
+From: Andre McCurdy <armccurdy@gmail.com>
+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 <armccurdy@gmail.com>
+---
+ 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
+
diff --git a/meta/recipes-support/gmp/gmp_4.2.1.bb b/meta/recipes-support/gmp/gmp_4.2.1.bb
index 362aacf..baec709 100644
--- a/meta/recipes-support/gmp/gmp_4.2.1.bb
+++ b/meta/recipes-support/gmp/gmp_4.2.1.bb
@@ -12,6 +12,7 @@ PR = "r2"
 SRC_URI = "${GNU_MIRROR}/gmp/${BP}.tar.bz2 \
            file://disable-stdc.patch \
            file://gmp_fix_for_automake-1.12.patch \
+           file://avoid-h-asm-constraint-for-MIPS.patch \
            "
 
 SRC_URI[md5sum] = "091c56e0e1cca6b09b17b69d47ef18e3"
-- 
1.9.1



  parent reply	other threads:[~2018-03-21  2:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21  2:42 [daisy][PATCH 0/6] SRC_URI updates and minor build fixes Andre McCurdy
2018-03-21  2:42 ` [daisy][PATCH 1/6] dtc: old SRC_URI died, changing to new working one Andre McCurdy
2018-03-21  2:42 ` [daisy][PATCH 2/6] kernel.bbclass: Remove bashism Andre McCurdy
2018-03-21  2:42 ` Andre McCurdy [this message]
2018-03-21  2:42 ` [daisy][PATCH 4/6] ncurses: fix build with gcc 5 Andre McCurdy
2018-03-21  2:42 ` [daisy][PATCH 5/6] binutils: " Andre McCurdy
2018-03-21  2:42 ` [daisy][PATCH 6/6] mesa: fix SRC_URI Andre McCurdy
2018-05-08  1:22 ` [daisy][PATCH 0/6] SRC_URI updates and minor build fixes Andre McCurdy
2018-05-08  7:40   ` Richard Purdie
2018-05-08  9:06     ` Andre McCurdy
2018-05-08  9:15       ` Richard Purdie
2018-05-08 22:07         ` Andre McCurdy
2018-05-09 11:09           ` Richard Purdie
2018-05-10  4:36             ` Andre McCurdy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1521600149-3894-4-git-send-email-armccurdy@gmail.com \
    --to=armccurdy@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox