scottmac                                 Thu, 06 Aug 2009 01:33:54 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=286859

Log:
Fix bug #48575 - Use dlopen() just like all the other *nixes instead of OSX 
specific code.

Bug: http://bugs.php.net/48575 (Assigned) Darwin / OS X should use dlopen() et 
al
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/Zend/Zend.m4
    U   php/php-src/branches/PHP_5_3/Zend/zend.h
    U   php/php-src/branches/PHP_5_3/Zend/zend_API.c
    U   php/php-src/branches/PHP_5_3/Zend/zend_extensions.c
    U   php/php-src/branches/PHP_5_3/configure.in
    U   php/php-src/branches/PHP_5_3/ext/standard/dl.c
    U   php/php-src/trunk/Zend/Zend.m4
    U   php/php-src/trunk/Zend/zend.h
    U   php/php-src/trunk/Zend/zend_API.c
    U   php/php-src/trunk/Zend/zend_extensions.c
    U   php/php-src/trunk/configure.in
    U   php/php-src/trunk/ext/standard/dl.c

Modified: php/php-src/branches/PHP_5_3/Zend/Zend.m4
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/Zend.m4	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/branches/PHP_5_3/Zend/Zend.m4	2009-08-06 01:33:54 UTC (rev 286859)
@@ -62,18 +62,6 @@
 stdlib.h \
 dlfcn.h)

-dnl Don't use mach-o/dyld.h on Darwin 8+, dl* is recommended by Apple from there on
-dnl See http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachOTopics/Articles/loading_code.html
-case $host_alias in
-*darwin[[89]]*)
-    ;;
-*)
-    AC_CHECK_HEADERS([  \
-mach-o/dyld.h
-],[],[][])
-    ;;
-esac
-
 AC_TYPE_SIZE_T
 AC_TYPE_SIGNAL


Modified: php/php-src/branches/PHP_5_3/Zend/zend.h
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend.h	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/branches/PHP_5_3/Zend/zend.h	2009-08-06 01:33:54 UTC (rev 286859)
@@ -79,19 +79,8 @@
 # include <dlfcn.h>
 #endif

-#if HAVE_MACH_O_DYLD_H
-#include <mach-o/dyld.h>
+#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)

-/* MH_BUNDLE loading functions for Mac OS X / Darwin */
-void *zend_mh_bundle_load (char* bundle_path);
-int zend_mh_bundle_unload (void *bundle_handle);
-void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name);
-const char *zend_mh_bundle_error(void);
-
-#endif /* HAVE_MACH_O_DYLD_H */
-
-#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H) && !defined(ZEND_WIN32)
-
 # ifndef RTLD_LAZY
 #  define RTLD_LAZY 1    /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
 # endif
@@ -116,13 +105,6 @@
 # define DL_ERROR					dlerror
 # define DL_HANDLE					void *
 # define ZEND_EXTENSIONS_SUPPORT	1
-#elif defined(HAVE_MACH_O_DYLD_H)
-# define DL_LOAD(libname)			zend_mh_bundle_load(libname)
-# define DL_UNLOAD			zend_mh_bundle_unload
-# define DL_FETCH_SYMBOL(h,s)		zend_mh_bundle_symbol(h,s)
-# define DL_ERROR					zend_mh_bundle_error
-# define DL_HANDLE					void *
-# define ZEND_EXTENSIONS_SUPPORT	1
 #elif defined(ZEND_WIN32)
 # define DL_LOAD(libname)			LoadLibrary(libname)
 # define DL_FETCH_SYMBOL			GetProcAddress

Modified: php/php-src/branches/PHP_5_3/Zend/zend_API.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_API.c	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/branches/PHP_5_3/Zend/zend_API.c	2009-08-06 01:33:54 UTC (rev 286859)
@@ -2114,7 +2114,7 @@
 		zend_unregister_functions(module->functions, -1, NULL TSRMLS_CC);
 	}

