A patch for static executable and dlopen
H.J. Lu
hjl@lucon.org
Sat May 2 16:51:00 GMT 1998
>
> On Thu, 30 Apr 1998, H.J. Lu wrote:
>
> > This patch seems to fix the dlopen/dlclose from the static executable
> > bug.
>
> Is this patch needed for 2.0.7 ?
>
It is needed for both 2.1 and 2.0.7. Here is a new revised patch. I
think it is correct.
Thanks.
--
H.J. Lu (hjl@gnu.org)
---
Sat May 2 16:21:03 1998 H.J. Lu <hjl@gnu.org>
* elf/dl-open.c (_dl_open): Increment the open count if the
shared object is put at the first place on the global scope
list.
Don't put the shared object on the global scope list twice.
Index: dl-open.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/elf/dl-open.c,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 dl-open.c
--- dl-open.c 1998/04/04 16:27:09 1.1.1.9
+++ dl-open.c 1998/05/02 23:06:02
@@ -112,7 +112,14 @@
}
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
More information about the Libc-hacker
mailing list