fairly low level - ld-elf.so.1/rtld_verify_versions() question

Jim stapleton.41 at gmail.com
Tue Aug 26 16:01:23 UTC 2008

I have a library that is failing to load. Eventually I managed to play
with ld-elf so I could figure out what was wrong (jail -> build the
ld-elf in the jail with some printfs)

Anyway, I have a lot of test cases that seem to compile/load fine, but
one compiles fine but always fails to load, I found /why/ it fails,
but I don't know what in my library would cause the issues.

It looks like a versioning failure for libc.so.7:
        libc.so.7 => /lib/libc.so.7 (0x2807e000)

What would cause this, but not cause failures on other libraries I've
built on the same system?
* Between successes and failures I have not rebuilt anything other
than the successful and failing libraries.

-Jim Stapleton

In case it might be useful, below I have an output from my modified
ld-elf, Anything starting with ">>>" comes from the
"rtld_verify_versions" function, anything starting with ">>" comes
from the "dlopen" function. Anything starting with "##" is a comment
or interperetation I added after the fact.

#dlopen, prints name and mode arguments
>>Opening: 'libctypeless.so' : 513
#prints name and pointer to main passed to load_object if name is not null
>> Name not null, calling: load_object("libctypeless.so", 0x28078000 /*main*/)
#prints the pointer returned for obj
>> Found: 0x28078400
#tells the refcount on obj, immediately after the increment
>> opened, refcount inc'ed: 1
#this is the first thing done after the initial STAILQ_FOREACH(entry,
objlist, link) {
#in the function, the line printing it is:
# printf(">>> Checking version: %p (%p) --> \"%s\"\n", entry,
entry->obj, entry->obj->path);
>>> Checking version: 0x28079080 (0x28078400) --> "/usr/lib/libctypeless.so"
>>> Checking version: 0x280790a0 (0x28078600) --> "/lib/libgcc_s.so.1"
>>> Checking version: 0x280790c0 (0x28078200) --> "/lib/libc.so.7"
#these next two are printed by
#printf(">>> [shouldn't be null] strtab: \"%s\"\n", entry->obj->strtab);
#printf(">>> [should be null] vertab: ");
#printf("%p: %d / %d / \"%s\" / \"%s\" \n", entry->obj->vertab,
#        entry->obj->vertab->hash,entry->obj->vertab->flags,
#        entry->obj->vertab->name,entry->obj->vertab->file);
>>> [shouldn't be null] strtab: ""
>>> [should be null] vertab: 0x2807a080: 0 / 0 / "(null)" / "(null)"
>> versioning failure of dagmembers: 0,
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2818e000)
        libc.so.7 => /lib/libc.so.7 (0x2807e000)

More information about the freebsd-questions mailing list