-#if HAVE_LIBDL || defined(HAVE_MACH_O_DYLD_H)
+#if HAVE_LIBDL
 #if !(defined(NETWARE) && defined(APACHE_1_BUILD))
 	if (module->handle) {
 		DL_UNLOAD(module->handle);

Modified: php/php-src/branches/PHP_5_3/Zend/zend_extensions.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_extensions.c	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/branches/PHP_5_3/Zend/zend_extensions.c	2009-08-06 01:33:54 UTC (rev 286859)
@@ -218,67 +218,6 @@
 }

 /*
- * Support for dynamic loading of MH_BUNDLEs on Darwin / Mac OS X
- *
- */
-
-#if HAVE_MACH_O_DYLD_H
-
-void *zend_mh_bundle_load(char* bundle_path)
-{
-	NSObjectFileImage bundle_image;
-	NSModule bundle_handle;
-	NSSymbol bundle_init_nssymbol;
-	void (*bundle_init)(void);
-
-	if (NSCreateObjectFileImageFromFile(bundle_path, &bundle_image) != NSObjectFileImageSuccess) {
-		return NULL;
-	}
-
-	bundle_handle = NSLinkModule(bundle_image, bundle_path, NSLINKMODULE_OPTION_NONE);
-	NSDestroyObjectFileImage(bundle_image);
-
-	/* call the init function of the bundle */
-	bundle_init_nssymbol = NSLookupSymbolInModule(bundle_handle, "__init");
-	if (bundle_init_nssymbol != NULL) {
-		bundle_init = NSAddressOfSymbol(bundle_init_nssymbol);
-		bundle_init();
-	}
-
-	return bundle_handle;
-}
-
-int zend_mh_bundle_unload(void *bundle_handle)
-{
-	NSSymbol bundle_fini_nssymbol;
-	void (*bundle_fini)(void);
-
-	/* call the fini function of the bundle */
-	bundle_fini_nssymbol = NSLookupSymbolInModule(bundle_handle, "__fini");
-	if (bundle_fini_nssymbol != NULL) {
-		bundle_fini = NSAddressOfSymbol(bundle_fini_nssymbol);
-		bundle_fini();
-	}
-
-	return (int) NSUnLinkModule(bundle_handle, NULL);
-}
-
-void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name)
-{
-	NSSymbol symbol;
-	symbol = NSLookupSymbolInModule(bundle_handle, symbol_name);
-	return NSAddressOfSymbol(symbol);
-}
-
-const char *zend_mh_bundle_error(void)
-{
-	/* Witness the state of the art error reporting */
-	return NULL;
-}
-
-#endif /* HAVE_MACH_O_DYLD_H */
-
-/*
  * Local variables:
  * tab-width: 4
  * c-basic-offset: 4

Modified: php/php-src/branches/PHP_5_3/configure.in
===================================================================
--- php/php-src/branches/PHP_5_3/configure.in	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/branches/PHP_5_3/configure.in	2009-08-06 01:33:54 UTC (rev 286859)
@@ -486,16 +486,6 @@
 #endif
 ])

-dnl Don't use mach-o/dyld.h on Darwin 8+, dl* is recommended by Apple from there on
-dnl See http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachOTopics/Articles/loading_code.html
-case $host_alias in
-  *darwin[[89]]*)
-    ;;
-  *)
-    AC_CHECK_HEADERS([mach-o/dyld.h],[],[],[])
-    ;;
-esac
-
 PHP_FOPENCOOKIE
 PHP_BROKEN_GETCWD
 PHP_BROKEN_GLIBC_FOPEN_APPEND

Modified: php/php-src/branches/PHP_5_3/ext/standard/dl.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/dl.c	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/branches/PHP_5_3/ext/standard/dl.c	2009-08-06 01:33:54 UTC (rev 286859)
@@ -28,7 +28,7 @@

 #include "SAPI.h"

-#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H
+#if defined(HAVE_LIBDL)
 #include <stdlib.h>
 #include <stdio.h>
 #ifdef HAVE_STRING_H
@@ -47,7 +47,7 @@
 #include <sys/param.h>
 #define GET_DL_ERROR()	DL_ERROR()
 #endif
-#endif /* defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H */
+#endif /* defined(HAVE_LIBDL) */

 /* {{{ proto int dl(string extension_filename)
    Load a PHP extension at runtime */
