adjust x32 patch for 5.3 branch
authorElan Ruusamäe <glen@delfi.ee>
Fri, 27 Feb 2015 23:59:26 +0000 (01:59 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Fri, 27 Feb 2015 23:59:26 +0000 (01:59 +0200)
see also https://github.com/php/php-src/pull/1127

x32.patch

index a5cfb7f8adcc9e2bddd91f332404b9535aefc86c..5e4a89aa4d49e37af3cee93845d3963ec5cf371a 100644 (file)
--- a/x32.patch
+++ b/x32.patch
@@ -7,10 +7,8 @@ X-Git-Url: http://72.52.91.13:8000/?p=php-src.git;a=commitdiff_plain;h=514afd67b
 Fix bug #64729: compilation failure on x32
 ---
 
-diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
-index 605e396..0bbd59a 100644
---- a/Zend/zend_alloc.c
-+++ b/Zend/zend_alloc.c
+--- php-5.3.29/Zend/zend_alloc.c~      2015-02-28 01:32:39.000000000 +0200
++++ php-5.3.29/Zend/zend_alloc.c       2015-02-28 01:35:13.896183585 +0200
 @@ -672,7 +672,7 @@ static inline unsigned int zend_mm_high_bit(size_t _size)
  #elif defined(__GNUC__) && defined(__x86_64__)
        unsigned long n;
@@ -35,11 +33,11 @@ index 605e396..0bbd59a 100644
  #else
        static const int offset[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0};
        unsigned int n;
-@@ -2481,12 +2481,22 @@ static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
+@@ -2406,12 +2406,22 @@
          size_t res = nmemb;
          unsigned long overflow = 0;
  
--        __asm__ ("mulq %3\n\taddq %4,%0\n\tadcq %1,%1"
+-        __asm__ ("mulq %3\n\taddq %4,%0\n\tadcq $0,%1"
 +#ifdef __ILP32__ /* x32 */
 +# define LP_SUFF "l"
 +#else /* amd64 */
@@ -48,7 +46,7 @@ index 605e396..0bbd59a 100644
 +
 +        __asm__ ("mul" LP_SUFF  " %3\n\t"
 +                 "add %4,%0\n\t"
-+                 "adc %1,%1"
++                 "adc $0,%1"
               : "=&a"(res), "=&d" (overflow)
               : "%0"(res),
                 "rm"(size),
@@ -59,18 +57,14 @@ index 605e396..0bbd59a 100644
          if (UNEXPECTED(overflow)) {
                  zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
                  return 0;
-diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h
-index c3c9657..092d3cd 100644
---- a/Zend/zend_multiply.h
-+++ b/Zend/zend_multiply.h
-@@ -35,8 +35,8 @@
+--- php-5.3.29/Zend/zend_multiply.h~   2014-08-13 22:22:50.000000000 +0300
++++ php-5.3.29/Zend/zend_multiply.h    2015-02-28 01:57:48.989051739 +0200
+@@ -19,7 +19,7 @@
+ /* $Id$ */
+-#if defined(__i386__) && defined(__GNUC__)
++#if (defined(__i386__) || defined(__x86_64__)) && defined(__GNUC__)
  
  #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do {     \
        long __tmpvar;                                                                                                  \
--      __asm__ ("imulq %3,%0\n"                                                                                \
--              "adcq $0,%1"                                                                                            \
-+      __asm__ ("imul %3,%0\n"                                                                                 \
-+              "adc $0,%1"                                                                                             \
-                       : "=r"(__tmpvar),"=r"(usedval)                                                  \
-                       : "0"(a), "r"(b), "1"(0));                                                              \
-       if (usedval) (dval) = (double) (a) * (double) (b);                              \
This page took 0.117313 seconds and 4 git commands to generate.