From 6dfc0207ebeb639e47ba7387a9123ed622904cf7 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Thu, 3 Jun 2021 08:26:04 +0200 Subject: dlfcn: Move dlinfo into libc The symbol was moved using scripts/move-symbol-to-libc.py. Reviewed-by: Adhemerval Zanella --- dlfcn/Makefile | 3 ++- dlfcn/Versions | 4 +++- dlfcn/dlfcn.c | 6 ++++++ dlfcn/dlinfo.c | 45 +++++++++++++++++++++++++-------------------- dlfcn/sdlinfo.c | 1 - 5 files changed, 36 insertions(+), 23 deletions(-) delete mode 100644 dlfcn/sdlinfo.c (limited to 'dlfcn') diff --git a/dlfcn/Makefile b/dlfcn/Makefile index 1dfa247538..c65cdc2e2b 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 dlinfo \ +libdl-routines := dlopen dlvsym \ dlfcn routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines))) elide-routines.os := $(routines) @@ -30,6 +30,7 @@ routines += \ dladdr1 \ dlclose \ dlerror \ + dlinfo \ dlmopen \ dlsym \ libc_dlerror_result \ diff --git a/dlfcn/Versions b/dlfcn/Versions index acd9402b34..ca9a3e5591 100644 --- a/dlfcn/Versions +++ b/dlfcn/Versions @@ -7,6 +7,7 @@ libc { } GLIBC_2.3.3 { dladdr1; + dlinfo; } GLIBC_2.3.4 { dlmopen; @@ -16,6 +17,7 @@ libc { dladdr; dlclose; dlerror; + dlinfo; dlmopen; dlsym; } @@ -33,7 +35,7 @@ libdl { dlopen; dlvsym; } GLIBC_2.3.3 { - dlinfo; + __libdl_version_placeholder; } GLIBC_2.3.4 { __libdl_version_placeholder; diff --git a/dlfcn/dlfcn.c b/dlfcn/dlfcn.c index 90cdee0903..55ecfcabbe 100644 --- a/dlfcn/dlfcn.c +++ b/dlfcn/dlfcn.c @@ -48,6 +48,12 @@ __libdl_version_placeholder_1 (void) { } +#if SHLIB_COMPAT (libdl, GLIBC_2_3_3, GLIBC_2_34) \ + && ABI_libdl_GLIBC_2_3_3 != ABI_libdl_GLIBC_2_1 +compat_symbol (libdl, __libdl_version_placeholder_1, + __libdl_version_placeholder, GLIBC_2_3_3); +#endif + #if SHLIB_COMPAT (libdl, GLIBC_2_3_4, GLIBC_2_34) \ && ABI_libdl_GLIBC_2_3_4 != ABI_libdl_GLIBC_2_1 compat_symbol (libdl, __libdl_version_placeholder_1, diff --git a/dlfcn/dlinfo.c b/dlfcn/dlinfo.c index 9fb2a1405c..15fcbc5dc1 100644 --- a/dlfcn/dlinfo.c +++ b/dlfcn/dlinfo.c @@ -20,18 +20,8 @@ #include #include #include - -#if !defined SHARED && IS_IN (libdl) - -int -dlinfo (void *handle, int request, void *arg) -{ - return __dlinfo (handle, request, arg); -} - -#else - -# include +#include +#include struct dlinfo_args { @@ -88,18 +78,33 @@ dlinfo_doit (void *argsblock) } } +static int +dlinfo_implementation (void *handle, int request, void *arg) +{ + struct dlinfo_args args = { handle, request, arg }; + return _dlerror_run (&dlinfo_doit, &args) ? -1 : 0; +} + +#ifdef SHARED int -__dlinfo (void *handle, int request, void *arg) +___dlinfo (void *handle, int request, void *arg) { -# ifdef SHARED if (!rtld_active ()) return _dlfcn_hook->dlinfo (handle, request, arg); -# endif - - struct dlinfo_args args = { handle, request, arg }; - return _dlerror_run (&dlinfo_doit, &args) ? -1 : 0; + else + return dlinfo_implementation (handle, request, arg); } -# ifdef SHARED -strong_alias (__dlinfo, dlinfo) +versioned_symbol (libc, ___dlinfo, dlinfo, GLIBC_2_34); + +# if OTHER_SHLIB_COMPAT (libdl, GLIBC_2_3_3, GLIBC_2_34) +compat_symbol (libc, ___dlinfo, dlinfo, GLIBC_2_3_3); # endif +#else /* !SHARED */ +/* Also used with _dlfcn_hook. */ +int +__dlinfo (void *handle, int request, void *arg) +{ + return dlinfo_implementation (handle, request, arg); +} +weak_alias (__dlinfo, dlinfo) #endif diff --git a/dlfcn/sdlinfo.c b/dlfcn/sdlinfo.c deleted file mode 100644 index dcc257dd1f..0000000000 --- a/dlfcn/sdlinfo.c +++ /dev/null @@ -1 +0,0 @@ -#include "dlinfo.c" -- cgit 1.4.1