@@ -92,7 +92,7 @@
 }
 /* }}} */

-#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H
+#if defined(HAVE_LIBDL)

 #ifdef ZTS
 #define USING_ZTS 1

Modified: php/php-src/trunk/Zend/Zend.m4
===================================================================
--- php/php-src/trunk/Zend/Zend.m4	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/trunk/Zend/Zend.m4	2009-08-06 01:33:54 UTC (rev 286859)
@@ -62,18 +62,6 @@
 stdlib.h \
 dlfcn.h)

-dnl Don't use mach-o/dyld.h on Darwin 8+, dl* is recommended by Apple from there on
-dnl See http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachOTopics/Articles/loading_code.html
-case $host_alias in
-*darwin[[89]]*)
-    ;;
-*)
-    AC_CHECK_HEADERS([  \
-mach-o/dyld.h
-],[],[][])
-    ;;
-esac
-
 AC_TYPE_SIZE_T
 AC_TYPE_SIGNAL


Modified: php/php-src/trunk/Zend/zend.h
===================================================================
--- php/php-src/trunk/Zend/zend.h	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/trunk/Zend/zend.h	2009-08-06 01:33:54 UTC (rev 286859)
@@ -80,19 +80,8 @@
 # include <dlfcn.h>
 #endif

-#if HAVE_MACH_O_DYLD_H
-#include <mach-o/dyld.h>
+#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32)

-/* MH_BUNDLE loading functions for Mac OS X / Darwin */
-void *zend_mh_bundle_load (char* bundle_path);
-int zend_mh_bundle_unload (void *bundle_handle);
-void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name);
-const char *zend_mh_bundle_error(void);
-
-#endif /* HAVE_MACH_O_DYLD_H */
-
-#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H) && !defined(ZEND_WIN32)
-
 # ifndef RTLD_LAZY
 #  define RTLD_LAZY 1    /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
 # endif
@@ -117,13 +106,6 @@
 # define DL_ERROR					dlerror
 # define DL_HANDLE					void *
 # define ZEND_EXTENSIONS_SUPPORT	1
-#elif defined(HAVE_MACH_O_DYLD_H)
-# define DL_LOAD(libname)			zend_mh_bundle_load(libname)
-# define DL_UNLOAD			zend_mh_bundle_unload
-# define DL_FETCH_SYMBOL(h,s)		zend_mh_bundle_symbol(h,s)
-# define DL_ERROR					zend_mh_bundle_error
-# define DL_HANDLE					void *
-# define ZEND_EXTENSIONS_SUPPORT	1
 #elif defined(ZEND_WIN32)
 # define DL_LOAD(libname)			LoadLibrary(libname)
 # define DL_FETCH_SYMBOL			GetProcAddress

Modified: php/php-src/trunk/Zend/zend_API.c
===================================================================
--- php/php-src/trunk/Zend/zend_API.c	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/trunk/Zend/zend_API.c	2009-08-06 01:33:54 UTC (rev 286859)
@@ -2456,7 +2456,7 @@
 		zend_unregister_functions(module->functions, -1, NULL TSRMLS_CC);
 	}

