Re: PCRE symbol visibility bug
| From: | Nuno Lopes | Date: | Wed, 10 Dec 2008 10:16:52 +0000 |
| Subject: | Re: PCRE symbol visibility bug | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-42211@lists.php.net to get a copy of this message | ||
I've commited a fix. I didn't patch the pcre_internal.h file directly, otherwise the patch would be reverted on the next upgrade of the pcre lib.
Thanks,
Nuno
----- Original Message ----- From: "shire" <shire@php.net>
To: "PHP Internals List" <internals@lists.php.net>
Sent: Tuesday, December 09, 2008 10:09 PM
Subject: [PHP-DEV] PCRE symbol visibility bug
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: shire@shirebook:/usr/local/apache/libexec$ nmwhich php| grep pcre_exec 000266b4 t _php_pcre_exec after: shire@shirebook:/usr/local/apache/libexec$ nmwhich 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