summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2008-01-30 09:56:22 +0000
committerDmitry Stogov <dmitry@php.net>2008-01-30 09:56:22 +0000
commit42a683d688b0e05392eb169252232a8bf4b5a02a (patch)
tree14066ce6bb8ed13f624d6f8190e8e4feb3a307dd /ext
parentd48c9d1a185292c3aacb7d13b12cb011d7ef2954 (diff)
downloadphp-git-42a683d688b0e05392eb169252232a8bf4b5a02a.tar.gz
Imporoved PHP binary size and startup speed with GCC4 visibility control (Nuno)
Diffstat (limited to 'ext')
-rw-r--r--ext/bz2/php_bz2.h18
-rw-r--r--ext/dom/xml_common.h21
-rw-r--r--ext/gd/php_gd.h6
-rw-r--r--ext/hash/php_hash.h6
-rw-r--r--ext/iconv/php_iconv.h14
-rw-r--r--ext/libxml/php_libxml.h6
-rw-r--r--ext/mbstring/mbstring.h23
-rw-r--r--ext/mysqli/php_mysqli_structs.h6
-rwxr-xr-xext/pdo/php_pdo.h18
-rw-r--r--ext/pgsql/php_pgsql.h6
-rw-r--r--ext/skeleton/php_skeleton.h6
-rwxr-xr-xext/spl/php_spl.h18
-rw-r--r--ext/unicode/php_unicode.h6
-rw-r--r--ext/zip/lib/zip.h16
14 files changed, 103 insertions, 67 deletions
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 167ac84a7a..05afde91da 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 b495a0e268..7026f39618 100644
--- a/ext/gd/php_gd.h
+++ b/ext/gd/php_gd.h
@@ -49,9 +49,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 ce361f5982..d0555dc241 100644
--- a/ext/hash/php_hash.h
+++ b/ext/hash/php_hash.h
@@ -104,9 +104,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 e48993d362..b1c2cfdd5c 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 8503d85b22..17aa7c5cb5 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 65503f978a..75e6436743 100644
--- a/ext/mysqli/php_mysqli_structs.h
+++ b/ext/mysqli/php_mysqli_structs.h
@@ -157,7 +157,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 1c202747ec..a6ec050c27 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/unicode/php_unicode.h b/ext/unicode/php_unicode.h
index 3fe387fb67..22769c8443 100644
--- a/ext/unicode/php_unicode.h
+++ b/ext/unicode/php_unicode.h
@@ -37,9 +37,11 @@ extern zend_module_entry unicode_module_entry;
#define phpext_unicode_ptr &unicode_module_entry
#ifdef PHP_WIN32
-#define PHP_UNICODE_API __declspec(dllexport)
+# define PHP_UNICODE_API __declspec(dllexport)
+#elif defined(__GNUC__) && __GNUC__ >= 4
+# define PHP_UNICODE_API __attribute__ ((visibility("default")))
#else
-#define PHP_UNICODE_API
+# define PHP_UNICODE_API
#endif
PHP_MINIT_FUNCTION(unicode);
diff --git a/ext/zip/lib/zip.h b/ext/zip/lib/zip.h
index 6af8451b56..953acfcfd9 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>