diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | TSRM/TSRM.h | 6 | ||||
-rw-r--r-- | TSRM/tsrm_virtual_cwd.h | 14 | ||||
-rw-r--r-- | Zend/acconfig.h | 10 | ||||
-rw-r--r-- | configure.in | 8 | ||||
-rw-r--r-- | ext/bz2/php_bz2.h | 18 | ||||
-rw-r--r-- | ext/dom/xml_common.h | 21 | ||||
-rw-r--r-- | ext/gd/php_gd.h | 6 | ||||
-rw-r--r-- | ext/hash/php_hash.h | 6 | ||||
-rw-r--r-- | ext/iconv/php_iconv.h | 14 | ||||
-rw-r--r-- | ext/libxml/php_libxml.h | 6 | ||||
-rw-r--r-- | ext/mbstring/mbstring.h | 23 | ||||
-rw-r--r-- | ext/mysqli/php_mysqli_structs.h | 6 | ||||
-rwxr-xr-x | ext/pdo/php_pdo.h | 18 | ||||
-rw-r--r-- | ext/pgsql/php_pgsql.h | 6 | ||||
-rw-r--r-- | ext/skeleton/php_skeleton.h | 6 | ||||
-rwxr-xr-x | ext/spl/php_spl.h | 18 | ||||
-rw-r--r-- | ext/zip/lib/zip.h | 16 | ||||
-rw-r--r-- | main/SAPI.h | 8 | ||||
-rw-r--r-- | main/php.h | 19 | ||||
-rw-r--r-- | sapi/apache/mod_php5.h | 6 | ||||
-rw-r--r-- | sapi/apache2filter/php_apache.h | 6 | ||||
-rw-r--r-- | sapi/apache2handler/php_apache.h | 5 | ||||
-rw-r--r-- | sapi/apache_hooks/mod_php5.h | 7 | ||||
-rw-r--r-- | sapi/pi3web/pi3web_sapi.h | 6 |
25 files changed, 175 insertions, 86 deletions
@@ -57,6 +57,8 @@ PHP NEWS - Removed the experimental RPL (master/slave) functions from mysqli. (Andrey) +- Improved PHP binary size and startup speed with GCC4 visibility control. + (Nuno) - Improved engine stack implementation for better performance and stability. (Dmitry) - Improved php.ini handling: (Jani) diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h index 4a73c3487b..9695a726ec 100644 --- a/TSRM/TSRM.h +++ b/TSRM/TSRM.h @@ -22,10 +22,12 @@ #ifdef TSRM_WIN32 # ifdef TSRM_EXPORTS -# define TSRM_API __declspec(dllexport) +# define TSRM_API __declspec(dllexport) # else -# define TSRM_API __declspec(dllimport) +# define TSRM_API __declspec(dllimport) # endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define TSRM_API __attribute__ ((visibility("default"))) #else # define TSRM_API #endif diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h index 238c08035c..d4e2415b10 100644 --- a/TSRM/tsrm_virtual_cwd.h +++ b/TSRM/tsrm_virtual_cwd.h @@ -117,13 +117,15 @@ typedef unsigned short mode_t; #endif #ifdef TSRM_WIN32 -# ifdef CWD_EXPORTS -# define CWD_API __declspec(dllexport) -# else -# define CWD_API __declspec(dllimport) -# endif +# ifdef CWD_EXPORTS +# define CWD_API __declspec(dllexport) +# else +# define CWD_API __declspec(dllimport) +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define CWD_API __attribute__ ((visibility("default"))) #else -#define CWD_API +# define CWD_API #endif #ifdef TSRM_WIN32 diff --git a/Zend/acconfig.h b/Zend/acconfig.h index 7fd5a07661..8e3176c0f1 100644 --- a/Zend/acconfig.h +++ b/Zend/acconfig.h @@ -19,8 +19,14 @@ /* $Id$ */ -#define ZEND_API -#define ZEND_DLEXPORT +#if defined(__GNUC__) && __GNUC__ >= 4 +# define ZEND_API __attribute__ ((visibility("default"))) +# define ZEND_DLEXPORT __attribute__ ((visibility("default"))) +#else +# define ZEND_API +# define ZEND_DLEXPORT +#endif + #define ZEND_DLIMPORT @TOP@ diff --git a/configure.in b/configure.in index b627a676ec..e5dff11c71 100644 --- a/configure.in +++ b/configure.in @@ -165,6 +165,14 @@ alpha*) ;; esac +dnl activate some gcc specific optimizations for gcc >= 4 +if test "$GCC" = "yes"; then + GCC_MAJOR_VERSION=`$CC --version | $SED -n '1s/[[^0-9]]*\([[0-9]]\+\)\.[[0-9]]\+\..*/\1/;1p'` + if test $GCC_MAJOR_VERSION -ge 4; then + CFLAGS="$CFLAGS -fvisibility=hidden" + fi +fi + case $host_alias in *solaris*) CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" diff --git a/ext/bz2/php_bz2.h b/ext/bz2/php_bz2.h index 5d453a5457..9ef0556855 100644 --- a/ext/bz2/php_bz2.h +++ b/ext/bz2/php_bz2.h @@ -34,15 +34,17 @@ extern zend_module_entry bz2_module_entry; #endif #ifdef PHP_WIN32 -# ifdef PHP_BZ2_EXPORTS -# define PHP_BZ2_API __declspec(dllexport) -# elif defined(COMPILE_DL_BZ2) -# define PHP_BZ2_API __declspec(dllimport) -# else -# define PHP_BZ2_API /* nothing special */ -# endif +# ifdef PHP_BZ2_EXPORTS +# define PHP_BZ2_API __declspec(dllexport) +# elif defined(COMPILE_DL_BZ2) +# define PHP_BZ2_API __declspec(dllimport) +# else +# define PHP_BZ2_API /* nothing special */ +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_BZ2_API __attribute__ ((visibility("default"))) #else -# define PHP_BZ2_API +# define PHP_BZ2_API #endif PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper, char *path, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h index 4193416218..2b01930145 100644 --- a/ext/dom/xml_common.h +++ b/ext/dom/xml_common.h @@ -35,14 +35,19 @@ typedef struct _dom_object { } dom_object; #ifdef PHP_WIN32 -#ifdef PHPAPI -#undef PHPAPI -#endif -#ifdef DOM_EXPORTS -#define PHPAPI __declspec(dllexport) -#else -#define PHPAPI __declspec(dllimport) -#endif /* DOM_EXPORTS */ +# ifdef PHPAPI +# undef PHPAPI +# endif +# ifdef DOM_EXPORTS +# define PHPAPI __declspec(dllexport) +# else +# define PHPAPI __declspec(dllimport) +# endif /* DOM_EXPORTS */ +#elif defined(__GNUC__) && __GNUC__ >= 4 +# ifdef PHPAPI +# undef PHPAPI +# endif +# define PHPAPI __attribute__ ((visibility("default"))) #endif /* PHP_WIN32 */ #define PHP_DOM_EXPORT PHPAPI diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h index e4b5ad2ce4..382a53cfce 100644 --- a/ext/gd/php_gd.h +++ b/ext/gd/php_gd.h @@ -51,9 +51,11 @@ #define PHP_GDIMG_TYPE_GD2PART 10 #ifdef PHP_WIN32 -#define PHP_GD_API __declspec(dllexport) +# define PHP_GD_API __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_GD_API __attribute__ ((visibility("default"))) #else -#define PHP_GD_API +# define PHP_GD_API #endif PHPAPI extern const char php_sig_gif[3]; diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index e2309201f9..0f660c785a 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -100,9 +100,11 @@ extern zend_module_entry hash_module_entry; #define phpext_hash_ptr &hash_module_entry #ifdef PHP_WIN32 -#define PHP_HASH_API __declspec(dllexport) +# define PHP_HASH_API __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_HASH_API __attribute__ ((visibility("default"))) #else -#define PHP_HASH_API +# define PHP_HASH_API #endif #ifdef ZTS diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h index 20e52c9e6a..8f098b9ecd 100644 --- a/ext/iconv/php_iconv.h +++ b/ext/iconv/php_iconv.h @@ -23,13 +23,15 @@ #define PHP_ICONV_H #ifdef PHP_WIN32 -#ifdef PHP_ICONV_EXPORTS -#define PHP_ICONV_API __declspec(dllexport) +# ifdef PHP_ICONV_EXPORTS +# define PHP_ICONV_API __declspec(dllexport) +# else +# define PHP_ICONV_API __declspec(dllimport) +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_ICONV_API __attribute__ ((visibility("default"))) #else -#define PHP_ICONV_API __declspec(dllimport) -#endif -#else -#define PHP_ICONV_API +# define PHP_ICONV_API #endif #ifdef PHP_ATOM_INC diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h index 468c088fe1..27729162dc 100644 --- a/ext/libxml/php_libxml.h +++ b/ext/libxml/php_libxml.h @@ -27,9 +27,11 @@ extern zend_module_entry libxml_module_entry; #define libxml_module_ptr &libxml_module_entry #ifdef PHP_WIN32 -#define PHP_LIBXML_API __declspec(dllexport) +# define PHP_LIBXML_API __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_LIBXML_API __attribute__ ((visibility("default"))) #else -#define PHP_LIBXML_API +# define PHP_LIBXML_API #endif #include "ext/standard/php_smart_str.h" diff --git a/ext/mbstring/mbstring.h b/ext/mbstring/mbstring.h index 63afaf5094..1393559f8e 100644 --- a/ext/mbstring/mbstring.h +++ b/ext/mbstring/mbstring.h @@ -52,17 +52,20 @@ #endif #ifdef PHP_WIN32 -# undef MBSTRING_API -# ifdef MBSTRING_EXPORTS -# define MBSTRING_API __declspec(dllexport) -# elif defined(COMPILE_DL_MBSTRING) -# define MBSTRING_API __declspec(dllimport) -# else -# define MBSTRING_API /* nothing special */ -# endif +# undef MBSTRING_API +# ifdef MBSTRING_EXPORTS +# define MBSTRING_API __declspec(dllexport) +# elif defined(COMPILE_DL_MBSTRING) +# define MBSTRING_API __declspec(dllimport) +# else +# define MBSTRING_API /* nothing special */ +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# undef MBSTRING_API +# define MBSTRING_API __attribute__ ((visibility("default"))) #else -# undef MBSTRING_API -# define MBSTRING_API /* nothing special */ +# undef MBSTRING_API +# define MBSTRING_API /* nothing special */ #endif diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h index 7177e42d51..81003c16ba 100644 --- a/ext/mysqli/php_mysqli_structs.h +++ b/ext/mysqli/php_mysqli_structs.h @@ -145,7 +145,11 @@ typedef struct { #define L64(x) x##i64 typedef __int64 my_longlong; #else -#define PHP_MYSQLI_API +# if defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_MYSQLI_API __attribute__ ((visibility("default"))) +# else +# define PHP_MYSQLI_API +# endif #define MYSQLI_LLU_SPEC "%llu" #define MYSQLI_LL_SPEC "%lld" #define L64(x) x##LL diff --git a/ext/pdo/php_pdo.h b/ext/pdo/php_pdo.h index fa83596e48..b2e1468949 100755 --- a/ext/pdo/php_pdo.h +++ b/ext/pdo/php_pdo.h @@ -31,15 +31,17 @@ extern zend_module_entry pdo_module_entry; #define phpext_pdo_ptr &pdo_module_entry #ifdef PHP_WIN32 -# if defined(PDO_EXPORTS) || (!defined(COMPILE_DL_PDO)) -# define PDO_API __declspec(dllexport) -# elif defined(COMPILE_DL_PDO) -# define PDO_API __declspec(dllimport) -# else -# define PDO_API /* nothing special */ -# endif +# if defined(PDO_EXPORTS) || (!defined(COMPILE_DL_PDO)) +# define PDO_API __declspec(dllexport) +# elif defined(COMPILE_DL_PDO) +# define PDO_API __declspec(dllimport) +# else +# define PDO_API /* nothing special */ +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PDO_API __attribute__ ((visibility("default"))) #else -# define PDO_API /* nothing special */ +# define PDO_API /* nothing special */ #endif #ifdef ZTS diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h index 0e38434868..96ce461b6f 100644 --- a/ext/pgsql/php_pgsql.h +++ b/ext/pgsql/php_pgsql.h @@ -42,7 +42,11 @@ extern zend_module_entry pgsql_module_entry; #endif #else #include <libpq/libpq-fs.h> -#define PHP_PGSQL_API /* nothing special */ +# if defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_PGSQL_API __attribute__ ((visibility("default"))) +# else +# define PHP_PGSQL_API +# endif #endif #ifdef HAVE_PG_CONFIG_H diff --git a/ext/skeleton/php_skeleton.h b/ext/skeleton/php_skeleton.h index 7508f4f979..495907bbd1 100644 --- a/ext/skeleton/php_skeleton.h +++ b/ext/skeleton/php_skeleton.h @@ -7,9 +7,11 @@ extern zend_module_entry extname_module_entry; #define phpext_extname_ptr &extname_module_entry #ifdef PHP_WIN32 -#define PHP_EXTNAME_API __declspec(dllexport) +# define PHP_EXTNAME_API __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHP_EXTNAME_API __attribute__ ((visibility("default"))) #else -#define PHP_EXTNAME_API +# define PHP_EXTNAME_API #endif #ifdef ZTS diff --git a/ext/spl/php_spl.h b/ext/spl/php_spl.h index 75ec338285..baf2d9115f 100755 --- a/ext/spl/php_spl.h +++ b/ext/spl/php_spl.h @@ -32,15 +32,17 @@ extern zend_module_entry spl_module_entry; #define phpext_spl_ptr &spl_module_entry #ifdef PHP_WIN32 -# ifdef SPL_EXPORTS -# define SPL_API __declspec(dllexport) -# elif defined(COMPILE_DL_SPL) -# define SPL_API __declspec(dllimport) -# else -# define SPL_API /* nothing */ -# endif +# ifdef SPL_EXPORTS +# define SPL_API __declspec(dllexport) +# elif defined(COMPILE_DL_SPL) +# define SPL_API __declspec(dllimport) +# else +# define SPL_API /* nothing */ +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define SPL_API __attribute__ ((visibility("default"))) #else -# define SPL_API +# define SPL_API #endif #if defined(PHP_WIN32) && !defined(COMPILE_DL_SPL) diff --git a/ext/zip/lib/zip.h b/ext/zip/lib/zip.h index 04ffb1471b..87151174b0 100644 --- a/ext/zip/lib/zip.h +++ b/ext/zip/lib/zip.h @@ -41,14 +41,16 @@ /* #defines that rename all zip_ functions and structs */ #include "zip_alias.h" #ifdef PHP_WIN32 -#include "zip_win32.h" -# ifdef PHP_ZIP_EXPORTS -# define PHPZIPAPI __declspec(dllexport) -# else -# define PHPZIPAPI -# endif +# include "zip_win32.h" +# ifdef PHP_ZIP_EXPORTS +# define PHPZIPAPI __declspec(dllexport) +# else +# define PHPZIPAPI +# endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define PHPZIPAPI __attribute__ ((visibility("default"))) #else -#define PHPZIPAPI +# define PHPZIPAPI #endif BEGIN_EXTERN_C() #include <sys/types.h> diff --git a/main/SAPI.h b/main/SAPI.h index e3d7279785..39a9a85b26 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -35,12 +35,14 @@ #ifdef PHP_WIN32 # ifdef SAPI_EXPORTS -# define SAPI_API __declspec(dllexport) +# define SAPI_API __declspec(dllexport) # else -# define SAPI_API __declspec(dllimport) +# define SAPI_API __declspec(dllimport) # endif +#elif defined(__GNUC__) && __GNUC__ >= 4 +# define SAPI_API __attribute__ ((visibility("default"))) #else -#define SAPI_API +# define SAPI_API #endif #undef shutdown diff --git a/main/php.h b/main/php.h index 77d499f3db..65dd2419fe 100644 --- a/main/php.h +++ b/main/php.h @@ -45,17 +45,22 @@ #define PHP_DEBUG ZEND_DEBUG #ifdef PHP_WIN32 -#include "tsrm_win32.h" -#include "win95nt.h" +# include "tsrm_win32.h" +# include "win95nt.h" # ifdef PHP_EXPORTS -# define PHPAPI __declspec(dllexport) +# define PHPAPI __declspec(dllexport) # else -# define PHPAPI __declspec(dllimport) +# define PHPAPI __declspec(dllimport) # endif -#define PHP_DIR_SEPARATOR '\\' -#define PHP_EOL "\r\n" +# define PHP_DIR_SEPARATOR '\\' +# define PHP_EOL "\r\n" #else -#define PHPAPI +# if defined(__GNUC__) && __GNUC__ >= 4 +# define PHPAPI __attribute__ ((visibility("default"))) +# else +# define PHPAPI +# endif + #define THREAD_LS #define PHP_DIR_SEPARATOR '/' #if defined(__MacOSX__) diff --git a/sapi/apache/mod_php5.h b/sapi/apache/mod_php5.h index 1daa476c7e..7533530de5 100644 --- a/sapi/apache/mod_php5.h +++ b/sapi/apache/mod_php5.h @@ -44,6 +44,12 @@ extern php_apache_info_struct php_apache_info; #define AP(v) (php_apache_info.v) #endif +/* fix for gcc4 visibility patch */ +#ifndef PHP_WIN32 +# undef MODULE_VAR_EXPORT +# define MODULE_VAR_EXPORT PHPAPI +#endif + #endif /* MOD_PHP5_H */ /* diff --git a/sapi/apache2filter/php_apache.h b/sapi/apache2filter/php_apache.h index 78050a7de5..53bfb9c223 100644 --- a/sapi/apache2filter/php_apache.h +++ b/sapi/apache2filter/php_apache.h @@ -74,4 +74,10 @@ static long php_apache_fteller_stream(void * TSRMLS_DC); #define APR_ARRAY_FOREACH_CLOSE() }} +/* fix for gcc4 visibility patch */ +#ifndef PHP_WIN32 +# undef AP_MODULE_DECLARE_DATA +# define AP_MODULE_DECLARE_DATA PHPAPI +#endif + #endif /* PHP_APACHE_H */ diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h index 3d41439170..af9da3a230 100644 --- a/sapi/apache2handler/php_apache.h +++ b/sapi/apache2handler/php_apache.h @@ -82,5 +82,10 @@ extern php_apache2_info_struct php_apache2_info; #define AP2(v) (php_apache2_info.v) #endif +/* fix for gcc4 visibility patch */ +#ifndef PHP_WIN32 +# undef AP_MODULE_DECLARE_DATA +# define AP_MODULE_DECLARE_DATA PHPAPI +#endif #endif /* PHP_APACHE_H */ diff --git a/sapi/apache_hooks/mod_php5.h b/sapi/apache_hooks/mod_php5.h index 0d61bf8982..1549dbf263 100644 --- a/sapi/apache_hooks/mod_php5.h +++ b/sapi/apache_hooks/mod_php5.h @@ -71,6 +71,13 @@ extern php_apache_info_struct php_apache_info; #define AP_LOGGING 10 #define AP_CLEANUP 11 + +/* fix for gcc4 visibility patch */ +#ifndef PHP_WIN32 +# undef MODULE_VAR_EXPORT +# define MODULE_VAR_EXPORT PHPAPI +#endif + #endif /* MOD_PHP5_H */ /* diff --git a/sapi/pi3web/pi3web_sapi.h b/sapi/pi3web/pi3web_sapi.h index 9300241d44..d229fec53f 100644 --- a/sapi/pi3web/pi3web_sapi.h +++ b/sapi/pi3web/pi3web_sapi.h @@ -9,8 +9,12 @@ # define MODULE_API __declspec(dllimport) # endif #else +# if defined(__GNUC__) && __GNUC__ >= 4 +# define MODULE_API __attribute__ ((visibility("default"))) +# else +# define MODULE_API +# endif # define far -# define MODULE_API typedef int BOOL; typedef void far *LPVOID; |