Source-Changes-D archive

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

re: CVS commit: src/lib/librumphijack



> > cvs rdiff -u -r1.7 -r1.8 src/lib/librumphijack/Makefile
> > cvs rdiff -u -r1.1 -r1.2 src/lib/librumphijack/hijackdlsym.c
> 
> I think this is caused by revision 1.121 of rtld.c (hi, mac!) that
> added "hackish_return_address" for ppc.
> 
> #ifdef __powerpc__
> static void *
> hackish_return_address(void)
> {
>         return __builtin_return_address(1);
> }
> #endif
> 
> void *
> dlsym(void *handle, const char *name)
> {
>         ...
> #ifdef __powerpc__
>                 retaddr = hackish_return_address();
> #else
>                 retaddr = __builtin_return_address(0);
> #endif
>         ...
> }
> 
> 
> hackish_return_address will be inlined (simple static function) and,
> as far as I can tell, gcc does NOT adjust the "level" argument to
> __builtin_return_address.
> 
> The net effect is that dlsym uses caller's caller address to detect
> which module the call comes from, and if caller's caller is in a
> different module wrong things happen.
> 
> That explains why you need an extra frame.

ugh!

mac, what wasn't working that prompted you to do the above?
one hack to make it work would be to apply the noinline
gcc attribute....


.mrg.


Home | Main Index | Thread Index | Old Index