-#if HAVE_LIBDL || defined(HAVE_MACH_O_DYLD_H)
+#if HAVE_LIBDL
 #if !(defined(NETWARE) && defined(APACHE_1_BUILD))
 	if (module->handle) {
 		DL_UNLOAD(module->handle);

Modified: php/php-src/trunk/Zend/zend_extensions.c
===================================================================
--- php/php-src/trunk/Zend/zend_extensions.c	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/trunk/Zend/zend_extensions.c	2009-08-06 01:33:54 UTC (rev 286859)
@@ -220,71 +220,6 @@
 /* }}} */

 /*
- * Support for dynamic loading of MH_BUNDLEs on Darwin / Mac OS X
- *
- */
-
-#if HAVE_MACH_O_DYLD_H
-
-void *zend_mh_bundle_load(char* bundle_path) /* {{{ */
-{
-	NSObjectFileImage bundle_image;
-	NSModule bundle_handle;
-	NSSymbol bundle_init_nssymbol;
-	void (*bundle_init)(void);
-
-	if (NSCreateObjectFileImageFromFile(bundle_path, &bundle_image) != NSObjectFileImageSuccess) {
-		return NULL;
-	}
-
-	bundle_handle = NSLinkModule(bundle_image, bundle_path, NSLINKMODULE_OPTION_NONE);
-	NSDestroyObjectFileImage(bundle_image);
-
-	/* call the init function of the bundle */
-	bundle_init_nssymbol = NSLookupSymbolInModule(bundle_handle, "__init");
-	if (bundle_init_nssymbol != NULL) {
-		bundle_init = NSAddressOfSymbol(bundle_init_nssymbol);
-		bundle_init();
-	}
-
-	return bundle_handle;
-}
-/* }}} */
-
-int zend_mh_bundle_unload(void *bundle_handle) /* {{{ */
-{
-	NSSymbol bundle_fini_nssymbol;
-	void (*bundle_fini)(void);
-
-	/* call the fini function of the bundle */
-	bundle_fini_nssymbol = NSLookupSymbolInModule(bundle_handle, "__fini");
-	if (bundle_fini_nssymbol != NULL) {
-		bundle_fini = NSAddressOfSymbol(bundle_fini_nssymbol);
-		bundle_fini();
-	}
-
-	return (int) NSUnLinkModule(bundle_handle, NULL);
-}
-/* }}} */
-
-void *zend_mh_bundle_symbol(void *bundle_handle, const char *symbol_name) /* {{{ */
-{
-	NSSymbol symbol;
-	symbol = NSLookupSymbolInModule(bundle_handle, symbol_name);
-	return NSAddressOfSymbol(symbol);
-}
-/* }}} */
-
-const char *zend_mh_bundle_error(void) /* {{{ */
-{
-	/* Witness the state of the art error reporting */
-	return NULL;
-}
-/* }}} */
-
-#endif /* HAVE_MACH_O_DYLD_H */
-
-/*
  * Local variables:
  * tab-width: 4
  * c-basic-offset: 4

Modified: php/php-src/trunk/configure.in
===================================================================
--- php/php-src/trunk/configure.in	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/trunk/configure.in	2009-08-06 01:33:54 UTC (rev 286859)
@@ -485,16 +485,6 @@
 #endif
 ])

-dnl Don't use mach-o/dyld.h on Darwin 8+, dl* is recommended by Apple from there on
-dnl See http://developer.apple.com/documentation/DeveloperTools/Conceptual/MachOTopics/Articles/loading_code.html
-case $host_alias in
-  *darwin[[89]]*)
-    ;;
-  *)
-    AC_CHECK_HEADERS([mach-o/dyld.h],[],[],[])
-    ;;
-esac
-
 PHP_FOPENCOOKIE
 PHP_BROKEN_GETCWD
 PHP_BROKEN_GLIBC_FOPEN_APPEND

Modified: php/php-src/trunk/ext/standard/dl.c
===================================================================
--- php/php-src/trunk/ext/standard/dl.c	2009-08-06 00:10:46 UTC (rev 286858)
+++ php/php-src/trunk/ext/standard/dl.c	2009-08-06 01:33:54 UTC (rev 286859)
@@ -29,7 +29,7 @@

 #include "SAPI.h"

-#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H
+#if defined(HAVE_LIBDL)
 #include <stdlib.h>
 #include <stdio.h>
 #ifdef HAVE_STRING_H
@@ -48,7 +48,7 @@
 #include <sys/param.h>
 #define GET_DL_ERROR()	DL_ERROR()
 #endif
-#endif /* defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H */
+#endif /* defined(HAVE_LIBDL) */

 /* {{{ proto int dl(string extension_filename) U
    Load a PHP extension at runtime */
@@ -85,7 +85,7 @@
 }
 /* }}} */

-#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H
+#if defined(HAVE_LIBDL)

 #ifdef ZTS
 #define USING_ZTS 1
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to