about summary refs log tree commit diff
path: root/dlfcn/dlopen.c
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 09:12:05 +0200
commit466c1ea15f461edb8e3ffaf5d86d708876343bbf (patch)
tree43d42d322ff24bd12c4124a9edafc4e0e4232f0a /dlfcn/dlopen.c
parent9c76debc983e1a16e2e723b36526826713a671af (diff)
downloadglibc-466c1ea15f461edb8e3ffaf5d86d708876343bbf.tar.gz
glibc-466c1ea15f461edb8e3ffaf5d86d708876343bbf.tar.xz
glibc-466c1ea15f461edb8e3ffaf5d86d708876343bbf.zip
dlfcn: Rework static dlopen hooks
Consolidate all hooks structures into a single one.  There are
no static dlopen ABI concerns because glibc 2.34 already comes
with substantial ABI-incompatible changes in this area.  (Static
dlopen requires the exact same dynamic glibc version that was used
for static linking.)

The new approach uses a pointer to the hooks structure into
_rtld_global_ro and initalizes it in __rtld_static_init.  This avoids
a back-and-forth with various callback functions.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'dlfcn/dlopen.c')
-rw-r--r--dlfcn/dlopen.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/dlfcn/dlopen.c b/dlfcn/dlopen.c
index afdc113efb..e04b374b82 100644
--- a/dlfcn/dlopen.c
+++ b/dlfcn/dlopen.c
@@ -76,7 +76,7 @@ void *
 ___dlopen (const char *file, int mode)
 {
   if (!rtld_active ())
-    return _dlfcn_hook->dlopen (file, mode, RETURN_ADDRESS (0));
+    return GLRO (dl_dlfcn_hook)->dlopen (file, mode, RETURN_ADDRESS (0));
   else
     return dlopen_implementation (file, mode, RETURN_ADDRESS (0));
 }
@@ -96,13 +96,7 @@ __dlopen (const char *file, int mode, void *dl_caller)
 void *
 ___dlopen (const char *file, int mode)
 {
-  struct link_map *l = __dlopen (file, mode, RETURN_ADDRESS (0));
-  if (l != NULL)
-    {
-      __libc_register_dl_open_hook (l);
-      __libc_register_dlfcn_hook (l);
-    }
-  return l;
+  return __dlopen (file, mode, RETURN_ADDRESS (0));
 }
 weak_alias (___dlopen, dlopen)
 static_link_warning (dlopen)