com php-src: Support building PHP with the native client toolchain.: Zend/zend_alloc.c
| From: | Stanislav Malyshev | Date: | Mon, 17 Sep 2012 22:52:55 +0000 |
| Subject: | com php-src: Support building PHP with the native client toolchain.: Zend/zend_alloc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-70185@lists.php.net to get a copy of this message | ||
Commit: 2e24d9a2b3cc5becafb0fd3805a22cd87daa1f18
Author: Stuart Langley <slangley@google.com> Thu, 13 Sep 2012 17:37:37 +0200
Committer: Stanislav Malyshev <stas@php.net> Mon, 17 Sep 2012 15:52:55 -0700
Parents: 6096988704d3cbcde364fae506cd6b8a2b8181f4
Branches: PHP-5.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2e24d9a2b3cc5becafb0fd3805a22cd87daa1f18
Log:
Support building PHP with the native client toolchain.
The native client compiler defines the C macro __x86_64__, but the size
of an unsigned int is only 4 bytes. This causes the compile to fail
because the inline asm code compiled is for an 8 byte unsigned int. Add
the correct defines to fix this.
As detailed in:
http://code.google.com/p/nativeclient/issues/detail?id=2255
Changed paths:
M Zend/zend_alloc.c
Diff:
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 66cd23c..0b0e863 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -664,7 +664,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
static inline unsigned int zend_mm_high_bit(size_t _size)
{
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
unsigned int n;
__asm__("bsrl %1,%0\n\t" : "=r" (n) : "rm" (_size));
@@ -690,7 +690,7 @@ static inline unsigned int zend_mm_high_bit(size_t _size)
static inline unsigned int zend_mm_low_bit(size_t _size)
{
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
unsigned int n;
__asm__("bsfl %1,%0\n\t" : "=r" (n) : "rm" (_size));
@@ -2454,7 +2454,7 @@ ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC
ZEND_
return _zend_mm_block_size(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
-#if defined(__GNUC__) && defined(i386)
+#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{