@@ -261,8 +261,8 @@ static struct dlfcn_hook _dlfcn_hooks =
{
.dlopen = __dlopen,
.dlclose = __dlclose,
- .dlsym = __dlsym,
- .dlvsym = __dlvsym,
+ .dlsym = __dlsym_internal,
+ .dlvsym = __dlvsym_internal,
.dlerror = __dlerror,
.dladdr = __dladdr,
.dladdr1 = __dladdr1,
@@ -64,6 +64,10 @@ extern int dlclose (void *__handle) __THROWNL __nonnull ((1));
extern void *dlsym (void *__restrict __handle,
const char *__restrict __name) __THROW __nonnull ((2));
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && defined (__REDIRECT)
+__LDBL_REDIR_DECL (dlsym);
+#endif
+
#ifdef __USE_GNU
/* Like `dlopen', but request object to be allocated in a new namespace. */
extern void *dlmopen (Lmid_t __nsid, const char *__file, int __mode) __THROWNL;
@@ -74,6 +78,11 @@ extern void *dlvsym (void *__restrict __handle,
const char *__restrict __name,
const char *__restrict __version)
__THROW __nonnull ((2, 3));
+
+#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && defined (__REDIRECT)
+__LDBL_REDIR_DECL (dlvsym);
+#endif
+
#endif
/* When any of the above functions fails, call this function
@@ -26,11 +26,20 @@
void *
dlsym (void *handle, const char *name)
{
- return __dlsym (handle, name, RETURN_ADDRESS (0));
+ return __dlsym_internal (handle, name, RETURN_ADDRESS (0));
}
#else
+# ifdef SHARED
+void *
+__dlsym (void *handle, const char *name)
+{
+ return __dlsym_internal (handle, name, RETURN_ADDRESS (0));
+}
+strong_alias (__dlsym, dlsym)
+# endif
+
struct dlsym_args
{
/* The arguments to dlsym_doit. */
@@ -52,15 +61,15 @@ dlsym_doit (void *a)
void *
-__dlsym (void *handle, const char *name DL_CALLER_DECL)
+__dlsym_internal (void *handle, const char *name, void *dl_caller)
{
# ifdef SHARED
if (!rtld_active ())
- return _dlfcn_hook->dlsym (handle, name, DL_CALLER);
+ return _dlfcn_hook->dlsym (handle, name, dl_caller);
# endif
struct dlsym_args args;
- args.who = DL_CALLER;
+ args.who = dl_caller;
args.handle = handle;
args.name = name;
@@ -73,7 +82,5 @@ __dlsym (void *handle, const char *name DL_CALLER_DECL)
return result;
}
-# ifdef SHARED
-strong_alias (__dlsym, dlsym)
-# endif
+
#endif
@@ -27,11 +27,20 @@ void *
weak_function
dlvsym (void *handle, const char *name, const char *version_str)
{
- return __dlvsym (handle, name, version_str, RETURN_ADDRESS (0));
+ return __dlvsym_internal (handle, name, version_str, RETURN_ADDRESS (0));
}
#else
+# ifdef SHARED
+void *
+__dlvsym (void *handle, const char *name, const char *version_str)
+{
+ return __dlvsym_internal (handle, name, version_str, RETURN_ADDRESS (0));
+}
+weak_alias (__dlvsym, dlvsym)
+# endif
+
struct dlvsym_args
{
/* The arguments to dlvsym_doit. */
@@ -54,18 +63,18 @@ dlvsym_doit (void *a)
}
void *
-__dlvsym (void *handle, const char *name, const char *version_str
- DL_CALLER_DECL)
+__dlvsym_internal (void *handle, const char *name, const char *version_str,
+ void *dl_caller)
{
# ifdef SHARED
if (!rtld_active ())
- return _dlfcn_hook->dlvsym (handle, name, version_str, DL_CALLER);
+ return _dlfcn_hook->dlvsym (handle, name, version_str, dl_caller);
# endif
struct dlvsym_args args;
args.handle = handle;
args.name = name;
- args.who = DL_CALLER;
+ args.who = dl_caller;
args.version = version_str;
/* Protect against concurrent loads and unloads. */
@@ -77,7 +86,4 @@ __dlvsym (void *handle, const char *name, const char *version_str
return result;
}
-# ifdef SHARED
-weak_alias (__dlvsym, dlvsym)
-# endif
#endif
@@ -131,10 +131,14 @@ extern void *__dlmopen (Lmid_t nsid, const char *file, int mode DL_CALLER_DECL)
attribute_hidden;
extern int __dlclose (void *handle)
attribute_hidden;
-extern void *__dlsym (void *handle, const char *name DL_CALLER_DECL)
+extern void *__dlsym (void *handle, const char *name)
attribute_hidden;
-extern void *__dlvsym (void *handle, const char *name, const char *version
- DL_CALLER_DECL)
+extern void *__dlsym_internal (void *handle, const char *name, void *dl_caller)
+ attribute_hidden;
+extern void *__dlvsym (void *handle, const char *name, const char *version)
+ attribute_hidden;
+extern void *__dlvsym_internal (void *handle, const char *name,
+ const char *version, void *dl_caller)
attribute_hidden;
extern char *__dlerror (void)
attribute_hidden;
@@ -344,3 +344,9 @@ obj-suf-foreach = $(foreach suf,$(all-object-suffixes),$(subst ^,$(suf),$(1)))
# Explicitly add -mabi=ibm-long-double to required files.
$(call obj-suf-foreach,$(ldbl-ibm128-files)): \
sysdep-CFLAGS += -mabi=ibmlongdouble
+
+ifeq ($(subdir),dlfcn)
+ libdl-routines += ieee128-dlfcn
+ CFLAGS-dlsym.c += -mabi=ibmlongdouble
+ CFLAGS-dlvsym.c += -mabi=ibmlongdouble
+endif
@@ -245,3 +245,10 @@ libc {
__qfcvtieee128_r;
}
}
+
+libdl {
+ LDBL_IBM128_VERSION {
+ __dlsymieee128;
+ __dlvsymieee128;
+ }
+}
new file mode 100644
@@ -0,0 +1,33 @@
+/* Look up a versioned symbol in a shared object loaded by `dlopen'
+ with name mangling for ieee128 redirects.
+
+ Copyright (C) 2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <dlfcn.h>
+
+void *
+__dlsymieee128 (void *handle, const char *name)
+{
+ return __dlsym_internal (handle, name, RETURN_ADDRESS (0));
+}
+
+void *
+__dlvsymieee128 (void *handle, const char *name, const char *version_str)
+{
+ return __dlvsym_internal (handle, name, version_str, RETURN_ADDRESS (0));
+}
@@ -7,3 +7,5 @@ GLIBC_2.17 dlmopen F
GLIBC_2.17 dlopen F
GLIBC_2.17 dlsym F
GLIBC_2.17 dlvsym F
+GLIBC_2.32 __dlsymieee128 F
+GLIBC_2.32 __dlvsymieee128 F