summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-18 17:18:37 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-18 17:18:37 -0700
commit8157f3e03107e77b8306d4ab1388a63548a13470 (patch)
treef335cf9248278c9cda07c49bc73475cae7f1fc8e
parent8e354058532d48dce19fdf0b2e0653609a69f19e (diff)
downloadbinutils-gdb-users/hjl/pr22318.tar.gz
Use dlsym to check if libdl is needed for pluginusers/hjl/pr22318
config/plugins.m4 has if test "$plugins" = "yes"; then AC_SEARCH_LIBS([dlopen], [dl]) fi Plugin uses dlsym, but libasan.so only intercepts dlopen, not dlsym: [hjl@gnu-tools-1 binutils-text]$ nm -D /lib64/libasan.so.4| grep " dl" 0000000000038580 W dlclose U dl_iterate_phdr 000000000004dc50 W dlopen U dlsym U dlvsym [hjl@gnu-tools-1 binutils-text]$ Testing dlopen for libdl leads to false negative when -fsanitize=address is used. It results in link failure: ../bfd/.libs/libbfd.a(plugin.o): undefined reference to symbol 'dlsym@@GLIBC_2.16' dlsym should be used to check if libdl is needed for plugin. bfd/ PR gas/22318 * configure: Regenerated. binutils/ PR gas/22318 * configure: Regenerated. config/ * plugins.m4 (AC_PLUGINS): Use dlsym to check if libdl is needed. gas/ PR gas/22318 * configure: Regenerated. gprof/ PR gas/22318 * configure: Regenerated. ld/ PR gas/22318 * configure: Regenerated.
-rwxr-xr-xbfd/configure24
-rwxr-xr-xbinutils/configure24
-rw-r--r--config/plugins.m42
-rwxr-xr-xgas/configure24
-rwxr-xr-xgprof/configure24
-rwxr-xr-xld/configure24
6 files changed, 61 insertions, 61 deletions
diff --git a/bfd/configure b/bfd/configure
index 32ee062e808..f019a61fb02 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -11826,9 +11826,9 @@ else
fi
if test "$plugins" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
-$as_echo_n "checking for library containing dlopen... " >&6; }
-if test "${ac_cv_search_dlopen+set}" = set; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5
+$as_echo_n "checking for library containing dlsym... " >&6; }
+if test "${ac_cv_search_dlsym+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -11841,11 +11841,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;
}
@@ -11858,25 +11858,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 test "${ac_cv_search_dlopen+set}" = set; then :
+ if test "${ac_cv_search_dlsym+set}" = set; then :
break
fi
done
-if test "${ac_cv_search_dlopen+set}" = set; then :
+if test "${ac_cv_search_dlsym+set}" = set; 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"
diff --git a/binutils/configure b/binutils/configure
index 22e1b1736ed..9691ec23f0b 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -11622,9 +11622,9 @@ else
fi
if test "$plugins" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
-$as_echo_n "checking for library containing dlopen... " >&6; }
-if test "${ac_cv_search_dlopen+set}" = set; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5
+$as_echo_n "checking for library containing dlsym... " >&6; }
+if test "${ac_cv_search_dlsym+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -11637,11 +11637,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;
}
@@ -11654,25 +11654,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 test "${ac_cv_search_dlopen+set}" = set; then :
+ if test "${ac_cv_search_dlsym+set}" = set; then :
break
fi
done
-if test "${ac_cv_search_dlopen+set}" = set; then :
+if test "${ac_cv_search_dlsym+set}" = set; 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"
diff --git a/config/plugins.m4 b/config/plugins.m4
index 513c690e1b5..c6acebc1ca4 100644
--- a/config/plugins.m4
+++ b/config/plugins.m4
@@ -16,6 +16,6 @@ AC_DEFUN([AC_PLUGINS],
[plugins=$maybe_plugins]
)
if test "$plugins" = "yes"; then
- AC_SEARCH_LIBS([dlopen], [dl])
+ AC_SEARCH_LIBS([dlsym], [dl])
fi
])
diff --git a/gas/configure b/gas/configure
index 93afb20c8fa..b4dcc12e22d 100755
--- a/gas/configure
+++ b/gas/configure
@@ -11383,9 +11383,9 @@ else
fi
if test "$plugins" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
-$as_echo_n "checking for library containing dlopen... " >&6; }
-if test "${ac_cv_search_dlopen+set}" = set; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5
+$as_echo_n "checking for library containing dlsym... " >&6; }
+if test "${ac_cv_search_dlsym+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -11398,11 +11398,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;
}
@@ -11415,25 +11415,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 test "${ac_cv_search_dlopen+set}" = set; then :
+ if test "${ac_cv_search_dlsym+set}" = set; then :
break
fi
done
-if test "${ac_cv_search_dlopen+set}" = set; then :
+if test "${ac_cv_search_dlsym+set}" = set; 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"
diff --git a/gprof/configure b/gprof/configure
index e71fe8b9e49..a4d0ed360ae 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -11298,9 +11298,9 @@ else
fi
if test "$plugins" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
-$as_echo_n "checking for library containing dlopen... " >&6; }
-if test "${ac_cv_search_dlopen+set}" = set; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5
+$as_echo_n "checking for library containing dlsym... " >&6; }
+if test "${ac_cv_search_dlsym+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -11313,11 +11313,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;
}
@@ -11330,25 +11330,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 test "${ac_cv_search_dlopen+set}" = set; then :
+ if test "${ac_cv_search_dlsym+set}" = set; then :
break
fi
done
-if test "${ac_cv_search_dlopen+set}" = set; then :
+if test "${ac_cv_search_dlsym+set}" = set; 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"
diff --git a/ld/configure b/ld/configure
index 473b6c0562f..8b74a03cd8e 100755
--- a/ld/configure
+++ b/ld/configure
@@ -15137,9 +15137,9 @@ else
fi
if test "$plugins" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
-$as_echo_n "checking for library containing dlopen... " >&6; }
-if test "${ac_cv_search_dlopen+set}" = set; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5
+$as_echo_n "checking for library containing dlsym... " >&6; }
+if test "${ac_cv_search_dlsym+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -15152,11 +15152,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;
}
@@ -15169,25 +15169,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 test "${ac_cv_search_dlopen+set}" = set; then :
+ if test "${ac_cv_search_dlsym+set}" = set; then :
break
fi
done
-if test "${ac_cv_search_dlopen+set}" = set; then :
+if test "${ac_cv_search_dlsym+set}" = set; 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"