All of lore.kernel.org
 help / color / mirror / Atom feed
From: nitin.a.kamble@intel.com
To: hjl.tools@gmail.com, openembedded-core@lists.openembedded.org
Subject: [PATCH 04/11] gmp: fix the recipe for x32 target
Date: Fri,  2 Dec 2011 12:20:02 -0800	[thread overview]
Message-ID: <394a7e8600d83b69623bf9e07a933e2d1035e4b2.1322856805.git.nitin.a.kamble@intel.com> (raw)
In-Reply-To: <a92d45d71d2d4aec2774e8feb23fcfdffaa8b2bc.1322856805.git.nitin.a.kamble@intel.com>
In-Reply-To: <cover.1322856805.git.nitin.a.kamble@intel.com>

From: Nitin A Kamble <nitin.a.kamble@intel.com>

Add support for building with x32 toolchain.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 meta/recipes-support/gmp/gmp/gmp_bugfix.patch      |   94 ++++++++++++++++++++
 meta/recipes-support/gmp/gmp/gmp_fix_for_x32.patch |   45 +++++++++
 meta/recipes-support/gmp/gmp_5.0.2.bb              |    6 +-
 3 files changed, 143 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-support/gmp/gmp/gmp_bugfix.patch
 create mode 100644 meta/recipes-support/gmp/gmp/gmp_fix_for_x32.patch

