Skip to contentSkip to conversation

modphp: enable endian check

PATCH In review [email protected] 1 participant 2 messages Dec 10, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modphp: enable endian check

From: Chong Lu <[email protected]>

Previously, modphp estimates endian on host rather than checks it on target. If the host is little-endian and the target is big-endian, modphp claims that endian is little. As a result, a memory location that it is not allowed to access when calling libphp5.so module on target. It will occur segmentation fault.
This patch enables endian check support for modphp.

---
 recipes-php/modphp/modphp5.inc |    2 ++
 1 file changed, 2 insertions(+)
recipes-php/modphp/modphp5.inc +2 -0
index 19f1be9..425faa2 100644
@@ -44,6 +44,8 @@ EXTRA_OECONF = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs \
                 --enable-mbstring \
                 --with-config-file-path=${sysconfdir}/php/apache2-php5"
 
+EXTRA_OECONF += "${@base_conditional('SITEINFO_ENDIANNESS', 'le', 'ac_cv_c_bigendian_php=no', 'ac_cv_c_bigendian_php=yes', d)}"
+
 PACKAGECONFIG ??= "mysql"
 PACKAGECONFIG[mysql] = "--with-mysqli=${STAGING_BINDIR_CROSS}/mysql_config,--without-mysqli,mysql5"
 PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,mysql5"
Signature · 1 line
1.7.9.5
author
#1 lore raw

Please ignore this one. I will resend.

Best Regards
Chong

Quoted 27 lines · On 12/10/2013 04:32 PM, [email protected] wrote:

From: Chong Lu <[email protected]>

Previously, modphp estimates endian on host rather than checks it on target. If the host is little-endian and the target is big-endian, modphp claims that endian is little. As a result, a memory location that it is not allowed to access when calling libphp5.so module on target. It will occur segmentation fault.
This patch enables endian check support for modphp.

---
  recipes-php/modphp/modphp5.inc |    2 ++
  1 file changed, 2 insertions(+)
recipes-php/modphp/modphp5.inc +2 -0
index 19f1be9..425faa2 100644
@@ -44,6 +44,8 @@ EXTRA_OECONF = "--with-apxs2=${STAGING_BINDIR_CROSS}/apxs \
                  --enable-mbstring \
                  --with-config-file-path=${sysconfdir}/php/apache2-php5"
 
+EXTRA_OECONF += "${@base_conditional('SITEINFO_ENDIANNESS', 'le', 'ac_cv_c_bigendian_php=no', 'ac_cv_c_bigendian_php=yes', d)}"
+
  PACKAGECONFIG ??= "mysql"
  PACKAGECONFIG[mysql] = "--with-mysqli=${STAGING_BINDIR_CROSS}/mysql_config,--without-mysqli,mysql5"
  PACKAGECONFIG[pgsql] = "--with-pgsql=${STAGING_DIR_TARGET}${exec_prefix},--without-pgsql,mysql5"