mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Improved PHP binary size and startup speed with GCC4 visibility control (Nuno)
This commit is contained in:
parent
71efa394a6
commit
240fa244c3
25 changed files with 175 additions and 86 deletions
2
NEWS
2
NEWS
|
@ -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)
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
# else
|
||||
# define TSRM_API __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define TSRM_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define TSRM_API
|
||||
#endif
|
||||
|
|
|
@ -122,6 +122,8 @@ typedef unsigned short mode_t;
|
|||
# else
|
||||
# define CWD_API __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define CWD_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define CWD_API
|
||||
#endif
|
||||
|
|
|
@ -19,8 +19,14 @@
|
|||
|
||||
/* $Id$ */
|
||||
|
||||
#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@
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -41,6 +41,8 @@ extern zend_module_entry bz2_module_entry;
|
|||
# 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
|
||||
#endif
|
||||
|
|
|
@ -43,6 +43,11 @@ typedef struct _dom_object {
|
|||
# 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
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
|
||||
#ifdef PHP_WIN32
|
||||
# define PHP_GD_API __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define PHP_GD_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define PHP_GD_API
|
||||
#endif
|
||||
|
|
|
@ -101,6 +101,8 @@ extern zend_module_entry hash_module_entry;
|
|||
|
||||
#ifdef PHP_WIN32
|
||||
# define PHP_HASH_API __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define PHP_HASH_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define PHP_HASH_API
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
# 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
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,8 @@ extern zend_module_entry libxml_module_entry;
|
|||
|
||||
#ifdef PHP_WIN32
|
||||
# define PHP_LIBXML_API __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define PHP_LIBXML_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define PHP_LIBXML_API
|
||||
#endif
|
||||
|
|
|
@ -60,6 +60,9 @@
|
|||
# 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 */
|
||||
|
|
|
@ -145,7 +145,11 @@ typedef struct {
|
|||
#define L64(x) x##i64
|
||||
typedef __int64 my_longlong;
|
||||
#else
|
||||
# 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
|
||||
|
|
|
@ -38,6 +38,8 @@ extern zend_module_entry pdo_module_entry;
|
|||
# else
|
||||
# define PDO_API /* nothing special */
|
||||
# endif
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define PDO_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define PDO_API /* nothing special */
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,6 +8,8 @@ extern zend_module_entry extname_module_entry;
|
|||
|
||||
#ifdef PHP_WIN32
|
||||
# define PHP_EXTNAME_API __declspec(dllexport)
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define PHP_EXTNAME_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define PHP_EXTNAME_API
|
||||
#endif
|
||||
|
|
|
@ -39,6 +39,8 @@ extern zend_module_entry spl_module_entry;
|
|||
# else
|
||||
# define SPL_API /* nothing */
|
||||
# endif
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define SPL_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define SPL_API
|
||||
#endif
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
# else
|
||||
# define PHPZIPAPI
|
||||
# endif
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define PHPZIPAPI __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define PHPZIPAPI
|
||||
#endif
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
# else
|
||||
# define SAPI_API __declspec(dllimport)
|
||||
# endif
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define SAPI_API __attribute__ ((visibility("default")))
|
||||
#else
|
||||
# define SAPI_API
|
||||
#endif
|
||||
|
|
|
@ -55,7 +55,12 @@
|
|||
# define PHP_DIR_SEPARATOR '\\'
|
||||
# define PHP_EOL "\r\n"
|
||||
#else
|
||||
# if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define PHPAPI __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define PHPAPI
|
||||
# endif
|
||||
|
||||
#define THREAD_LS
|
||||
#define PHP_DIR_SEPARATOR '/'
|
||||
#if defined(__MacOSX__)
|
||||
|
|
|
@ -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 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -9,8 +9,12 @@
|
|||
# define MODULE_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define far
|
||||
# if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define MODULE_API __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define MODULE_API
|
||||
# endif
|
||||
# define far
|
||||
|
||||
typedef int BOOL;
|
||||
typedef void far *LPVOID;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue