Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so Unbreak RTLD_NEXT and co on platforms that...
details: https://anonhg.NetBSD.org/src/rev/1a81a9d1d77c
branches: trunk
changeset: 771590:1a81a9d1d77c
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Nov 25 21:27:15 2011 +0000
description:
Unbreak RTLD_NEXT and co on platforms that don't inline or tail call
do_dlsym.
diffstat:
libexec/ld.elf_so/rtld.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diffs (85 lines):
diff -r c46ba33a4cd2 -r 1a81a9d1d77c libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c Fri Nov 25 17:54:15 2011 +0000
+++ b/libexec/ld.elf_so/rtld.c Fri Nov 25 21:27:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld.c,v 1.154 2011/11/17 16:20:11 joerg Exp $ */
+/* $NetBSD: rtld.c,v 1.155 2011/11/25 21:27:15 joerg Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.154 2011/11/17 16:20:11 joerg Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.155 2011/11/25 21:27:15 joerg Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -1047,13 +1047,12 @@
#endif
static void *
-do_dlsym(void *handle, const char *name, const Ver_Entry *ventry)
+do_dlsym(void *handle, const char *name, const Ver_Entry *ventry, void *retaddr)
{
const Obj_Entry *obj;
unsigned long hash;
const Elf_Sym *def;
const Obj_Entry *defobj;
- void *retaddr;
DoneList donelist;
const u_int flags = SYMLOOK_DLSYM | SYMLOOK_IN_PLT;
#ifdef __HAVE_FUNCTION_DESCRIPTORS
@@ -1071,11 +1070,6 @@
case (intptr_t)RTLD_NEXT:
case (intptr_t)RTLD_DEFAULT:
case (intptr_t)RTLD_SELF:
-#ifdef __powerpc__
- retaddr = hackish_return_address();
-#else
- retaddr = __builtin_return_address(0);
-#endif
if ((obj = _rtld_obj_from_addr(retaddr)) == NULL) {
_rtld_error("Cannot determine caller's shared object");
lookup_mutex_exit();
@@ -1165,10 +1159,16 @@
void *
dlsym(void *handle, const char *name)
{
+ void *retaddr;
dbg(("dlsym of %s in %p", name, handle));
- return do_dlsym(handle, name, NULL);
+#ifdef __powerpc__
+ retaddr = hackish_return_address();
+#else
+ retaddr = __builtin_return_address(0);
+#endif
+ return do_dlsym(handle, name, NULL, retaddr);
}
__strong_alias(__dlvsym,dlvsym)
@@ -1177,6 +1177,7 @@
{
Ver_Entry *ventry = NULL;
Ver_Entry ver_entry;
+ void *retaddr;
dbg(("dlvsym of %s@%s in %p", name, version ? version : NULL, handle));
@@ -1187,7 +1188,12 @@
ver_entry.flags = 0;
ventry = &ver_entry;
}
- return do_dlsym(handle, name, ventry);
+#ifdef __powerpc__
+ retaddr = hackish_return_address();
+#else
+ retaddr = __builtin_return_address(0);
+#endif
+ return do_dlsym(handle, name, ventry, retaddr);
}
__strong_alias(__dladdr,dladdr)
Home |
Main Index |
Thread Index |
Old Index