Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib Make the rumphijack dlsym trampoline call from rumpclien...



details:   https://anonhg.NetBSD.org/src/rev/75643a6468f5
branches:  trunk
changeset: 762621:75643a6468f5
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Feb 24 12:25:44 2011 +0000

description:
Make the rumphijack dlsym trampoline call from rumpclient a "real"
function call instead of a call through a function pointer.
Apparently powerpc ld.elf_so gets __hackish_return_address() wrong
if the call is done through a function pointer (digging deeper into
that stuff is beyond my interest).

Thanks to riz for providing access to a macppc for debugging.
Unthanks to the broken toolchain in the default installation which
wasted approximately 4 hours of time last night.

diffstat:

 lib/librumpclient/rumpclient.c |  21 +++++++++++++--------
 lib/librumphijack/hijack.c     |   6 ++----
 2 files changed, 15 insertions(+), 12 deletions(-)

diffs (77 lines):

diff -r f508535b2344 -r 75643a6468f5 lib/librumpclient/rumpclient.c
--- a/lib/librumpclient/rumpclient.c    Thu Feb 24 11:33:41 2011 +0000
+++ b/lib/librumpclient/rumpclient.c    Thu Feb 24 12:25:44 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rumpclient.c,v 1.34 2011/02/24 09:52:34 pooka Exp $   */
+/*      $NetBSD: rumpclient.c,v 1.35 2011/02/24 12:25:44 pooka Exp $   */
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -717,7 +717,16 @@
        return 0;
 }
 
-void *(*rumpclient_dlsym)(void *, const char *);
+void *rumpclient__dlsym(void *, const char *);
+void *rumphijack_dlsym(void *, const char *);
+void *
+rumpclient__dlsym(void *handle, const char *symbol)
+{
+
+       return dlsym(handle, symbol);
+}
+__weak_alias(rumphijack_dlsym,rumpclient__dlsym);
+
 static int init_done = 0;
 
 int
@@ -734,18 +743,14 @@
 
        sigfillset(&fullset);
 
-       /* dlsym overrided by rumphijack? */
-       if (!rumpclient_dlsym)
-               rumpclient_dlsym = dlsym;
-
        /*
         * sag mir, wo die symbol sind.  zogen fort, der krieg beginnt.
         * wann wird man je verstehen?  wann wird man je verstehen?
         */
 #define FINDSYM2(_name_,_syscall_)                                     \
-       if ((host_##_name_ = rumpclient_dlsym(RTLD_NEXT,                \
+       if ((host_##_name_ = rumphijack_dlsym(RTLD_NEXT,                \
            #_syscall_)) == NULL) {                                     \
-               if (rumpclient_dlsym == dlsym)                          \
+               if (rumphijack_dlsym == dlsym)                          \
                        host_##_name_ = _name_; /* static fallback */   \
                else                                                    \
                        errx(1, "cannot find %s: %s", #_syscall_,       \
diff -r f508535b2344 -r 75643a6468f5 lib/librumphijack/hijack.c
--- a/lib/librumphijack/hijack.c        Thu Feb 24 11:33:41 2011 +0000
+++ b/lib/librumphijack/hijack.c        Thu Feb 24 12:25:44 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: hijack.c,v 1.66 2011/02/23 15:44:38 pooka Exp $       */
+/*      $NetBSD: hijack.c,v 1.67 2011/02/24 12:25:44 pooka Exp $       */
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: hijack.c,v 1.66 2011/02/23 15:44:38 pooka Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.67 2011/02/24 12:25:44 pooka Exp $");
 
 #define __ssp_weak_name(fun) _hijack_ ## fun
 
@@ -429,10 +429,8 @@
 rcinit(void)
 {
        char buf[1024];
-       extern void *(*rumpclient_dlsym)(void *, const char *);
        unsigned i, j;
 
-       rumpclient_dlsym = rumphijack_dlsym;
        host_fork = dlsym(RTLD_NEXT, "fork");
        host_daemon = dlsym(RTLD_NEXT, "daemon");
        host_execve = dlsym(RTLD_NEXT, "execve");



Home | Main Index | Thread Index | Old Index