mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Merge branch 'master' into sccp
* master: fix fold Fixed bug #74866 extension_dir = "./ext" now use current directory for base add next vc15 toolset to the list Revert "Enable whole program optimization for builds without PGO, too" extend comment cleanup discontinued target
This commit is contained in:
commit
a32a3fb67c
7 changed files with 71 additions and 44 deletions
|
@ -29,8 +29,6 @@ int zend_load_extension(const char *path)
|
|||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
DL_HANDLE handle;
|
||||
zend_extension *new_extension;
|
||||
zend_extension_version_info *extension_version_info;
|
||||
|
||||
handle = DL_LOAD(path);
|
||||
if (!handle) {
|
||||
|
@ -43,6 +41,22 @@ int zend_load_extension(const char *path)
|
|||
#endif
|
||||
return FAILURE;
|
||||
}
|
||||
return zend_load_extension_handle(handle, path);
|
||||
#else
|
||||
fprintf(stderr, "Extensions are not supported on this platform.\n");
|
||||
/* See http://support.microsoft.com/kb/190351 */
|
||||
#ifdef ZEND_WIN32
|
||||
fflush(stderr);
|
||||
#endif
|
||||
return FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
int zend_load_extension_handle(DL_HANDLE handle, const char *path)
|
||||
{
|
||||
#if ZEND_EXTENSIONS_SUPPORT
|
||||
zend_extension *new_extension;
|
||||
zend_extension_version_info *extension_version_info;
|
||||
|
||||
extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info");
|
||||
if (!extension_version_info) {
|
||||
|
@ -62,7 +76,6 @@ int zend_load_extension(const char *path)
|
|||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/* allow extension to proclaim compatibility with any Zend version */
|
||||
if (extension_version_info->zend_extension_api_no != ZEND_EXTENSION_API_NO &&(!new_extension->api_no_check || new_extension->api_no_check(ZEND_EXTENSION_API_NO) != SUCCESS)) {
|
||||
if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
|
||||
|
|
|
@ -145,6 +145,7 @@ void zend_shutdown_extensions(void);
|
|||
|
||||
BEGIN_EXTERN_C()
|
||||
ZEND_API int zend_load_extension(const char *path);
|
||||
ZEND_API int zend_load_extension_handle(DL_HANDLE handle, const char *path);
|
||||
ZEND_API int zend_register_extension(zend_extension *new_extension, DL_HANDLE handle);
|
||||
ZEND_API zend_extension *zend_get_extension(const char *extension_name);
|
||||
ZEND_API size_t zend_extensions_op_array_persist_calc(zend_op_array *op_array);
|
||||
|
|
|
@ -76,6 +76,32 @@ PHPAPI PHP_FUNCTION(dl)
|
|||
|
||||
#if defined(HAVE_LIBDL)
|
||||
|
||||
/* {{{ php_load_shlib
|
||||
*/
|
||||
PHPAPI void *php_load_shlib(char *path, char **errp)
|
||||
{
|
||||
void *handle;
|
||||
char *err;
|
||||
|
||||
handle = DL_LOAD(path);
|
||||
if (!handle) {
|
||||
err = GET_DL_ERROR();
|
||||
#ifdef PHP_WIN32
|
||||
if (err && (*err)) {
|
||||
(*errp)=estrdup(err);
|
||||
LocalFree(err);
|
||||
} else {
|
||||
(*errp) = estrdup("<No message>");
|
||||
}
|
||||
#else
|
||||
(*errp) = estrdup(err);
|
||||
GET_DL_ERROR(); /* free the buffer storing the error */
|
||||
#endif
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ php_load_extension
|
||||
*/
|
||||
PHPAPI int php_load_extension(char *filename, int type, int start_now)
|
||||
|
@ -109,6 +135,7 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
|
|||
libpath = estrdup(filename);
|
||||
} else if (extension_dir && extension_dir[0]) {
|
||||
int extension_dir_len = (int)strlen(extension_dir);
|
||||
char *err1, *err2;
|
||||
slash_suffix = IS_SLASH(extension_dir[extension_dir_len-1]);
|
||||
/* Try as filename first */
|
||||
if (slash_suffix) {
|
||||
|
@ -117,8 +144,9 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
|
|||
spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename); /* SAFE */
|
||||
}
|
||||
|
||||
if (VCWD_ACCESS(libpath, F_OK)) {
|
||||
/* If file does not exist, consider as extension name and build file name */
|
||||
handle = php_load_shlib(libpath, &err1);
|
||||
if (!handle) {
|
||||
/* Now, consider 'filename' as extension name and build file name */
|
||||
char *orig_libpath = libpath;
|
||||
|
||||
if (slash_suffix) {
|
||||
|
@ -127,37 +155,23 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now)
|
|||
spprintf(&libpath, 0, "%s%c" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, DEFAULT_SLASH, filename); /* SAFE */
|
||||
}
|
||||
|
||||
if (VCWD_ACCESS(libpath, F_OK)) {
|
||||
php_error(error_type, "Cannot access dynamic library '%s' (tried : %s, %s)",
|
||||
filename, orig_libpath, libpath);
|
||||
handle = php_load_shlib(libpath, &err2);
|
||||
if (!handle) {
|
||||
php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' (tried: %s (%s), %s (%s))",
|
||||
filename, orig_libpath, err1, libpath, err2);
|
||||
efree(orig_libpath);
|
||||
efree(err1);
|
||||
efree(libpath);
|
||||
efree(err2);
|
||||
return FAILURE;
|
||||
}
|
||||
efree(orig_libpath);
|
||||
efree(err1);
|
||||
}
|
||||
} else {
|
||||
return FAILURE; /* Not full path given or extension_dir is not set */
|
||||
}
|
||||
|
||||
/* load dynamic symbol */
|
||||
handle = DL_LOAD(libpath);
|
||||
if (!handle) {
|
||||
#ifdef PHP_WIN32
|
||||
char *err = GET_DL_ERROR();
|
||||
if (err && (*err != '\0')) {
|
||||
php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' - %s", libpath, err);
|
||||
LocalFree(err);
|
||||
} else {
|
||||
php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' - %s", libpath, "Unknown reason");
|
||||
}
|
||||
#else
|
||||
php_error_docref(NULL, error_type, "Unable to load dynamic library '%s' - %s", libpath, GET_DL_ERROR());
|
||||
GET_DL_ERROR(); /* free the buffer storing the error */
|
||||
#endif
|
||||
efree(libpath);
|
||||
return FAILURE;
|
||||
}
|
||||
efree(libpath);
|
||||
|
||||
get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module");
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
PHPAPI int php_load_extension(char *filename, int type, int start_now);
|
||||
PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now);
|
||||
PHPAPI void *php_load_shlib(char *path, char **errp);
|
||||
|
||||
/* dynamic loading functions */
|
||||
PHPAPI PHP_FUNCTION(dl);
|
||||
|
|
|
@ -362,10 +362,12 @@ static void php_load_zend_extension_cb(void *arg)
|
|||
if (IS_ABSOLUTE_PATH(filename, length)) {
|
||||
zend_load_extension(filename);
|
||||
} else {
|
||||
DL_HANDLE handle;
|
||||
char *libpath;
|
||||
char *extension_dir = INI_STR("extension_dir");
|
||||
int extension_dir_len = (int)strlen(extension_dir);
|
||||
int slash_suffix = IS_SLASH(extension_dir[extension_dir_len-1]);
|
||||
char *err1, *err2;
|
||||
/* Try as filename first */
|
||||
if (slash_suffix) {
|
||||
spprintf(&libpath, 0, "%s%s", extension_dir, filename); /* SAFE */
|
||||
|
@ -373,7 +375,8 @@ static void php_load_zend_extension_cb(void *arg)
|
|||
spprintf(&libpath, 0, "%s%c%s", extension_dir, DEFAULT_SLASH, filename); /* SAFE */
|
||||
}
|
||||
|
||||
if (VCWD_ACCESS(libpath, F_OK)) {
|
||||
handle = (DL_HANDLE)php_load_shlib(libpath, &err1);
|
||||
if (!handle) {
|
||||
/* If file does not exist, consider as extension name and build file name */
|
||||
char *orig_libpath = libpath;
|
||||
|
||||
|
@ -383,18 +386,22 @@ static void php_load_zend_extension_cb(void *arg)
|
|||
spprintf(&libpath, 0, "%s%c" PHP_SHLIB_EXT_PREFIX "%s." PHP_SHLIB_SUFFIX, extension_dir, DEFAULT_SLASH, filename); /* SAFE */
|
||||
}
|
||||
|
||||
if (VCWD_ACCESS(libpath, F_OK)) {
|
||||
php_error(E_CORE_WARNING, "Cannot access Zend extension %s (Tried: %s, %s)\n",
|
||||
filename, orig_libpath, libpath);
|
||||
handle = (DL_HANDLE)php_load_shlib(libpath, &err2);
|
||||
if (!handle) {
|
||||
php_error(E_CORE_WARNING, "Failed loading Zend extension '%s' (tried: %s (%s), %s (%s))",
|
||||
filename, orig_libpath, err1, libpath, err2);
|
||||
efree(orig_libpath);
|
||||
efree(err1);
|
||||
efree(libpath);
|
||||
efree(err2);
|
||||
return;
|
||||
}
|
||||
|
||||
efree(orig_libpath);
|
||||
efree(err1);
|
||||
}
|
||||
|
||||
zend_load_extension(libpath);
|
||||
zend_load_extension_handle(handle, libpath);
|
||||
efree(libpath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,9 +210,6 @@ snap: build-snap build-devel build-dist
|
|||
$(BUILD_DIR)\deplister.exe: win32\build\deplister.c
|
||||
$(CC) /Fo$(BUILD_DIR)\ /Fd$(BUILD_DIR)\ /Fp$(BUILD_DIR)\ /FR$(BUILD_DIR) /Fe$(BUILD_DIR)\deplister.exe win32\build\deplister.c imagehlp.lib
|
||||
|
||||
msi-installer: dist
|
||||
$(BUILD_DIR)\php.exe ..\php-installer\build-installer.php "$(BUILD_DIR)" "$(PHPDLL)" "$(SAPI_TARGETS)" "$(EXT_TARGETS)" "$(PECL_TARGETS)"
|
||||
|
||||
# need to redirect, since INSTALL is a file in the root...
|
||||
install: really-install install-sdk
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ var PHP_TEST_INI_EXT_EXCLUDE = "";
|
|||
|
||||
var PHP_MAKEFILE_FRAGMENTS = PHP_SRC_DIR + "\\Makefile.fragments.w32";
|
||||
|
||||
/* Care also about NTDDI_VERSION and _WIN32_WINNT in config.w32.h.in */
|
||||
/* Care also about NTDDI_VERSION and _WIN32_WINNT in config.w32.h.in
|
||||
and manifest. */
|
||||
var WINVER = "0x0601"; /* 7/2008r2 */
|
||||
|
||||
// There's a minimum requirement for re2c..
|
||||
|
@ -67,12 +68,14 @@ VC_VERSIONS[1700] = 'MSVC11 (Visual C++ 2012)';
|
|||
VC_VERSIONS[1800] = 'MSVC12 (Visual C++ 2013)';
|
||||
VC_VERSIONS[1900] = 'MSVC14 (Visual C++ 2015)';
|
||||
VC_VERSIONS[1910] = 'MSVC15 (Visual C++ 2017)';
|
||||
VC_VERSIONS[1911] = 'MSVC15 (Visual C++ 2017)';
|
||||
|
||||
var VC_VERSIONS_SHORT = new Array();
|
||||
VC_VERSIONS_SHORT[1700] = 'VC11';
|
||||
VC_VERSIONS_SHORT[1800] = 'VC12';
|
||||
VC_VERSIONS_SHORT[1900] = 'VC14';
|
||||
VC_VERSIONS_SHORT[1910] = 'VC15';
|
||||
VC_VERSIONS_SHORT[1911] = 'VC15';
|
||||
|
||||
if (PROGRAM_FILES == null) {
|
||||
PROGRAM_FILES = "C:\\Program Files";
|
||||
|
@ -1228,9 +1231,6 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir)
|
|||
}
|
||||
|
||||
ldflags += " /PGD:$(PGOPGD_DIR)\\" + makefiletarget.substring(0, makefiletarget.indexOf(".")) + ".pgd";
|
||||
} else if (PHP_DEBUG != "yes") {
|
||||
ADD_FLAG('CFLAGS_' + SAPI, "/GL");
|
||||
ADD_FLAG('LDFLAGS_' + SAPI, "/LTCG:INCREMENTAL");
|
||||
}
|
||||
|
||||
if (MODE_PHPIZE) {
|
||||
|
@ -1431,9 +1431,6 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
|||
ADD_FLAG('CFLAGS_' + EXT, "/GL /O2");
|
||||
|
||||
ldflags = " /PGD:$(PGOPGD_DIR)\\" + dllname.substring(0, dllname.indexOf(".")) + ".pgd";
|
||||
} else if (PHP_DEBUG != "yes") {
|
||||
ADD_FLAG('CFLAGS_' + EXT, "/GL");
|
||||
ADD_FLAG('LDFLAGS_' + EXT, "/LTCG:INCREMENTAL");
|
||||
}
|
||||
|
||||
MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname);
|
||||
|
@ -1476,9 +1473,6 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir)
|
|||
ADD_FLAG("STATIC_EXT_CFLAGS", "/GL /O2");
|
||||
static_pgo_enabled = true;
|
||||
}
|
||||
} else if (PHP_DEBUG != "yes") {
|
||||
ADD_FLAG("STATIC_EXT_CFLAGS", "/GL");
|
||||
ADD_FLAG('STATIC_EXT_LDFLAGS', "/LTCG:INCREMENTAL");
|
||||
}
|
||||
|
||||
/* find the header that declares the module pointer,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue