Patchwork gmp: redefine a function

login
register
mail settings
Submitter rongqing.li@windriver.com
Date July 28, 2014, 11:01 a.m.
Message ID <1406545263-7393-1-git-send-email-rongqing.li@windriver.com>
Download mbox | patch
Permalink /patch/76749/
State New
Headers show

Comments

rongqing.li@windriver.com - July 28, 2014, 11:01 a.m.
From: Roy Li <rongqing.li@windriver.com>

redefine a function to make it be able to work on mips64 64BIT ABI

Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
 .../gmp/gmp-4.2.1/reimplement_umul_ppmm.patch      |   39 ++++++++++++++++++++
 meta/recipes-support/gmp/gmp_4.2.1.bb              |    1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-support/gmp/gmp-4.2.1/reimplement_umul_ppmm.patch
Khem Raj - July 28, 2014, 5:25 p.m.
On Mon, Jul 28, 2014 at 4:01 AM,  <rongqing.li@windriver.com> wrote:
> +[PATCH] reimplement umul_ppmm to make it be able to building on mips64 64bit ABI
> +
> +Upstream-Status: Pending[This version was not maintained by upstream, larger versions have been fixed]
> +

if you mean newer release have been fixed then this patch should be
marked 'Backport'
rongqing.li@windriver.com - July 29, 2014, 12:36 a.m.
On 07/29/2014 01:25 AM, Khem Raj wrote:
> On Mon, Jul 28, 2014 at 4:01 AM,  <rongqing.li@windriver.com> wrote:
>> +[PATCH] reimplement umul_ppmm to make it be able to building on mips64 64bit ABI
>> +
>> +Upstream-Status: Pending[This version was not maintained by upstream, larger versions have been fixed]
>> +
>
> if you mean newer release have been fixed then this patch should be
> marked 'Backport'
>


newer releases are GPLv3, we can not backport patch from them

-R

>
Khem Raj - July 29, 2014, 12:43 a.m.
On Mon, Jul 28, 2014 at 5:36 PM, Rongqing Li <rongqing.li@windriver.com> wrote:
>
>
> On 07/29/2014 01:25 AM, Khem Raj wrote:
>>
>> On Mon, Jul 28, 2014 at 4:01 AM,  <rongqing.li@windriver.com> wrote:
>>>
>>> +[PATCH] reimplement umul_ppmm to make it be able to building on mips64
>>> 64bit ABI
>>> +
>>> +Upstream-Status: Pending[This version was not maintained by upstream,
>>> larger versions have been fixed]
>>> +
>>
>>
>> if you mean newer release have been fixed then this patch should be
>> marked 'Backport'
>>
>
>
> newer releases are GPLv3, we can not backport patch from them

I see. So you did a clean room implementation then ? if not then
you could request the original patch author to release it under GPLv2
license for back portability

>
> -R
>
>>
>
> --
> Best Reagrds,
> Roy | RongQing Li
rongqing.li@windriver.com - July 29, 2014, 12:53 a.m.
On 07/29/2014 08:43 AM, Khem Raj wrote:
> On Mon, Jul 28, 2014 at 5:36 PM, Rongqing Li <rongqing.li@windriver.com> wrote:
>>
>>
>> On 07/29/2014 01:25 AM, Khem Raj wrote:
>>>
>>> On Mon, Jul 28, 2014 at 4:01 AM,  <rongqing.li@windriver.com> wrote:
>>>>
>>>> +[PATCH] reimplement umul_ppmm to make it be able to building on mips64
>>>> 64bit ABI
>>>> +
>>>> +Upstream-Status: Pending[This version was not maintained by upstream,
>>>> larger versions have been fixed]
>>>> +
>>>
>>>
>>> if you mean newer release have been fixed then this patch should be
>>> marked 'Backport'
>>>
>>
>>
>> newer releases are GPLv3, we can not backport patch from them
>
> I see. So you did a clean room implementation then ? if not then
> you could request the original patch author to release it under GPLv2
> license for back portability
>

Ok, I will ask;
But If the author do not like to release it under GPLv2, what should I do?

-Roy


>>
>> -R
>>
>>>
>>
>> --
>> Best Reagrds,
>> Roy | RongQing Li
>
>
Khem Raj - July 29, 2014, 12:55 a.m.
On Mon, Jul 28, 2014 at 5:53 PM, Rongqing Li <rongqing.li@windriver.com> wrote:
> But If the author do not like to release it under GPLv2, what should I do?

it has to then be a clean room implementation.

Patch

diff --git a/meta/recipes-support/gmp/gmp-4.2.1/reimplement_umul_ppmm.patch b/meta/recipes-support/gmp/gmp-4.2.1/reimplement_umul_ppmm.patch
new file mode 100644
index 0000000..739d88a
--- /dev/null
+++ b/meta/recipes-support/gmp/gmp-4.2.1/reimplement_umul_ppmm.patch
@@ -0,0 +1,39 @@ 
+[PATCH] reimplement umul_ppmm to make it be able to building on mips64 64bit ABI
+
+Upstream-Status: Pending[This version was not maintained by upstream, larger versions have been fixed]
+
+Signed-off-by: Roy.Li <rongqing.li@windriver.com>
+---
+ longlong.h | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/longlong.h b/longlong.h
+index b53fbee..faa845a 100644
+--- a/longlong.h
++++ b/longlong.h
+@@ -1024,10 +1024,20 @@ extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype));
+ #endif /* __mips */
+ 
+ #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
+-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
++#if __GMP_GNUC_PREREQ (4,4)
++#define umul_ppmm(w1, w0, u, v) \
++  do {						\
++    typedef unsigned int __ll_UTItype __attribute__((mode(TI)));	\
++    __ll_UTItype __ll = (__ll_UTItype)(u) * (v);	\
++    w1 = __ll >> 64;					\
++    w0 = __ll;						\
++  } while (0)
++#endif
++#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7)
+ #define umul_ppmm(w1, w0, u, v) \
+   __asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
+-#else
++#endif
++#if !defined (umul_ppmm)
+ #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))
+-- 
+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 69ad0ca..216ee41 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://reimplement_umul_ppmm.patch \
            "
 
 SRC_URI[md5sum] = "091c56e0e1cca6b09b17b69d47ef18e3"