This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [greg@surety.com] libc/1593: dlopen maps multiple loads of different versions of the same object into the same memory space, or something


> Cc: greg@surety.com
> From: Andreas Jaeger <aj@suse.de>
> Date: 10 Feb 2000 19:56:55 +0100

> Hi glibc developers,
> 
> we've received the appended bug report.  What's wrong here?
> 
> The output of the testprogram is:
> 0x4001713c blown was: 0
> loaded ./libblow.so.1 at 0x8049ef0
> 0x4001713c blown was: 47806
> loaded d1/libblow.so.1 at 0x804a2c8
> 0x4001713c blown was: 0
> loaded d2/libblow.so.1 at 0x804a660
> 0x4001713c blown was: 47806
> 0x4001713c blown was: 27315
> 0x4001713c blown was: 47806

If you have a variable with external linkage, and you specify
RTLD_GLOBAL, it is shared between all copies of the library.  So it
will get constructed each time the library is opened.

The solution is to not give it external linkage, at least not outside
the library.  There are lots of ways to do this, from symbol
versioning to -Bdynamic to using 'static'.

-- 
- Geoffrey Keating <geoffk@cygnus.com>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]