Skip to content

Commit

Permalink
configure: check for RTLD_DEEPBIND, rename
Browse files Browse the repository at this point in the history
  • Loading branch information
trws committed Oct 15, 2018
1 parent 478745f commit 4646ef4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ AS_CASE($ax_cv_cxx_compiler_vendor,
AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])

X_AC_ENABLE_SANITIZER
if test "x$san_enabled" != "xno" ; then
AC_DEFINE([DEEPBIND], [0],
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
#include <dlfcn.h>
#if !(defined(RTLD_DEEPBIND))
#error nope
#endif
])], [has_deepbind=yes], [has_deepbind=no])
if test "x$san_enabled" != "xno" || test "x$has_deepbind" = "xno" ; then
AC_DEFINE([FLUX_DEEPBIND], [0],
[deepbind is unsupported with asan, musl and so-forth])
else
AC_DEFINE([DEEPBIND], [RTLD_DEEPBIND],
AC_DEFINE([FLUX_DEEPBIND], [RTLD_DEEPBIND],
[deepbind is unsupported with asan, musl and so-forth])
fi

Expand Down
2 changes: 1 addition & 1 deletion src/broker/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ module_t *module_add (modhash_t *mh, const char *path)
int rc;

dlerror ();
if (!(dso = dlopen (path, RTLD_NOW | RTLD_LOCAL | DEEPBIND))) {
if (!(dso = dlopen (path, RTLD_NOW | RTLD_LOCAL | FLUX_DEEPBIND))) {
log_msg ("%s", dlerror ());
errno = ENOENT;
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/common/libflux/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static connector_init_f *find_connector (const char *scheme, void **dsop)
}
if (!(path = find_file (name, searchpath)))
goto done;
if (!(dso = dlopen (path, RTLD_LAZY | RTLD_LOCAL | DEEPBIND))) {
if (!(dso = dlopen (path, RTLD_LAZY | RTLD_LOCAL | FLUX_DEEPBIND))) {
errno = EINVAL;
goto done;
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/libflux/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ char *flux_modname(const char *path)
char *name = NULL;

dlerror ();
if ((dso = dlopen (path, RTLD_LAZY | RTLD_LOCAL | DEEPBIND))) {
if ((dso = dlopen (path, RTLD_LAZY | RTLD_LOCAL | FLUX_DEEPBIND))) {
int errnum = EINVAL;
if ((np = dlsym (dso, "mod_name")) && *np)
if (!(name = strdup (*np)))
Expand Down

0 comments on commit 4646ef4

Please sign in to comment.