Milan pointed me at some binaries to run.
First, I looked at just dl*() requests:
oxpoly1 634. LD_DEBUG=dl LD_DEBUG_OUTPUT=dbg FBReader -zlui gtk
.....
26471: 1:
26471: 1: file=0; dlopen() called from file=/usr/lib/mps/libnspr4.so [
RTLD_LAZY ]
26471: 1:
26471: 1: symbol=nspr_use_zone_allocator; dlsym() called from file=/usr/lib/mps/libnspr4.so;
starting at file=/usr/bin/FBReader
26471: 1:
26471: 1:
26471: 1: ld.so.1: FBReader: fatal: nspr_use_zone_allocator: can't find symbol
26471: 1:
26471: 1:
26471: 1: file=0; dlclose() called from file=/usr/lib/mps/libnspr4.so ignored
26471: 1:
26471: 1: file=0; dlopen() called from file=/usr/lib/mps/libnspr4.so [
RTLD_LAZY ]
26471: 1:
26471: 1:
26471: 1: transferring control: /usr/bin/FBReader
26471: 1:
26471: 1:
26471: 1: file=/usr/lib/zlibrary/ui/zlui-gtk.so; dlopen() called from
file=/usr/lib/libzlcore.so.0.13 [ RTLD_NOW ]
26471: 1:
26471: 1: symbol=initLibrary; dlsym() called from file=/usr/lib/libzlcore.so.0.13; starting at
file=/usr/lib/zlibrary/ui/zlui-gtk.so
26471: 1:
26471: 1: dlerror() called from file=/usr/lib/libzlcore.so.0.13: ld.so.1: FBReader: fatal:
nspr_use_zone_allocator: can't find symbol
So, the dlsym() error for nspr_use_zone_allocator occurred a long time back.
Since this "error" condition, we've loaded a bunch more files, transferred
control to the application (jumped to main) and seem to be in ZLibrary::init:
oxpoly1 642. mdb /usr/bin/FBReader
> :s
> ld.so.1`dlerror+8:b
> :r -zlui gtk
loading /usr/lib/zlibrary/ui/zlui-gtk.so
mdb: stop at ld.so.1`dlerror+8
....
> $c
ld.so.1`dlerror+8(fe511664, ff2afb40, ffbff91c, ff360dd8, fe541258, 1)
libzlcore.so.0.12.10`_ZN8ZLibrary4initERiRPPc+0x410(800, ffbff808, 800, ff2afb38
, ffbff838, abc)
main+0x10(3, ffbff93c, ffbff94c, 2238a4, 0, fea30200)
_start+0x5c(0, 0, 0, 0, 0, 0)
chaz 2011. dem _ZN8ZLibrary4initERiRPPc
_ZN8ZLibrary4initERiRPPc == ZLibrary::init(int&, char**&)
It seems that this function is calling dlerror(), which is returning:
DESCRIPTION
The dlerror() function returns a null-terminated character
string that describes the last error that occurred during
dynamic linking processing.
Note the *last error* part.
The question is why is ZLibrary::init calling dlerror()? I assume that
ZLibrary::init is discovering a non-NULL return, and then causing the
process to exit.
The last thing I see is ZLibrary::init is calling dlopen(zlui-gtk.so),
a very expensive operation, as it results in loading 42 more libraries
and relocating them fully, plus relocating a bunch of existing libraries
that are loaded, because of RTLD_NOW ... so much for lazy loading :-)
Then ZLibrary::init successfully obtains a symbol:
26493: 1: symbol=initLibrary; dlsym() called from file=/usr/lib/libzlcore.so.0.13; starting at
file=/usr/lib/zlibrary/ui/zlui-gtk.so
26493: 1: binding file=/usr/lib/libzlcore.so.0.13 to file=/usr/lib/zlibrary/ui/zlui-gtk.so: symbol
'initLibrary'
Then it calls dlerror():
26493: 1: dlerror() called from file=/usr/lib/libzlcore.so.0.13: ld.so.1: FBReader: fatal:
nspr_use_zone_allocator: can't find symbol
I can't find the code for this yet, but my speculation is that there's
something like:
sym = dlsym(handle-for-zlui-gtk.so, "initLibrary")
if ((str = dlerror()) != NULL)
fail();
where as things should be:
if ((sym = dlsym(handle-for-zlui-gtk.so, "initLibrary")) == NULL) {
printf("%s\n", dlerror());
fail();
Seems hard to believe, but I can't think of anything else right now.
--
Rod.
_______________________________________________
tools-linking mailing list
[email protected]