This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: An old dl patch
- To: drepper@cygnus.com (Ulrich Drepper)
- Subject: Re: An old dl patch
- From: hjl@lucon.org (H.J. Lu)
- Date: Wed, 2 Sep 1998 12:00:20 -0700 (PDT)
- Cc: libc-hacker@cygnus.com (GNU C Library)
>
> hjl@lucon.org (H.J. Lu) writes:
>
> > --- dl-open.c 1998/03/31 16:18:44 1.1.1.5
> > +++ dl-open.c 1998/08/05 14:11:41
> > @@ -91,7 +91,14 @@ _dl_open (const char *file, int mode)
> > }
> >
> > new->l_global = (mode & RTLD_GLOBAL) ? 1 : 0;
> > - if (new->l_global)
> > +
> > + if (_dl_loaded == new)
> > + /* We are put at the first place on the global scope list, one way
> > + or the other. We may be used by other shared objects. We have to
> > + make sure that it stays in memory for them. Increment the open
> > + count. */
> > + new->l_opencount++;
> > + else if (new->l_global)
> > {
> > /* The symbols of the new object and its dependencies are to be
> > introduced into the global scope that will be used to resolve
>
> This patch cannot be correct. You simply ignore the the RTLD_GLOBAL
> flag and why modifying l_opencount? This can only be a hack to work
> around a certain bug.
>
How about this patch? Otherwise, NEW will be put on the global
scope list twice.
H.J.
---
Index: dl-open.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc-2.0/elf/dl-open.c,v
retrieving revision 1.1.1.6
diff -u -p -r1.1.1.6 dl-open.c
--- dl-open.c 1998/08/30 14:59:02 1.1.1.6
+++ dl-open.c 1998/09/02 18:58:03
@@ -110,11 +110,22 @@ _dl_open (const char *file, int mode)
_dl_close (new);
_dl_signal_error (ENOMEM, file, "cannot extend global scope");
}
- _dl_global_scope[2] = _dl_default_scope[2];
- _dl_global_scope[3] = new;
- _dl_global_scope[4] = NULL;
- _dl_global_scope[5] = NULL;
- _dl_global_scope_end = &_dl_global_scope [4];
+
+ if (_dl_default_scope [2] == new)
+ {
+ _dl_global_scope[2] = new;
+ _dl_global_scope[3] = NULL;
+ _dl_global_scope[4] = NULL;
+ _dl_global_scope_end = &_dl_global_scope [3];
+ }
+ else
+ {
+ _dl_global_scope[2] = _dl_default_scope[2];
+ _dl_global_scope[3] = new;
+ _dl_global_scope[4] = NULL;
+ _dl_global_scope[5] = NULL;
+ _dl_global_scope_end = &_dl_global_scope [4];
+ }
}
else
{