Re: dlopen() without RTLD_GLOBAL

On Fri, May 03, 2002 at 01:33:33PM -0400, Dan Winship wrote:
> On Fri, 2002-05-03 at 09:05, Havoc Pennington wrote:
> > Tim Janik <timj gtk org> writes: 
> > > the demand to load modules with non-global symbols has popped up often
> > > enough to justify it's implementations though, but users (docs) need to
> > > be aware that G_MODULE_BIND_LOCAL (that's the flag name we should actually
> > > use) isn't correctly honoured on all systems.
> > 
> > Yep, that makes sense. I figured it was missing due to portability
> > issues, but I think it makes sense to avoid loading these symbols
> > globally on platforms where we can do that.
> In the case of gmodule, does it ever make sense to use RTLD_GLOBAL?

Few months ago I described the consequences of using RTLD_GLOBAL when loading
modules (also BUG #71615). Using RTLD_GLOBAL cause unpredictable program
behaviour on platforms where symbols are resolved by runtime loader at
start/loadtime or even later (lazy loading).

Systems which use symbolic linking as Windows, AIX (without -brtl) do not have
these problems because the symbols are bound at linktime. For these Systems one
can safely use RTLD_GLOBAL.

One can think of three possible solutions:
- do not use RTLD_GLOBAL when loading modules
- link modules so that all symbols are resolved and bound at link time
  (i.e. -Bsymbolic with GNU ld)
- leave only module's entry point public hiding all other symbols.
  It shluld have a distinct name.


Miroslaw Dobrzanski-Neumann

Base Development and Research
Tel +49-2225-882-291
Fax +49-2225-882-201
Office: mne mosaic-ag com
Home:   mirek-dn freenet de

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]