]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use dlsym for -ldl detection
authorMichal Nowak <mnowak@isc.org>
Mon, 18 Jan 2021 11:34:36 +0000 (12:34 +0100)
committerMichal Nowak <mnowak@isc.org>
Tue, 19 Jan 2021 07:05:54 +0000 (08:05 +0100)
-fsanitize=thread hijacks dlopen() and dlclose(), therefore dlopen()
won't request -ldl to be used for linking during Autoconf test. Check
for dlsym() presence will fail and dlzexternal and dyndb system tests
won't run.

Retrieved from 2dd54fa62f345d72749b71370410c6a68a5fddca.

configure
configure.ac

index 7f61e81264746951f55cf619598f345d80d98f67..57287a2787a122addadd5db7fa794aa4835ca3be 100755 (executable)
--- a/configure
+++ b/configure
 case $with_dlopen in #(
   auto|yes) :
 
-         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
-$as_echo_n "checking for library containing dlopen... " >&6; }
-if ${ac_cv_search_dlopen+:} false; then :
+         # -fsanitize=thread hijacks dlopen and dlclose so use dlsym.
+         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5
+$as_echo_n "checking for library containing dlsym... " >&6; }
+if ${ac_cv_search_dlsym+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
@@ -24380,11 +24381,11 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char dlopen ();
+char dlsym ();
 int
 main ()
 {
-return dlopen ();
+return dlsym ();
   ;
   return 0;
 }
@@ -24397,25 +24398,25 @@ for ac_lib in '' dl; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
   if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_dlopen=$ac_res
+  ac_cv_search_dlsym=$ac_res
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext
-  if ${ac_cv_search_dlopen+:} false; then :
+  if ${ac_cv_search_dlsym+:} false; then :
   break
 fi
 done
-if ${ac_cv_search_dlopen+:} false; then :
+if ${ac_cv_search_dlsym+:} false; then :
 
 else
-  ac_cv_search_dlopen=no
+  ac_cv_search_dlsym=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5
-$as_echo "$ac_cv_search_dlopen" >&6; }
-ac_res=$ac_cv_search_dlopen
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlsym" >&5
+$as_echo "$ac_cv_search_dlsym" >&6; }
+ac_res=$ac_cv_search_dlsym
 if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
index 66760f9454e8aff301642c6a327cdd032f72e734..6ecdbf9b34fbfef7b0db730cf76ddc2057913f60 100644 (file)
@@ -5176,7 +5176,8 @@ AS_IF([test "$pic_mode" = "no"],
 
 AS_CASE([$with_dlopen],
        [auto|yes],[
-         AC_SEARCH_LIBS([dlopen],[dl])
+         # -fsanitize=thread hijacks dlopen and dlclose so use dlsym.
+         AC_SEARCH_LIBS([dlsym],[dl])
          AC_CHECK_FUNCS([dlopen dlclose dlsym],
                         [with_dlopen="yes"],
                         [with_dlopen="no"])