com php-src: add --enable-rtld-now build option to change dlopen behavior: Zend/zend_portability.h configure.ac
| From: | Remi Collet | Date: | Tue, 12 Mar 2019 07:23:06 +0000 |
| Subject: | com php-src: add --enable-rtld-now build option to change dlopen behavior: Zend/zend_portability.h configure.ac | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105097@lists.php.net to get a copy of this message | ||
Commit: d633cbac1c1d957ae07994b2e20ea4d86ad8dc3c
Author: Remi Collet <remi@remirepo.net> Mon, 11 Mar 2019 13:38:58 +0100
Committer: Remi Collet <remi@php.net> Tue, 12 Mar 2019 08:23:06 +0100
Parents: b003e0a0f58a690854ebb99e3205b78f22abb567
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d633cbac1c1d957ae07994b2e20ea4d86ad8dc3c
Log:
add --enable-rtld-now build option to change dlopen behavior
Changed paths:
M Zend/zend_portability.h
M configure.ac
Diff:
diff --git a/Zend/zend_portability.h b/Zend/zend_portability.h
index 90e6729..18e312e 100644
--- a/Zend/zend_portability.h
+++ b/Zend/zend_portability.h
@@ -139,12 +139,18 @@
# define RTLD_GLOBAL 0
# endif
+# ifdef PHP_USE_RTLD_NOW
+# define PHP_RTLD_MODE RTLD_NOW
+# else
+# define PHP_RTLD_MODE RTLD_LAZY
+# endif
+
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD |
RTLD_PARENT)
+# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD
| RTLD_PARENT)
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__)
-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND)
+# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
# else
-# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
+# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL)
# endif
# define DL_UNLOAD dlclose
# if defined(DLSYM_NEEDS_UNDERSCORE)
diff --git a/configure.ac b/configure.ac
index 633388c..43317ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -927,6 +927,17 @@ else
ZEND_DEBUG=no
fi
+PHP_ARG_ENABLE([rtld-now],
+ [whether to dlopen extensions with RTLD_NOW instead of RTLD_LAZY],
+ [AS_HELP_STRING([--enable-rtld-now],
+ [Use dlopen with RTLD_NOW instead of RTLD_LAZY])],
+ [no],
+ [no])
+
+if test "$PHP_RTLD_NOW" = "yes"; then
+ AC_DEFINE(PHP_USE_RTLD_NOW, 1, [ Use dlopen with RTLD_NOW instead of RTLD_LAZY ])
+fi
+
PHP_ARG_WITH([layout],
[layout of installed files],
[AS_HELP_STRING([--with-layout=TYPE],