Skip to content

Commit 64ad873

Browse files
committed
Add --enable-rtld-deepbind configure flag
1 parent c853e32 commit 64ad873

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Zend/zend_portability.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164

165165
# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
166166
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_GROUP | RTLD_WORLD | RTLD_PARENT)
167-
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(memory_sanitizer)
167+
# elif defined(RTLD_DEEPBIND) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(memory_sanitizer) && defined(PHP_USE_RTLD_DEEPBIND)
168168
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL | RTLD_DEEPBIND)
169169
# else
170170
# define DL_LOAD(libname) dlopen(libname, PHP_RTLD_MODE | RTLD_GLOBAL)

configure.ac

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,23 @@ if test "$PHP_RTLD_NOW" = "yes"; then
922922
AC_DEFINE(PHP_USE_RTLD_NOW, 1, [ Use dlopen with RTLD_NOW instead of RTLD_LAZY ])
923923
fi
924924

925+
if test "$PHP_SAPI" = "apache2handler"; then
926+
PHP_RTLD_DEEPBIND_DEFAULT=yes
927+
else
928+
PHP_RTLD_DEEPBIND_DEFAULT=no
929+
fi
930+
931+
PHP_ARG_ENABLE([rtld-deepbind],
932+
[whether to dlopen extensions with RTLD_DEEPBIND],
933+
[AS_HELP_STRING([--enable-rtld-deepbind],
934+
[Use dlopen with RTLD_DEEPBIND])],
935+
[$PHP_RTLD_DEEPBIND_DEFAULT],
936+
[$PHP_RTLD_DEEPBIND_DEFAULT])
937+
938+
if test "$PHP_RTLD_DEEPBIND" = "yes"; then
939+
AC_DEFINE(PHP_USE_RTLD_DEEPBIND, 1, [ Use dlopen with RTLD_DEEPBIND ])
940+
fi
941+
925942
PHP_ARG_WITH([layout],
926943
[layout of installed files],
927944
[AS_HELP_STRING([--with-layout=TYPE],

0 commit comments

Comments
 (0)