Patchwork [meta-webserver] modphp: enable endian check

login
register
mail settings
Submitter Chong.Lu@windriver.com
Date Dec. 10, 2013, 10:03 a.m.
Message ID <1386669781-26578-1-git-send-email-Chong.Lu@windriver.com>
Download mbox | patch
Permalink /patch/63125/
State Accepted, archived
Headers show

Comments

Chong.Lu@windriver.com - Dec. 10, 2013, 10:03 a.m.
From: Chong Lu <Chong.Lu@windriver.com>

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.

Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
---
 meta-webserver/recipes-php/modphp/modphp5.inc |    2 ++
 1 file changed, 2 insertions(+)
Paul Eggleton - Dec. 12, 2013, 12:18 p.m.
Hi Chong,

On Tuesday 10 December 2013 18:03:01 Chong.Lu@windriver.com wrote:
> From: Chong Lu <Chong.Lu@windriver.com>
> 
> 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.
> 
> Signed-off-by: Chong Lu <Chong.Lu@windriver.com>

Merged, with a minor tweak to add the value to the end of the existing 
EXTRA_OECONF value rather than using +=. Thanks!

Cheers,
Paul

Patch

diff --git a/meta-webserver/recipes-php/modphp/modphp5.inc b/meta-webserver/recipes-php/modphp/modphp5.inc
index 19f1be9..425faa2 100644
--- a/meta-webserver/recipes-php/modphp/modphp5.inc
+++ b/meta-webserver/recipes-php/modphp/modphp5.inc
@@ -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"