aboutsummaryrefslogtreecommitdiff
path: root/dlfcn/dlmopen.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/dlmopen.c
parent9c76debc983e1a16e2e723b36526826713a671af (diff)
downloadglibc-466c1ea15f461edb8e3ffaf5d86d708876343bbf.tar
glibc-466c1ea15f461edb8e3ffaf5d86d708876343bbf.tar.gz
glibc-466c1ea15f461edb8e3ffaf5d86d708876343bbf.tar.bz2
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/dlmopen.c')
-rw-r--r--dlfcn/dlmopen.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/dlfcn/dlmopen.c b/dlfcn/dlmopen.c
index ae42814bbf..c171c8953d 100644
--- a/dlfcn/dlmopen.c
+++ b/dlfcn/dlmopen.c
@@ -81,7 +81,7 @@ void *
___dlmopen (Lmid_t nsid, const char *file, int mode)
{
if (!rtld_active ())
- return _dlfcn_hook->dlmopen (nsid, file, mode, RETURN_ADDRESS (0));
+ return GLRO (dl_dlfcn_hook)->dlmopen (nsid, file, mode, RETURN_ADDRESS (0));
else
return dlmopen_implementation (nsid, file, mode, RETURN_ADDRESS (0));
}
@@ -101,13 +101,7 @@ __dlmopen (Lmid_t nsid, const char *file, int mode, void *dl_caller)
void *
___dlmopen (Lmid_t nsid, const char *file, int mode)
{
- struct link_map *l = __dlmopen (nsid, file, mode, RETURN_ADDRESS (0));
- if (l != NULL)
- {
- __libc_register_dl_open_hook (l);
- __libc_register_dlfcn_hook (l);
- }
- return l;
+ return __dlmopen (nsid, file, mode, RETURN_ADDRESS (0));
}
weak_alias (___dlmopen, dlmopen)
static_link_warning (dlmopen)