John Polstra ([EMAIL PROTECTED]) wrote:
> In article <[EMAIL PROTECTED]>,
> Russell L. Carter <[EMAIL PROTECTED]> wrote:
> >
> > On a fairly recent -STABLE I am getting this failure:
> >
> > ld-elf.so.1: assert failed: /usr/src/libexec/rtld-elf/rtld.c:2033
> >
> > I assume I'm doing something stupid, however the same code
> > works on Linux gcc-2.95.2, so I'm looking for what the
> > difference might be.
> >
> > The program is an ACE/TAO C++ program that dlsym()s an object,
> > uses it happily, and then gets the assertion when dlclose()ing
> > from the containing object's dtor.
> >
> > The assertion is that the refcount != 0. What should I
> > do to fix that?
>
> There is a bug in the dynamic linker in connection with calling dlopen
> or dlclose from a static constructor or destructor, and this sounds
> like it's related to that. I came up with a fix for it which Peter
> Wemm was testing at Yahoo. That was a few months ago, and I'll have
> to dig it out again after the holiday madness has subsided. If you
> haven't heard from me by Saturday Jan. 6, I'd appreciate a gentle
> reminder to <[EMAIL PROTECTED]>.
Do you mean this patch?
--- rtld.c 2000/08/01 07:17:54 1.1.1.3
+++ rtld.c 2000/09/05 22:16:49 1.2
@@ -694,7 +694,7 @@
if (obj == (Obj_Entry *) handle)
break;
- if (obj == NULL || obj->dl_refcount == 0) {
+ if (obj == NULL || obj->refcount == 0 || obj->dl_refcount == 0) {
_rtld_error("Invalid shared object handle %p", handle);
return NULL;
}
@@ -1994,6 +1994,8 @@
{
const Needed_Entry *needed;
+ if (root->refcount == 0)
+ return;
assert(root->refcount != 0);
root->refcount--;
if (root->refcount == 0)
--
Paul Saab
Technical Yahoo
[EMAIL PROTECTED] - [EMAIL PROTECTED] - [EMAIL PROTECTED]
Do You .. uhh .. Yahoo!?
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message