add --enable-rtld-now build option to change dlopen behavior

This commit is contained in:
Remi Collet 2019-03-11 13:38:58 +01:00 committed by Remi Collet
parent b003e0a0f5
commit d633cbac1c
2 changed files with 22 additions and 5 deletions

View File

@ -139,12 +139,18 @@
# define RTLD_GLOBAL 0
# 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)
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__)
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND)
# ifdef PHP_USE_RTLD_NOW
# define PHP_RTLD_MODE RTLD_NOW
# else
# define DL_LOAD(libname) dlopen(libname, RTLD_LAZY | RTLD_GLOBAL)
# define PHP_RTLD_MODE RTLD_LAZY
# endif
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(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, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
# else
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL)
# endif
# define DL_UNLOAD dlclose
# if defined(DLSYM_NEEDS_UNDERSCORE)

View File

@ -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],