This is the mail archive of the
mailing list for the GCC project.
Re: Duplicate data objects in shared libraries
On Mon, May 20, 2002 at 08:57:35PM +0100, Jason Merrill wrote:
> >>>>> "H" == H J Lu <firstname.lastname@example.org> writes:
> > On Mon, May 20, 2002 at 05:12:19PM +0100, Jason Merrill wrote:
> >> Interestingly, loading C.so first as RTLD_LOCAL causes both A.so and B.so
> >> to resolve to different addresses from C.so on Linux, but on Solaris it
> >> produces the desired result.
> > It seems like a Linux bug. I will look into it if no one else does.
> >> #4 as written above could have the effect of causing B.so to refer to
> >> a definition in A.so, which would be problematic if we try to unload A.so.
> >> Perhaps the right approach is
> >> 5) Do not allow an object loaded with RTLD_LOCAL to override symbols from a
> >> dependency.
> >> This rule is easily stated; it would cause both A.so and B.so to refer to
> >> the definition in C.so, regardless of the order of loading. I like it.
> > If you were saying:
> > 1. Load C.so with RTLD_LOCAL.
> > 2. Load A.so with RTLD_LOCAL.
> > 3. Load B.so with RTLD_LOCAL.
> > both A.so and B.so should resolve to C.so, I think it makes sense.
> Yes, that is what I was saying. A possible refinement would be
I took a look. When I move C.so in front of A.so in the scope of A.so
if C.so is on the DT_NEEDED list of A.so and is loaded in memory
already, this will work. However, there are a few testcases in
glibc which assume otherwise. I can't make both to work at the same
time. Does anyone have some ideas?