aboutsummaryrefslogtreecommitdiff
path: root/dlfcn
diff options
context:
space:
mode:
Diffstat (limited to 'dlfcn')
-rw-r--r--dlfcn/Makefile3
-rw-r--r--dlfcn/Versions6
-rw-r--r--dlfcn/dlvsym.c66
-rw-r--r--dlfcn/sdlvsym.c1
4 files changed, 45 insertions, 31 deletions
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index c65cdc2..08d92f8 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -21,7 +21,7 @@ include ../Makeconfig
headers := bits/dlfcn.h dlfcn.h
extra-libs := libdl
-libdl-routines := dlopen dlvsym \
+libdl-routines := dlopen \
dlfcn
routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines)))
elide-routines.os := $(routines)
@@ -33,6 +33,7 @@ routines += \
dlinfo \
dlmopen \
dlsym \
+ dlvsym \
libc_dlerror_result \
extra-libs-others := libdl
diff --git a/dlfcn/Versions b/dlfcn/Versions
index ca9a3e5..3c4fa27 100644
--- a/dlfcn/Versions
+++ b/dlfcn/Versions
@@ -5,6 +5,9 @@ libc {
dlerror;
dlsym;
}
+ GLIBC_2.1 {
+ dlvsym;
+ }
GLIBC_2.3.3 {
dladdr1;
dlinfo;
@@ -20,6 +23,7 @@ libc {
dlinfo;
dlmopen;
dlsym;
+ dlvsym;
}
GLIBC_PRIVATE {
__libc_dlerror_result;
@@ -32,7 +36,7 @@ libdl {
dlopen;
}
GLIBC_2.1 {
- dlopen; dlvsym;
+ dlopen;
}
GLIBC_2.3.3 {
__libdl_version_placeholder;
diff --git a/dlfcn/dlvsym.c b/dlfcn/dlvsym.c
index 519e706..de6b340 100644
--- a/dlfcn/dlvsym.c
+++ b/dlfcn/dlvsym.c
@@ -17,20 +17,9 @@
<https://www.gnu.org/licenses/>. */
#include <dlfcn.h>
-#include <stddef.h>
-
#include <ldsodefs.h>
-
-#if !defined SHARED && IS_IN (libdl)
-
-void *
-weak_function
-dlvsym (void *handle, const char *name, const char *version_str)
-{
- return __dlvsym (handle, name, version_str, RETURN_ADDRESS (0));
-}
-
-#else
+#include <shlib-compat.h>
+#include <stddef.h>
struct dlvsym_args
{
@@ -44,29 +33,23 @@ struct dlvsym_args
void *sym;
};
-
static void
dlvsym_doit (void *a)
{
- struct dlvsym_args *args = (struct dlvsym_args *)a;
+ struct dlvsym_args *args = (struct dlvsym_args *) a;
args->sym = _dl_vsym (args->handle, args->name, args->version, args->who);
}
-void *
-__dlvsym (void *handle, const char *name, const char *version_str
- DL_CALLER_DECL)
+static void *
+dlvsym_implementation (void *handle, const char *name, const char *version,
+ void *dl_caller)
{
-# ifdef SHARED
- if (!rtld_active ())
- return _dlfcn_hook->dlvsym (handle, name, version_str, DL_CALLER);
-# endif
-
struct dlvsym_args args;
+ args.who = dl_caller;
args.handle = handle;
args.name = name;
- args.who = DL_CALLER;
- args.version = version_str;
+ args.version = version;
/* Protect against concurrent loads and unloads. */
__rtld_lock_lock_recursive (GL(dl_load_lock));
@@ -77,7 +60,34 @@ __dlvsym (void *handle, const char *name, const char *version_str
return result;
}
-# ifdef SHARED
-weak_alias (__dlvsym, dlvsym)
+
+#ifdef SHARED
+void *
+___dlvsym (void *handle, const char *name, const char *version)
+{
+ if (!rtld_active ())
+ return _dlfcn_hook->dlvsym (handle, name, version, RETURN_ADDRESS (0));
+ else
+ return dlvsym_implementation (handle, name, version, RETURN_ADDRESS (0));
+}
+versioned_symbol (libc, ___dlvsym, dlvsym, GLIBC_2_34);
+
+# if OTHER_SHLIB_COMPAT (libdl, GLIBC_2_1, GLIBC_2_34)
+compat_symbol (libdl, ___dlvsym, dlvsym, GLIBC_2_1);
# endif
-#endif
+
+#else /* !SHARED */
+/* Also used with _dlfcn_hook. */
+void *
+__dlvsym (void *handle, const char *name, const char *version, void *dl_caller)
+{
+ return dlvsym_implementation (handle, name, version, dl_caller);
+}
+
+void *
+___dlvsym (void *handle, const char *name, const char *version)
+{
+ return __dlvsym (handle, name, version, RETURN_ADDRESS (0));
+}
+weak_alias (___dlvsym, dlvsym)
+#endif /* !SHARED */
diff --git a/dlfcn/sdlvsym.c b/dlfcn/sdlvsym.c
deleted file mode 100644
index ec42860..0000000
--- a/dlfcn/sdlvsym.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "dlvsym.c"