Module Name:    src
Committed By:   pooka
Date:           Thu Feb 24 12:25:45 UTC 2011

Modified Files:
        src/lib/librumpclient: rumpclient.c
        src/lib/librumphijack: hijack.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/librumpclient/rumpclient.c
cvs rdiff -u -r1.66 -r1.67 src/lib/librumphijack/hijack.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumpclient/rumpclient.c
diff -u src/lib/librumpclient/rumpclient.c:1.34 src/lib/librumpclient/rumpclient.c:1.35
--- src/lib/librumpclient/rumpclient.c:1.34	Thu Feb 24 09:52:34 2011
+++ src/lib/librumpclient/rumpclient.c	Thu Feb 24 12:25:44 2011
@@ -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_,	\

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.66 src/lib/librumphijack/hijack.c:1.67
--- src/lib/librumphijack/hijack.c:1.66	Wed Feb 23 15:44:38 2011
+++ src/lib/librumphijack/hijack.c	Thu Feb 24 12:25:44 2011
@@ -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");

Reply via email to