summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-04-04 21:58:11 +0000
committerMike Frysinger <vapier@gentoo.org>2007-04-04 21:58:11 +0000
commit2b1419790b7c91d256e4269d35eb3a669cae4d4e (patch)
tree70f33a5c4e7e2ec4773a79b696315c3156a11c19 /dev-libs/gmp/files
parentMarked stable on PPC. Tested on PowerBook 5,9 connected to ejabberd. As reque... (diff)
downloadgentoo-2-2b1419790b7c91d256e4269d35eb3a669cae4d4e.tar.gz
gentoo-2-2b1419790b7c91d256e4269d35eb3a669cae4d4e.tar.bz2
gentoo-2-2b1419790b7c91d256e4269d35eb3a669cae4d4e.zip
Some more fixes from upstream and snipe a fix for s390x from SuSE.
(Portage version: 2.1.2.3)
Diffstat (limited to 'dev-libs/gmp/files')
-rw-r--r--dev-libs/gmp/files/4.2.1/gmpxx.h.ternary.diff519
-rw-r--r--dev-libs/gmp/files/4.2.1/mpz_set_d.diff12
-rw-r--r--dev-libs/gmp/files/digest-gmp-4.2.1-r16
-rw-r--r--dev-libs/gmp/files/gmp-4.1.4-noexecstack.patch2
-rw-r--r--dev-libs/gmp/files/gmp-4.2.1-s390.diff68
5 files changed, 606 insertions, 1 deletions
diff --git a/dev-libs/gmp/files/4.2.1/gmpxx.h.ternary.diff b/dev-libs/gmp/files/4.2.1/gmpxx.h.ternary.diff
new file mode 100644
index 000000000000..79bbb1ab3807
--- /dev/null
+++ b/dev-libs/gmp/files/4.2.1/gmpxx.h.ternary.diff
@@ -0,0 +1,519 @@
+Index: gmpxx.h
+===================================================================
+RCS file: /home/cvsfiles/gmp42/gmpxx.h,v
+retrieving revision 1.4
+retrieving revision 1.5
+diff -p -2 -r1.4 -r1.5
+*** gmpxx.h 8 Apr 2006 19:58:48 -0000 1.4
+--- gmpxx.h 31 Oct 2006 10:40:59 -0000 1.5
+*************** struct __gmp_cmp_function
+*** 1278,1367 ****
+ };
+
+- struct __gmp_ternary_addmul // z = w + v * u
+- {
+- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, mpz_srcptr u)
+- { mpz_set(z, w); mpz_addmul(z, v, u); }
+-
+- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, unsigned long int l)
+- { mpz_set(z, w); mpz_addmul_ui(z, v, l); }
+- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l, mpz_srcptr v)
+- { mpz_set(z, w); mpz_addmul_ui(z, v, l); }
+- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, signed long int l)
+- {
+- mpz_set(z, w);
+- if (l >= 0)
+- mpz_addmul_ui(z, v, l);
+- else
+- mpz_submul_ui(z, v, -l);
+- }
+- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l, mpz_srcptr v)
+- {
+- mpz_set(z, w);
+- if (l >= 0)
+- mpz_addmul_ui(z, v, l);
+- else
+- mpz_submul_ui(z, v, -l);
+- }
+- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, double d)
+- {
+- mpz_t temp;
+- mpz_init_set_d(temp, d);
+- mpz_set(z, w);
+- mpz_addmul(z, v, temp);
+- mpz_clear(temp);
+- }
+- static void eval(mpz_ptr z, mpz_srcptr w, double d, mpz_srcptr v)
+- {
+- mpz_t temp;
+- mpz_init_set_d(temp, d);
+- mpz_set(z, w);
+- mpz_addmul(z, temp, v);
+- mpz_clear(temp);
+- }
+- };
+-
+- struct __gmp_ternary_submul // z = w - v * u
+- {
+- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, mpz_srcptr u)
+- { mpz_set(z, w); mpz_submul(z, v, u); }
+-
+- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, unsigned long int l)
+- { mpz_set(z, w); mpz_submul_ui(z, v, l); }
+- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l, mpz_srcptr v)
+- { mpz_set(z, w); mpz_submul_ui(z, v, l); }
+- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, signed long int l)
+- {
+- mpz_set(z, w);
+- if (l >= 0)
+- mpz_submul_ui(z, v, l);
+- else
+- mpz_addmul_ui(z, v, -l);
+- }
+- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l, mpz_srcptr v)
+- {
+- mpz_set(z, w);
+- if (l >= 0)
+- mpz_submul_ui(z, v, l);
+- else
+- mpz_addmul_ui(z, v, -l);
+- }
+- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v, double d)
+- {
+- mpz_t temp;
+- mpz_init_set_d(temp, d);
+- mpz_set(z, w);
+- mpz_submul(z, v, temp);
+- mpz_clear(temp);
+- }
+- static void eval(mpz_ptr z, mpz_srcptr w, double d, mpz_srcptr v)
+- {
+- mpz_t temp;
+- mpz_init_set_d(temp, d);
+- mpz_set(z, w);
+- mpz_submul(z, temp, v);
+- mpz_clear(temp);
+- }
+- };
+-
+ struct __gmp_rand_function
+ {
+--- 1278,1281 ----
+*************** __GMPZQ_DEFINE_EXPR(__gmp_binary_minus)
+*** 2863,3277 ****
+
+
+- /* Integer ternary expressions of the kind `a+b*c' or `a*b+c' can be
+- evaluated directly via mpz_addmul */
+-
+- // a + b * c
+- #define __GMP_DEFINE_TERNARY_EXPR(eval_fun1, eval_fun2, eval_both) \
+- \
+- template <> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr \
+- <mpz_t, __gmp_binary_expr<mpz_class, mpz_class, eval_fun1> >, eval_fun2> > \
+- { \
+- private: \
+- typedef mpz_class val1_type; \
+- typedef __gmp_expr \
+- <mpz_t, __gmp_binary_expr<mpz_class, mpz_class, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { eval_both::eval \
+- (z, expr.val1.get_mpz_t(), expr.val2.get_val1().get_mpz_t(), \
+- expr.val2.get_val2().get_mpz_t()); } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr \
+- <mpz_t, __gmp_binary_expr<mpz_class, T, eval_fun1> >, eval_fun2> > \
+- { \
+- private: \
+- typedef mpz_class val1_type; \
+- typedef __gmp_expr \
+- <mpz_t, __gmp_binary_expr<mpz_class, T, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { eval_both::eval \
+- (z, expr.val1.get_mpz_t(), expr.val2.get_val1().get_mpz_t(), \
+- expr.val2.get_val2()); } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr \
+- <mpz_t, __gmp_binary_expr<T, mpz_class, eval_fun1> >, eval_fun2> > \
+- { \
+- private: \
+- typedef mpz_class val1_type; \
+- typedef __gmp_expr \
+- <mpz_t, __gmp_binary_expr<T, mpz_class, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { eval_both::eval \
+- (z, expr.val1.get_mpz_t(), expr.val2.get_val1(), \
+- expr.val2.get_val2().get_mpz_t()); } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr \
+- <mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr<mpz_t, T>, eval_fun1> >, \
+- eval_fun2> > \
+- { \
+- private: \
+- typedef mpz_class val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <mpz_class, __gmp_expr<mpz_t, T>, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp(expr.val2.get_val2()); \
+- eval_both::eval \
+- (z, expr.val1.get_mpz_t(), expr.val2.get_val1().get_mpz_t(), \
+- temp.get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr \
+- <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, mpz_class, eval_fun1> >, \
+- eval_fun2> > \
+- { \
+- private: \
+- typedef mpz_class val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <__gmp_expr<mpz_t, T>, mpz_class, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp(expr.val2.get_val1()); \
+- eval_both::eval(z, expr.val1.get_mpz_t(), temp.get_mpz_t(), \
+- expr.val2.get_val2().get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr \
+- <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, U, eval_fun1> >, \
+- eval_fun2> > \
+- { \
+- private: \
+- typedef mpz_class val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <__gmp_expr<mpz_t, T>, U, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp(expr.val2.get_val1()); \
+- eval_both::eval \
+- (z, expr.val1.get_mpz_t(), temp.get_mpz_t(), expr.val2.get_val2()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr \
+- <mpz_t, __gmp_binary_expr<T, __gmp_expr<mpz_t, U>, eval_fun1> >, \
+- eval_fun2> > \
+- { \
+- private: \
+- typedef mpz_class val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <T, __gmp_expr<mpz_t, U>, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp(expr.val2.get_val2()); \
+- eval_both::eval \
+- (z, expr.val1.get_mpz_t(), expr.val2.get_val1(), temp.get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr \
+- <mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, __gmp_expr<mpz_t, U>, \
+- eval_fun1> >, eval_fun2> > \
+- { \
+- private: \
+- typedef mpz_class val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <__gmp_expr<mpz_t, T>, __gmp_expr<mpz_t, U>, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp1(expr.val2.get_val1()); \
+- mpz_class temp2(expr.val2.get_val2()); \
+- eval_both::eval \
+- (z, expr.val1.get_mpz_t(), temp1.get_mpz_t(), temp2.get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, \
+- __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, mpz_class, eval_fun1> >, \
+- eval_fun2> > \
+- { \
+- private: \
+- typedef __gmp_expr<mpz_t, T> val1_type; \
+- typedef __gmp_expr \
+- <mpz_t, __gmp_binary_expr<mpz_class, mpz_class, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp(expr.val1); \
+- eval_both::eval(z, temp.get_mpz_t(), expr.val2.get_val1().get_mpz_t(), \
+- expr.val2.get_val2().get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, \
+- __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, U, eval_fun1> >, \
+- eval_fun2> > \
+- { \
+- private: \
+- typedef __gmp_expr<mpz_t, T> val1_type; \
+- typedef __gmp_expr \
+- <mpz_t, __gmp_binary_expr<mpz_class, U, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp(expr.val1); \
+- eval_both::eval(z, temp.get_mpz_t(), expr.val2.get_val1().get_mpz_t(), \
+- expr.val2.get_val2()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, \
+- __gmp_expr<mpz_t, __gmp_binary_expr<U, mpz_class, eval_fun1> >, \
+- eval_fun2> > \
+- { \
+- private: \
+- typedef __gmp_expr<mpz_t, T> val1_type; \
+- typedef __gmp_expr \
+- <mpz_t, __gmp_binary_expr<U, mpz_class, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp(expr.val1); \
+- eval_both::eval(z, temp.get_mpz_t(), expr.val2.get_val1(), \
+- expr.val2.get_val2().get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, \
+- __gmp_expr<mpz_t, __gmp_binary_expr<mpz_class, __gmp_expr<mpz_t, U>, \
+- eval_fun1> >, eval_fun2> > \
+- { \
+- private: \
+- typedef __gmp_expr<mpz_t, T> val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <mpz_class, __gmp_expr<mpz_t, U>, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp1(expr.val1); \
+- mpz_class temp2(expr.val2.get_val2()); \
+- eval_both::eval \
+- (z, temp1.get_mpz_t(), expr.val2.get_val1().get_mpz_t(), \
+- temp2.get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, \
+- __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, U>, mpz_class, \
+- eval_fun1> >, eval_fun2> > \
+- { \
+- private: \
+- typedef __gmp_expr<mpz_t, T> val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <__gmp_expr<mpz_t, U>, mpz_class, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp1(expr.val1); \
+- mpz_class temp2(expr.val2.get_val1()); \
+- eval_both::eval(z, temp1.get_mpz_t(), temp2.get_mpz_t(), \
+- expr.val2.get_val2().get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U, class V> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, \
+- __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, U>, V, \
+- eval_fun1> >, eval_fun2> > \
+- { \
+- private: \
+- typedef __gmp_expr<mpz_t, T> val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <__gmp_expr<mpz_t, U>, V, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp1(expr.val1); \
+- mpz_class temp2(expr.val2.get_val1()); \
+- eval_both::eval \
+- (z, temp1.get_mpz_t(), temp2.get_mpz_t(), expr.val2.get_val2()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U, class V> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, \
+- __gmp_expr<mpz_t, __gmp_binary_expr<U, __gmp_expr<mpz_t, V>, \
+- eval_fun1> >, eval_fun2> > \
+- { \
+- private: \
+- typedef __gmp_expr<mpz_t, T> val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <U, __gmp_expr<mpz_t, V>, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp1(expr.val1); \
+- mpz_class temp2(expr.val2.get_val2()); \
+- eval_both::eval \
+- (z, temp1.get_mpz_t(), expr.val2.get_val1(), temp2.get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- }; \
+- \
+- template <class T, class U, class V> \
+- class __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, \
+- __gmp_expr<mpz_t, __gmp_binary_expr<__gmp_expr<mpz_t, U>, \
+- __gmp_expr<mpz_t, V>, eval_fun1> >, eval_fun2> > \
+- { \
+- private: \
+- typedef __gmp_expr<mpz_t, T> val1_type; \
+- typedef __gmp_expr<mpz_t, __gmp_binary_expr \
+- <__gmp_expr<mpz_t, U>, __gmp_expr<mpz_t, V>, eval_fun1> > val2_type; \
+- \
+- __gmp_binary_expr<val1_type, val2_type, eval_fun2> expr; \
+- public: \
+- __gmp_expr(const val1_type &val1, const val2_type &val2) \
+- : expr(val1, val2) { } \
+- void eval(mpz_ptr z) const \
+- { \
+- mpz_class temp1(expr.val1); \
+- mpz_class temp2(expr.val2.get_val1()); \
+- mpz_class temp3(expr.val2.get_val2()); \
+- eval_both::eval \
+- (z, temp1.get_mpz_t(), temp2.get_mpz_t(), temp3.get_mpz_t()); \
+- } \
+- const val1_type & get_val1() const { return expr.val1; } \
+- const val2_type & get_val2() const { return expr.val2; } \
+- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
+- };
+-
+-
+- __GMP_DEFINE_TERNARY_EXPR(__gmp_binary_multiplies, __gmp_binary_plus,
+- __gmp_ternary_addmul)
+- __GMP_DEFINE_TERNARY_EXPR(__gmp_binary_multiplies, __gmp_binary_minus,
+- __gmp_ternary_submul)
+
+ /**************** Macros for defining functions ****************/
+--- 2777,2780 ----
diff --git a/dev-libs/gmp/files/4.2.1/mpz_set_d.diff b/dev-libs/gmp/files/4.2.1/mpz_set_d.diff
new file mode 100644
index 000000000000..6c4d0cfdcbbb
--- /dev/null
+++ b/dev-libs/gmp/files/4.2.1/mpz_set_d.diff
@@ -0,0 +1,12 @@
+*** mpz/set_d.c 14 Mar 2006 15:57:54 -0000 1.1
+--- mpz/set_d.c 31 May 2006 14:50:05 -0000 1.2
+*************** mpz_set_d (mpz_ptr r, double d)
+*** 57,60 ****
+--- 58,64 ----
+ _mpz_realloc (r, rn);
+
++ if (rn <= 0)
++ rn = 0;
++
+ rp = PTR (r);
+
diff --git a/dev-libs/gmp/files/digest-gmp-4.2.1-r1 b/dev-libs/gmp/files/digest-gmp-4.2.1-r1
new file mode 100644
index 000000000000..dc6f8c7b5df0
--- /dev/null
+++ b/dev-libs/gmp/files/digest-gmp-4.2.1-r1
@@ -0,0 +1,6 @@
+MD5 091c56e0e1cca6b09b17b69d47ef18e3 gmp-4.2.1.tar.bz2 1726453
+RMD160 831e02a36ac7b466857f8fafeffad7d51f7656e7 gmp-4.2.1.tar.bz2 1726453
+SHA256 d07ffcb37eecec35c5ec72516d10b35fdf6e6fef1fcf1dcd37e30b8cbf8bf941 gmp-4.2.1.tar.bz2 1726453
+MD5 09ab91ee64673cb78af2a02a310fd15b gmp-man-4.2.1.pdf 996792
+RMD160 3f8ea92b95e985d09ed8d5b45952ccf98fbd9dac gmp-man-4.2.1.pdf 996792
+SHA256 3bee6b5285eea339a5ea949cd9db12fe5f676f15beff8ae9cbee0011be24beef gmp-man-4.2.1.pdf 996792
diff --git a/dev-libs/gmp/files/gmp-4.1.4-noexecstack.patch b/dev-libs/gmp/files/gmp-4.1.4-noexecstack.patch
index 8adc25d8b3e2..56f4604fc763 100644
--- a/dev-libs/gmp/files/gmp-4.1.4-noexecstack.patch
+++ b/dev-libs/gmp/files/gmp-4.1.4-noexecstack.patch
@@ -13,7 +13,7 @@ fixed executable stack as per bug #115038 thanks to Petteri Räty
--- gmp-4.1.4/nostackexec
+++ gmp-4.1.4/nostackexec
@@ -0,0 +1,4 @@
-+#ifdef __ELF__
++#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits
+.previous
+#endif
diff --git a/dev-libs/gmp/files/gmp-4.2.1-s390.diff b/dev-libs/gmp/files/gmp-4.2.1-s390.diff
new file mode 100644
index 000000000000..82dbb722eb14
--- /dev/null
+++ b/dev-libs/gmp/files/gmp-4.2.1-s390.diff
@@ -0,0 +1,68 @@
+stolen from SuSE
+
+--- configure.in
++++ configure.in
+@@ -1050,6 +1050,9 @@
+ ;;
+
+
++ s390x-*-*)
++ path="s390x" ;;
++
+ # IBM s/370 and similar
+ [s3[6-9]0*-*-*])
+ gcc_cflags="-O2 $fomit_frame_pointer"
+--- configure
++++ configure
+@@ -1050,6 +1050,9 @@
+ ;;
+
+
++ s390x-*-*)
++ path="s390x" ;;
++
+ # IBM s/370 and similar
+ s3[6-9]0*-*-*)
+ gcc_cflags="-O2 $fomit_frame_pointer"
+--- mpn/s390/gmp-mparam.h
++++ mpn/s390/gmp-mparam.h
+@@ -20,7 +20,8 @@
+ MA 02110-1301, USA. */
+
+
+-/* BITS_PER_MP_LIMB etc generated by configure */
++#define BITS_PER_MP_LIMB 32
++#define BYTES_PER_MP_LIMB 4
+
+
+ /* Generated by tuneup.c, 2001-12-03, gcc 2.95 */
+--- mpn/s390x/gmp-mparam.h
++++ mpn/s390x/gmp-mparam.h
+@@ -0,0 +1,27 @@
++/* gmp-mparam.h -- Compiler/machine parameter header file.
++
++Copyright (C) 1991, 1993, 1994, 1995 Free Software Foundation, Inc.
++
++This file is part of the GNU MP Library.
++
++The GNU MP Library is free software; you can redistribute it and/or modify
++it under the terms of the GNU Library General Public License as published by
++the Free Software Foundation; either version 2 of the License, or (at your
++option) any later version.
++
++The GNU MP Library is distributed in the hope that it will be useful, but
++WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
++License for more details.
++
++You should have received a copy of the GNU Library General Public License
++along with the GNU MP Library; see the file COPYING.LIB. If not, write to
++the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
++MA 02111-1307, USA. */
++
++#define BITS_PER_MP_LIMB 64
++#define BYTES_PER_MP_LIMB 8
++#define BITS_PER_LONGINT 64
++#define BITS_PER_INT 32
++#define BITS_PER_SHORTINT 16
++#define BITS_PER_CHAR 8