All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] php: add patch to fix build on static-only systems
@ 2018-02-26 20:34 Thomas Petazzoni
  2018-02-26 20:34 ` [Buildroot] [PATCH 2/2] php: disable on configurations using BR2_BINFMT_FLAT Thomas Petazzoni
  2018-02-26 22:45 ` [Buildroot] [PATCH 1/2] php: add patch to fix build on static-only systems Peter Korsgaard
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2018-02-26 20:34 UTC (permalink / raw)
  To: buildroot

This commit adds a patch to PHP to fix the build on static-only
system, a regression introduced in PHP recently.

Fixes:

  http://autobuild.buildroot.net/results/fbf7ebbb9502424727006f39e169ec1ee870186d/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 ...i.c-build-empty-php_load_zend_extension_c.patch | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 package/php/0009-main-php_ini.c-build-empty-php_load_zend_extension_c.patch

diff --git a/package/php/0009-main-php_ini.c-build-empty-php_load_zend_extension_c.patch b/package/php/0009-main-php_ini.c-build-empty-php_load_zend_extension_c.patch
new file mode 100644
index 0000000000..bc5149d1d6
--- /dev/null
+++ b/package/php/0009-main-php_ini.c-build-empty-php_load_zend_extension_c.patch
@@ -0,0 +1,62 @@
+From b7bbdfbcb0869b5c068143d4e27bab9eac4ae72b Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Date: Mon, 26 Feb 2018 19:30:55 +0100
+Subject: [PATCH] main/php_ini.c: build empty php_load_zend_extension_cb() when
+ !HAVE_LIBDL
+
+Commit 0782a7fc6314c8bd3cbfd57f12d0479bf9cc8dc7 ("Fixed bug #74866
+extension_dir = "./ext" now use current directory for base") modified
+the php_load_zend_extension_cb() function to use php_load_shlib(), and
+pass a handle to the newly introduced zend_load_extension_handle()
+function instead of passing the extension path to
+zend_load_extension().
+
+While doing so, it introduced a call to php_load_shlib() from code
+that is built even when HAVE_LIBDL is not defined. However,
+php_load_shlib() is not implemented when HAVE_LIBDL is not defined,
+for obvious reasons.
+
+It turns out that zend_load_extension_handle() anyway doesn't do
+anything when ZEND_EXTENSIONS_SUPPORT is defined to 0, and
+ZEND_EXTENSIONS_SUPPORT is not defined when HAVE_LIBDL is not defined
+(Zend/zend_portability.h).
+
+Fixes the following build failure when building on a system that
+doesn't have libdl:
+
+main/php_ini.o: In function `php_load_zend_extension_cb':
+php_ini.c:(.text+0x478): undefined reference to `php_load_shlib'
+php_ini.c:(.text+0x4b0): undefined reference to `php_load_shlib'
+collect2: error: ld returned 1 exit status
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Upstream-status: https://github.com/php/php-src/pull/3161
+---
+ main/php_ini.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/main/php_ini.c b/main/php_ini.c
+index ba58eb1180..fca263e5f0 100644
+--- a/main/php_ini.c
++++ b/main/php_ini.c
+@@ -350,6 +350,7 @@ static void php_load_php_extension_cb(void *arg)
+ 
+ /* {{{ php_load_zend_extension_cb
+  */
++#ifdef HAVE_LIBDL
+ static void php_load_zend_extension_cb(void *arg)
+ {
+ 	char *filename = *((char **) arg);
+@@ -409,6 +410,9 @@ static void php_load_zend_extension_cb(void *arg)
+ 		efree(libpath);
+ 	}
+ }
++#else
++static void php_load_zend_extension_cb(void *arg) { }
++#endif
+ /* }}} */
+ 
+ /* {{{ php_init_config
+-- 
+2.14.3
+
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 2/2] php: disable on configurations using BR2_BINFMT_FLAT
  2018-02-26 20:34 [Buildroot] [PATCH 1/2] php: add patch to fix build on static-only systems Thomas Petazzoni
@ 2018-02-26 20:34 ` Thomas Petazzoni
  2018-02-26 22:45   ` Peter Korsgaard
  2018-02-26 22:45 ` [Buildroot] [PATCH 1/2] php: add patch to fix build on static-only systems Peter Korsgaard
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2018-02-26 20:34 UTC (permalink / raw)
  To: buildroot

BR2_BINFMT_FLAT configurations require the use of elf2flt. However,
PHP uses -export-dynamic which breaks badly with elf2flt. Even a
simple program fails to build:

$ ./output/host/bin/arm-linux-gcc -Wl,-export-dynamic -o toto toto.c
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: section .junk LMA [0000000000000000,0000000000000027] overlaps section .text LMA [0000000000000000,0000000000006d07]

-export-dynamic is clearly not useful for FLAT configurations, which
are always statically linked, but it's quite a bit of work to change
the PHP build system to use it only conditionall.

It looks more like an interaction bug between gcc (which wants to put
the .text section at address 0x0 in its linker script) and elf2flt,
which wants to put its .junk section (containing the .rel.text stuff)
also at address 0x0.

Fixes (works around) the "section overlap" part of:

  http://autobuild.buildroot.net/results/35cbed8927bb10500ecf2816aa728ea240a0be21/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Waldemar Brodkorb <wbx@openadk.org>
---
 package/php/Config.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/php/Config.in b/package/php/Config.in
index 0fb80063af..11514e04b1 100644
--- a/package/php/Config.in
+++ b/package/php/Config.in
@@ -6,6 +6,10 @@ config BR2_PACKAGE_PHP
 	       !BR2_PACKAGE_PHP_SAPI_FPM &&  \
 	       BR2_USE_MMU
 	select BR2_PACKAGE_PHP_SAPI_CLI if !BR2_USE_MMU
+	# PHP uses -export-dynamic, which breaks with elf2flt with a
+	# message like "ld.real: section .junk LMA [...,...] overlaps
+	# section .text LMA [...,...]"
+	depends on !BR2_BINFMT_FLAT
 	help
 	  PHP  is a widely-used general-purpose scripting
 	  language that is especially suited for Web development
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 1/2] php: add patch to fix build on static-only systems
  2018-02-26 20:34 [Buildroot] [PATCH 1/2] php: add patch to fix build on static-only systems Thomas Petazzoni
  2018-02-26 20:34 ` [Buildroot] [PATCH 2/2] php: disable on configurations using BR2_BINFMT_FLAT Thomas Petazzoni
@ 2018-02-26 22:45 ` Peter Korsgaard
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2018-02-26 22:45 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > This commit adds a patch to PHP to fix the build on static-only
 > system, a regression introduced in PHP recently.

 > Fixes:

 >   http://autobuild.buildroot.net/results/fbf7ebbb9502424727006f39e169ec1ee870186d/

> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 2/2] php: disable on configurations using BR2_BINFMT_FLAT
  2018-02-26 20:34 ` [Buildroot] [PATCH 2/2] php: disable on configurations using BR2_BINFMT_FLAT Thomas Petazzoni
@ 2018-02-26 22:45   ` Peter Korsgaard
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2018-02-26 22:45 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > BR2_BINFMT_FLAT configurations require the use of elf2flt. However,
 > PHP uses -export-dynamic which breaks badly with elf2flt. Even a
 > simple program fails to build:

 > $ ./output/host/bin/arm-linux-gcc -Wl,-export-dynamic -o toto toto.c
 > /home/thomas/projets/buildroot/output/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: section .junk LMA [0000000000000000,0000000000000027] overlaps section .text LMA [0000000000000000,0000000000006d07]

 > -export-dynamic is clearly not useful for FLAT configurations, which
 > are always statically linked, but it's quite a bit of work to change
 > the PHP build system to use it only conditionall.

 > It looks more like an interaction bug between gcc (which wants to put
 > the .text section at address 0x0 in its linker script) and elf2flt,
 > which wants to put its .junk section (containing the .rel.text stuff)
 > also at address 0x0.

 > Fixes (works around) the "section overlap" part of:

 >   http://autobuild.buildroot.net/results/35cbed8927bb10500ecf2816aa728ea240a0be21/

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > Cc: Waldemar Brodkorb <wbx@openadk.org>

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-02-26 22:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-26 20:34 [Buildroot] [PATCH 1/2] php: add patch to fix build on static-only systems Thomas Petazzoni
2018-02-26 20:34 ` [Buildroot] [PATCH 2/2] php: disable on configurations using BR2_BINFMT_FLAT Thomas Petazzoni
2018-02-26 22:45   ` Peter Korsgaard
2018-02-26 22:45 ` [Buildroot] [PATCH 1/2] php: add patch to fix build on static-only systems Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.