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 ....
This commit is contained in:
pooka 2011-02-25 16:01:41 +00:00
parent 9e33d7d6e2
commit da73d5bcb9
2 changed files with 20 additions and 10 deletions

View File

@ -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 @@ CPPFLAGS+= -D_DIAGNOSTIC -D_REENTRANT
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>

View File

@ -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 @@ __RCSID("$NetBSD: hijackdlsym.c,v 1.1 2011/02/23 15:23:15 pooka Exp $");
* 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)
*/
void *
rumphijack_dlsym(void *handle, const char *symbol)
/* 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 bouncer(handle, symbol);
}