Source-Changes-HG archive

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

[src/trunk]: src/lib/librumphijack Ok, for reasons I can't begin to understan...



details:   https://anonhg.NetBSD.org/src/rev/8f50210cbb95
branches:  trunk
changeset: 762682:8f50210cbb95
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Feb 25 16:01:41 2011 +0000

description:
Ok, for reasons I can't begin to understand, the binaries I tested
yesterday on powerpc broke overnight.  Apparently adding one more
function before the call to dlsym() fixes things again.  I hope
I don't have to add another one tomorrow ....

diffstat:

 lib/librumphijack/Makefile      |   8 ++++----
 lib/librumphijack/hijackdlsym.c |  20 +++++++++++++++-----
 2 files changed, 19 insertions(+), 9 deletions(-)

diffs (65 lines):

diff -r 1c50e2c16ed2 -r 8f50210cbb95 lib/librumphijack/Makefile
--- a/lib/librumphijack/Makefile        Fri Feb 25 15:12:06 2011 +0000
+++ b/lib/librumphijack/Makefile        Fri Feb 25 16:01:41 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.7 2011/02/23 15:23:15 pooka Exp $
+#      $NetBSD: Makefile,v 1.8 2011/02/25 16:01:41 pooka Exp $
 #
 
 LIB=           rumphijack
@@ -14,8 +14,8 @@
 
 WARNS=         4
 
-#DBG=-g
-#NOGCCERROR=1
-COPTS.hijackdlsym.c+=  -fno-optimize-sibling-calls
+# make sure the compiler doesn't get clever, since we need
+# a stack frame
+COPTS.hijackdlsym.c+=  -O0
 
 .include <bsd.lib.mk>
diff -r 1c50e2c16ed2 -r 8f50210cbb95 lib/librumphijack/hijackdlsym.c
--- a/lib/librumphijack/hijackdlsym.c   Fri Feb 25 15:12:06 2011 +0000
+++ b/lib/librumphijack/hijackdlsym.c   Fri Feb 25 16:01:41 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: hijackdlsym.c,v 1.1 2011/02/23 15:23:15 pooka Exp $   */
+/*      $NetBSD: hijackdlsym.c,v 1.2 2011/02/25 16:01:41 pooka Exp $   */
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: hijackdlsym.c,v 1.1 2011/02/23 15:23:15 pooka Exp $");
+__RCSID("$NetBSD: hijackdlsym.c,v 1.2 2011/02/25 16:01:41 pooka Exp $");
 
 #include <dlfcn.h>
 
@@ -36,12 +36,22 @@
  * This is called from librumpclient in case of LD_PRELOAD.
  * It ensures correct RTLD_NEXT.
  *
- * (note, this module is compiled with -fno-optimize-sibling-calls
- * to make sure this function is not treated as a tailcall)
+ * (note, this module is compiled with -O0 to make sure this
+ * function is not treated as a tailcall or other optimizations
+ * applied)
  */
+
+/* why is this indirection required for powerpc ???? */
+static void * __noinline
+bouncer(void *handle, const char *symbol)
+{
+
+       return dlsym(handle, symbol);
+}
+
 void *
 rumphijack_dlsym(void *handle, const char *symbol)
 {
 
-       return dlsym(handle, symbol);
+       return bouncer(handle, symbol);
 }



Home | Main Index | Thread Index | Old Index