about summary refs log tree commit diff
path: root/dlfcn
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-03 08:26:04 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-03 08:26:04 +0200
commitadd8d7ea01d5a22c2d7d184240dda6a7767e54e8 (patch)
tree22056615da5940658eeb0db5d45bcc370578ebcd /dlfcn
parent6dfc0207ebeb639e47ba7387a9123ed622904cf7 (diff)
downloadglibc-add8d7ea01d5a22c2d7d184240dda6a7767e54e8.tar.gz
glibc-add8d7ea01d5a22c2d7d184240dda6a7767e54e8.tar.xz
glibc-add8d7ea01d5a22c2d7d184240dda6a7767e54e8.zip
dlfcn: Move dlvsym into libc
The symbol was moved using scripts/move-symbol-to-libc.py.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
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 c65cdc2e2b..08d92f85fc 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 ca9a3e5591..3c4fa2742e 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 519e706ea1..de6b340647 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 ec4286058c..0000000000
--- a/dlfcn/sdlvsym.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "dlvsym.c"