Skip to content

Commit e87144e

Browse files
committed
Add --enable-rtld-deepbind configure flag
1 parent 53e5c09 commit e87144e

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
@@ -868,6 +868,23 @@ AS_VAR_IF([PHP_RTLD_NOW], [yes],
868868
[Define to 1 if 'dlopen()' uses the 'RTLD_NOW' mode flag instead of
869869
'RTLD_LAZY'.])])
870870

871+
if test "$PHP_SAPI" = "apache2handler"; then
872+
PHP_RTLD_DEEPBIND_DEFAULT=yes
873+
else
874+
PHP_RTLD_DEEPBIND_DEFAULT=no
875+
fi
876+
877+
PHP_ARG_ENABLE([rtld-deepbind],
878+
[whether to dlopen extensions with RTLD_DEEPBIND],
879+
[AS_HELP_STRING([--enable-rtld-deepbind],
880+
[Use dlopen with RTLD_DEEPBIND])],
881+
[$PHP_RTLD_DEEPBIND_DEFAULT],
882+
[$PHP_RTLD_DEEPBIND_DEFAULT])
883+
884+
if test "$PHP_RTLD_DEEPBIND" = "yes"; then
885+
AC_DEFINE(PHP_USE_RTLD_DEEPBIND, 1, [ Use dlopen with RTLD_DEEPBIND ])
886+
fi
887+
871888
PHP_ARG_WITH([layout],
872889
[layout of installed files],
873890
[AS_HELP_STRING([--with-layout=TYPE],

0 commit comments

Comments
 (0)