Skip to content

Commit 2e24d9a

Browse files
sjlangleysmalyshev
authored andcommitted
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
1 parent 6096988 commit 2e24d9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Zend/zend_alloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_
664664

665665
static inline unsigned int zend_mm_high_bit(size_t _size)
666666
{
667-
#if defined(__GNUC__) && defined(i386)
667+
#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
668668
unsigned int n;
669669

670670
__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)
690690

691691
static inline unsigned int zend_mm_low_bit(size_t _size)
692692
{
693-
#if defined(__GNUC__) && defined(i386)
693+
#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
694694
unsigned int n;
695695

696696
__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_
24542454
return _zend_mm_block_size(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
24552455
}
24562456

2457-
#if defined(__GNUC__) && defined(i386)
2457+
#if defined(__GNUC__) && (defined(__native_client__) || defined(i386))
24582458

24592459
static inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
24602460
{

0 commit comments

Comments
 (0)