diff --git a/meta/recipes-support/gmp/gmp/gmp_bugfix.patch b/meta/recipes-support/gmp/gmp/gmp_bugfix.patch
new file mode 100644
index 0000000..a96136f
--- /dev/null
+++ b/meta/recipes-support/gmp/gmp/gmp_bugfix.patch
@@ -0,0 +1,94 @@
+UpstreamStatus: Pending
+
+When LONG_MIN is passed to val, -val is undefined.  This patch fixes
+it.  See for details: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50066
+
+Received this patch from H.J. Lu <hjl.tools@gmail.com>
+
+Signed-Off-By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/12/01
+
+--- gmp-4.3.2/mpf/iset_si.c.ll	2010-01-07 12:09:03.000000000 -0800
++++ gmp-4.3.2/mpf/iset_si.c	2011-11-30 16:42:35.827944358 -0800
+@@ -31,7 +31,7 @@ mpf_init_set_si (mpf_ptr r, long int val
+   r->_mp_prec = prec;
+   r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
+ 
+-  vl = (mp_limb_t) (unsigned long int) (val >= 0 ? val : -val);
++  vl = (mp_limb_t) (val >= 0 ? (unsigned long int) val : -(unsigned long int) val);
+ 
+   r->_mp_d[0] = vl & GMP_NUMB_MASK;
+   size = vl != 0;
+--- gmp-4.3.2/mpf/set_si.c.ll	2010-01-07 12:09:03.000000000 -0800
++++ gmp-4.3.2/mpf/set_si.c	2011-11-30 16:42:47.823878367 -0800
+@@ -27,7 +27,7 @@ mpf_set_si (mpf_ptr dest, long val)
+   mp_size_t size;
+   mp_limb_t vl;
+ 
+-  vl = (mp_limb_t) (unsigned long int) (val >= 0 ? val : -val);
++  vl = (mp_limb_t) (val >= 0 ? (unsigned long int) val : -(unsigned long int) val);
+ 
+   dest->_mp_d[0] = vl & GMP_NUMB_MASK;
+   size = vl != 0;
+--- gmp-4.3.2/mpz/cmp_si.c.ll	2010-01-07 12:09:03.000000000 -0800
++++ gmp-4.3.2/mpz/cmp_si.c	2011-11-30 13:44:25.923319700 -0800
+@@ -27,7 +27,7 @@ _mpz_cmp_si (mpz_srcptr u, signed long i
+ {
+   mp_size_t usize = u->_mp_size;
+   mp_size_t vsize;
+-  mp_limb_t u_digit;
++  mp_limb_t u_digit, vl_digit;
+ 
+ #if GMP_NAIL_BITS != 0
+   /* FIXME.  This isn't very pretty.  */
+@@ -41,11 +41,14 @@ _mpz_cmp_si (mpz_srcptr u, signed long i
+ 
+   vsize = 0;
+   if (v_digit > 0)
+-    vsize = 1;
++    {
++      vsize = 1;
++      vl_digit = (mp_limb_t) (unsigned long) v_digit;
++    }
+   else if (v_digit < 0)
+     {
+       vsize = -1;
+-      v_digit = -v_digit;
++      vl_digit = (mp_limb_t) -(unsigned long) v_digit;
+     }
+ 
+   if (usize != vsize)
+@@ -56,10 +59,10 @@ _mpz_cmp_si (mpz_srcptr u, signed long i
+ 
+   u_digit = u->_mp_d[0];
+ 
+-  if (u_digit == (mp_limb_t) (unsigned long) v_digit)
++  if (u_digit == vl_digit)
+     return 0;
+ 
+-  if (u_digit > (mp_limb_t) (unsigned long) v_digit)
++  if (u_digit > vl_digit)
+     return usize;
+   else
+     return -usize;
+--- gmp-4.3.2/mpz/iset_si.c.ll	2010-01-07 12:09:03.000000000 -0800
++++ gmp-4.3.2/mpz/iset_si.c	2011-11-30 13:44:25.924319695 -0800
+@@ -31,7 +31,7 @@ mpz_init_set_si (mpz_ptr dest, signed lo
+   dest->_mp_alloc = 1;
+   dest->_mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+ 
+-  vl = (mp_limb_t) (unsigned long int) (val >= 0 ? val : -val);
++  vl = (mp_limb_t) (val >= 0 ? (unsigned long int) val : -(unsigned long int) val);
+ 
+   dest->_mp_d[0] = vl & GMP_NUMB_MASK;
+   size = vl != 0;
+--- gmp-4.3.2/mpz/set_si.c.ll	2010-01-07 12:09:03.000000000 -0800
++++ gmp-4.3.2/mpz/set_si.c	2011-11-30 13:44:25.947319574 -0800
+@@ -27,7 +27,7 @@ mpz_set_si (mpz_ptr dest, signed long in
+   mp_size_t size;
+   mp_limb_t vl;
+ 
+-  vl = (mp_limb_t) (unsigned long int) (val >= 0 ? val : -val);
++  vl = (mp_limb_t) (val >= 0 ? (unsigned long int) val : -(unsigned long int) val);
+ 
+   dest->_mp_d[0] = vl & GMP_NUMB_MASK;
+   size = vl != 0;
diff --git a/meta/recipes-support/gmp/gmp/gmp_fix_for_x32.patch b/meta/recipes-support/gmp/gmp/gmp_fix_for_x32.patch
new file mode 100644
index 0000000..aa5641c
--- /dev/null
+++ b/meta/recipes-support/gmp/gmp/gmp_fix_for_x32.patch
@@ -0,0 +1,45 @@
+Upstream-Status: Pending
+
+Add X32 support in gmp configure.
+
+Patch Originator: H J Lu @ Intel
+Patch modified for Yocto by Nitin Kamble
+Signed Off By: Nitin A Kamble <nitin.a.kamble@intel.com> 2011/11/21
+
+--- gmp-4.3.2/configure.in.x32	2011-08-12 15:03:06.143548291 -0700
++++ gmp-4.3.2/configure.in	2011-08-12 15:06:20.580595316 -0700
+@@ -1499,6 +1499,25 @@ case $host in
+ 	    path_64="x86_64/atom x86_64"
+ 	    ;;
+ 	esac
++
++	# X32 support.
++	case x"$path_64" in
++	  xx86_64*)
++	    case x"$CC $CFLAGS" in
++	      x*-mx32*)
++		abilist="x32 64 32"
++		path_x32="$path_64"
++		limb_x32=longlong
++		cclist_x32="gcc"
++		gcc_x32_cflags="-O2 -mx32"
++		any_x32_testlist="sizeof-long-4"
++		CALLING_CONVENTIONS_OBJS_x32='amd64call.lo amd64check$U.lo'
++		SPEED_CYCLECOUNTER_OBJ_x32=x86_64.lo
++		cyclecounter_size_x32=2
++		;;
++	    esac
++	    ;;
++	esac
+ 	;;
+     esac
+     ;;
+@@ -3039,7 +3058,7 @@ if test "$gmp_asm_syntax_testing" != no;
+ 	      GMP_INCLUDE_MPN(x86/darwin.m4) ;;
+ 	  esac
+           ;;
+-        64)
++        64|x32)
+           GMP_INCLUDE_MPN(x86_64/x86_64-defs.m4)
+ 	  case $host in
+ 	    *-*-darwin*)
diff --git a/meta/recipes-support/gmp/gmp_5.0.2.bb b/meta/recipes-support/gmp/gmp_5.0.2.bb
index 873fc3e..c28e745 100644
--- a/meta/recipes-support/gmp/gmp_5.0.2.bb
+++ b/meta/recipes-support/gmp/gmp_5.0.2.bb
@@ -2,10 +2,12 @@ require gmp.inc
 LICENSE="LGPLv3&GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \
 		    file://version.c;endline=18;md5=d8c56b52b9092346b9f93b4da65ef790"
-PR = "r2"
+PR = "r3"
 
 SRC_URI_append += "file://sh4-asmfix.patch \
-                   file://use-includedir.patch "
+                   file://gmp_bugfix.patch \
+                   file://use-includedir.patch \
+                   file://gmp_fix_for_x32.patch"
 
 export CC_FOR_BUILD = "${BUILD_CC}"
 
-- 
1.7.6.4




  parent reply	other threads:[~2011-12-02 20:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02 20:19 [PATCH 00/11] recipe fixes for x32 toolchain nitin.a.kamble
2011-12-02 20:19 ` [PATCH 01/11] gst-fluendo-mpegdemux: rework the CC hack nitin.a.kamble
2011-12-03 17:53   ` Khem Raj
2011-12-05 16:59     ` Kamble, Nitin A
2011-12-02 20:20 ` [PATCH 02/11] mdadm: fix CC definition in the Makefile nitin.a.kamble
2011-12-03 18:08   ` Paul Menzel
2011-12-05 16:58     ` Kamble, Nitin A
2011-12-02 20:20 ` [PATCH 03/11] openssl-1.0.0e: fix to wotk with x32 toolchain nitin.a.kamble
2011-12-02 20:20 ` nitin.a.kamble [this message]
2011-12-02 20:20 ` [PATCH 05/11] mesa-dri, mesa-xlib: fix compilation " nitin.a.kamble
2011-12-02 20:20 ` [PATCH 06/11] glib-2.0: fix compilatoin " nitin.a.kamble
2011-12-02 20:20 ` [PATCH 07/11] libxt: " nitin.a.kamble
2011-12-02 20:20 ` [PATCH 08/11] liboil: patch source code for x32 nitin.a.kamble
2011-12-02 20:20 ` [PATCH 09/11] xproto: fix compilation with x32 toolchain nitin.a.kamble
2011-12-02 20:20 ` [PATCH 10/11] libaio: patch source code for x32 nitin.a.kamble
2011-12-02 20:20 ` [PATCH 11/11] libatomics-ops: " nitin.a.kamble
2011-12-05 22:47 ` [PATCH 00/11] recipe fixes for x32 toolchain Richard Purdie

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=394a7e8600d83b69623bf9e07a933e2d1035e4b2.1322856805.git.nitin.a.kamble@intel.com \
    --to=nitin.a.kamble@intel.com \
    --cc=hjl.tools@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.