Skip to content

Add the correct build definitions for cross compiling with the Native Client toolchain. #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions TSRM/threads.m4
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ int main() {
case $host_alias in
*netware*)
pthreads_working=yes
;;
*nacl*)
pthreads_working=yes
;;
esac
]
) ] )dnl
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_multiply.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/* $Id$ */

#if defined(__i386__) && defined(__GNUC__)
#if (defined(__i386__) || defined(__native_client__)) && defined(__GNUC__)

#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
long __tmpvar; \
Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_operators.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ ZEND_API void zend_update_current_locale(void);
static zend_always_inline int fast_increment_function(zval *op1)
{
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__)
#if defined(__GNUC__) && (defined(__native_client__) || defined(__i386__))
__asm__(
"incl (%0)\n\t"
"jno 0f\n\t"
Expand Down Expand Up @@ -514,7 +514,7 @@ static zend_always_inline int fast_increment_function(zval *op1)
static zend_always_inline int fast_decrement_function(zval *op1)
{
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__)
#if defined(__GNUC__) && (defined(__native_client__) || defined(__i386__))
__asm__(
"decl (%0)\n\t"
"jno 0f\n\t"
Expand Down Expand Up @@ -552,7 +552,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o
{
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__)
#if defined(__GNUC__) && (defined(__native_client__) || defined(__i386__))
__asm__(
"movl (%1), %%eax\n\t"
"addl (%2), %%eax\n\t"
Expand Down Expand Up @@ -627,7 +627,7 @@ static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *o
{
if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
#if defined(__GNUC__) && defined(__i386__)
#if defined(__GNUC__) && (defined(__native_client__) || defined(__i386__))
__asm__(
"movl (%1), %%eax\n\t"
"subl (%2), %%eax\n\t"
Expand Down
8 changes: 7 additions & 1 deletion acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,15 @@ dnl
dnl PHP_CHECK_TYPES(type-list, include-file [, extra-headers])
dnl
AC_DEFUN([PHP_CHECK_TYPES], [
cross_compile_value=0
case $host_alias in
*nacl*)
cross_compile_value=1
;;
esac
for php_typename in $1; do
AC_MSG_CHECKING([whether $php_typename exists])
_PHP_CHECK_SIZEOF($php_typename, 0, $3, [
_PHP_CHECK_SIZEOF($php_typename, cross_compile_value, $3, [
_PHP_DEF_HAVE_FILE($php_typename, $2)
AC_MSG_RESULT([yes])
], [
Expand Down
6 changes: 6 additions & 0 deletions config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,10 @@ case $basic_machine in
basic_machine=i370-ibm
os=-mvs
;;
nacl)
basic_machine=i686-pc
os=-nacl
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
Expand Down Expand Up @@ -1388,6 +1392,8 @@ case $os in
-zvmoe)
os=-zvmoe
;;
-nacl*)
;;
-none)
;;
*)
Expand Down