This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug dynamic-link/16805] dynamic library not getting reinitialized on multiple calls to dlopen()
- From: "jason at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 13 Jun 2014 16:38:14 +0000
- Subject: [Bug dynamic-link/16805] dynamic library not getting reinitialized on multiple calls to dlopen()
- Auto-submitted: auto-generated
- References: <bug-16805-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=16805
Jason Merrill <jason at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at redhat dot com
--- Comment #4 from Jason Merrill <jason at redhat dot com> ---
(In reply to Dave Johansen from comment #2)
> From reading the comments on the gcc bugzilla and revision history of this
> change, it appears that it was made as an optimization to improve
> performance.
It's not an optimization, it's necessary for correctness in the situation where
you have
plugin A
weak foo
plugin B
weak foo
library C
weak foo
and plugins A and B depend on library C. When the program loads A with
RTLD_LOCAL, references to foo in A and C bind to the definition in A. When the
program then loads B, references to foo in B bind to the definition in B, but
references to foo in C are still bound to the definition in A. So if foo is a
variable, B and C are looking at different copies, leading to chaos.
Marking foo as STB_GNU_UNIQUE fixes this by making references in B resolve to
the definition in A.
I had suggested (in
https://www.sourceware.org/ml/libc-alpha/2002-05/msg00222.html) that references
in A and B should bind to the definition in C instead, but Ulrich rejected that
idea.
--
You are receiving this mail because:
You are on the CC list for the bug.