Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44356 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72235 invoked from network); 18 Jun 2009 14:49:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2009 14:49:28 -0000 Authentication-Results: pb1.pair.com header.from=gwynne@darkrainfall.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=gwynne@darkrainfall.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain darkrainfall.org from 208.97.132.177 cause and error) X-PHP-List-Original-Sender: gwynne@darkrainfall.org X-Host-Fingerprint: 208.97.132.177 caiajhbdcbhh.dreamhost.com Received: from [208.97.132.177] ([208.97.132.177:46696] helo=homiemail-a4.g.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 15/A2-58950-7F35A3A4 for ; Thu, 18 Jun 2009 10:49:27 -0400 Received: from Moonstar.home (pool-71-174-84-161.bstnma.fios.verizon.net [71.174.84.161]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by homiemail-a4.g.dreamhost.com (Postfix) with ESMTP id 06E1541794 for ; Thu, 18 Jun 2009 07:49:23 -0700 (PDT) Message-ID: <3B65D10E-3D2C-4AFB-8DC5-912D50C3BF23@darkrainfall.org> To: PHP Developers Mailing List In-Reply-To: Content-Type: multipart/mixed; boundary=Apple-Mail-4-741390324 Mime-Version: 1.0 (Apple Message framework v935.3) Date: Thu, 18 Jun 2009 10:49:22 -0400 References: X-Mailer: Apple Mail (2.935.3) Subject: Re: [PHP-DEV] Patch for bug #48575 From: gwynne@darkrainfall.org (Gwynne Raskind) --Apple-Mail-4-741390324 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Jun 18, 2009, at 10:46 AM, Gwynne Raskind wrote: > Here is a nice simple patch for #48575 which rips out the mach-o/ > dyld.h functionality in Zend (as suggested by the original reporter > and the Apple comment). According to my testing this not only > doesn't break anything, but actually doesn't change anything either > except removing some dead code and removing one configure check. Per > Pierre's request, I'm sending it here for review :) And now, the patch itself! I hope. *fanfare* -- Gwynne --Apple-Mail-4-741390324 Content-Disposition: attachment; filename=48575.txt Content-Type: text/plain; x-unix-mode=0644; name="48575.txt" Content-Transfer-Encoding: 7bit Index: configure.in =================================================================== RCS file: /repository/php-src/configure.in,v retrieving revision 1.678 diff -u -r1.678 configure.in --- configure.in 18 May 2009 21:28:42 -0000 1.678 +++ configure.in 18 Jun 2009 14:38:47 -0000 @@ -483,16 +483,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 Index: Zend/Zend.m4 =================================================================== RCS file: /repository/ZendEngine2/Zend.m4,v retrieving revision 1.70 diff -u -r1.70 Zend.m4 --- Zend/Zend.m4 4 Jun 2009 18:18:46 -0000 1.70 +++ Zend/Zend.m4 18 Jun 2009 14:38:47 -0000 @@ -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 Index: Zend/zend.h =================================================================== RCS file: /repository/ZendEngine2/zend.h,v retrieving revision 1.373 diff -u -r1.373 zend.h --- Zend/zend.h 17 Jun 2009 08:57:44 -0000 1.373 +++ Zend/zend.h 18 Jun 2009 14:38:47 -0000 @@ -80,18 +80,7 @@ # include #endif -#if HAVE_MACH_O_DYLD_H -#include - -/* 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) +#if defined(HAVE_LIBDL) && !defined(ZEND_WIN32) # ifndef RTLD_LAZY # define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */ @@ -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 Index: Zend/zend_API.c =================================================================== RCS file: /repository/ZendEngine2/zend_API.c,v retrieving revision 1.503 diff -u -r1.503 zend_API.c --- Zend/zend_API.c 4 Jun 2009 18:18:46 -0000 1.503 +++ Zend/zend_API.c 18 Jun 2009 14:38:47 -0000 @@ -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); Index: Zend/zend_extensions.c =================================================================== RCS file: /repository/ZendEngine2/zend_extensions.c,v retrieving revision 1.60 diff -u -r1.60 zend_extensions.c --- Zend/zend_extensions.c 8 Apr 2009 13:26:24 -0000 1.60 +++ Zend/zend_extensions.c 18 Jun 2009 14:38:47 -0000 @@ -219,70 +219,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: Index: ext/standard/dl.c =================================================================== RCS file: /repository/php-src/ext/standard/dl.c,v retrieving revision 1.131 diff -u -r1.131 dl.c --- ext/standard/dl.c 10 Mar 2009 23:39:39 -0000 1.131 +++ ext/standard/dl.c 18 Jun 2009 14:38:48 -0000 @@ -29,7 +29,7 @@ #include "SAPI.h" -#if defined(HAVE_LIBDL) || HAVE_MACH_O_DYLD_H +#if defined(HAVE_LIBDL) #include #include #ifdef HAVE_STRING_H @@ -48,7 +48,7 @@ #include #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 --Apple-Mail-4-741390324--