[gold patch] Add --no-gnu-unique option to disable STB_GNU_UNIQUE

Ian Lance Taylor iant@google.com
Mon Oct 31 21:28:00 GMT 2011


Cary Coutant <ccoutant@google.com> writes:

> 	* options.h (class General_options): Add --[no-]gnu-unique options.
> 	* symtab.cc (Symbol_table::sized_write_globals): Convert
> 	STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.

This is OK.

Thanks.

It seems that GNU ld should consider picking up this option as well.
The basic problem is that it is ambiguous at dlopen time whether a given
global symbol should be unique or not.  If you want to dlopen a library
to live in its own private world, using RTLD_LOCAL, then symbols should
be unique within that private world, not unique across the whole
program.  Unfortunately there is no way to specify that, and the glibc
dynamic linker currently treats STB_GNU_UNIQUE symbols as unique across
the entire link.  I suspect that the correct fix is going to be to add
another flag to dlopen.

Ian



More information about the Binutils mailing list