When using GCC 4.x with php-5.3, and an extension (such as APC) that references PCRE functions (pcre_exec) that are bundled with PHP in the pcre extension. The symbols defined in the PHP binaries don't include a visibility "default" attribute, and are currently set to "hidden" in CFLAGS. This makes the symbols unavailable to any .so extension, which triggers a fault.

It seems like adding the visibility attribute to the bundled PHP code should fix this, but I wanted to post here as perhaps someone has a better suggestion. It would probably be better if this didn't modify the pcrelib/* files. I've included a patch as a possible fix, I can go ahead and commit this if this is what we want, but I'm hoping someone has some other suggestions.


before:
[EMAIL PROTECTED]:/usr/local/apache/libexec$ nm `which php` | grep pcre_exec
000266b4 t _php_pcre_exec

after:
[EMAIL PROTECTED]:/usr/local/apache/libexec$ nm `which php` | grep pcre_exec
000266b4 T _php_pcre_exec


cvs diff: Diffing .
cvs diff: Diffing doc
Index: pcre_internal.h
===================================================================
RCS file: /repository/php-src/ext/pcre/pcrelib/pcre_internal.h,v
retrieving revision 1.1.2.1.2.5.2.5
diff -u -r1.1.2.1.2.5.2.5 pcre_internal.h
--- pcre_internal.h     9 Sep 2008 07:55:08 -0000       1.1.2.1.2.5.2.5
+++ pcre_internal.h     9 Dec 2008 22:05:57 -0000
@@ -119,9 +119,17 @@
 #    endif
 #  else
 #    ifdef __cplusplus
-#      define PCRE_EXP_DECL       extern "C"
+#      if defined(__GNUC__) && __GNUC__ >= 4
+# define PCRE_EXP_DECL __attribute__ ((visibility("default"))) extern "C"
+#      else
+#        define PCRE_EXP_DECL       extern "C"
+#      endif
 #    else
-#      define PCRE_EXP_DECL       extern
+#      if defined(__GNUC__) && __GNUC__ >= 4
+# define PCRE_EXP_DECL __attribute__ ((visibility("default"))) extern
+#      else
+#        define PCRE_EXP_DECL       extern
+#      endif
 #    endif
 #    ifndef PCRE_EXP_DEFN
 #      define PCRE_EXP_DEFN       PCRE_EXP_DECL


-shire

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to