How should STB_GNU_UNIQUE binding interact with RTLD_LOCAL ?

Paul Pluzhnikov ppluzhnikov@google.com
Tue Oct 25 23:30:00 GMT 2011


Greetings,

We've just switched to gcc-4.6 toolchain, and discovered an obscure set
of bugs, which are triggered by STB_GNU_UNIQUE symbols.

Effectively, STB_GNU_UNIQUE symbols always get installed in the global
scope, even when a library is loaded via dlopen(..., RTLD_LOCAL), making
it impossible to load two separate libraries sharing the same STB_GNU_UNIQUE
symbols and have them not interfere with each other.

That behavior appears counter-intuitive and contradicts the description
of RTLD_LOCAL:

   This is the converse of RTLD_GLOBAL, and the default if neither flag
   is specified.  Symbols defined in this library are not made available
   to resolve references in subsequently loaded libraries.

Is this really how it is supposed to work, or should RTLD_LOCAL "override"
STB_GNU_UNIQUE and keep them local?

Thanks,
-- 
Paul Pluzhnikov



More information about the Libc-alpha mailing list