This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold patch] Add --no-gnu-unique option to disable STB_GNU_UNIQUE
- From: Ian Lance Taylor <iant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Mon, 31 Oct 2011 14:27:45 -0700
- Subject: Re: [gold patch] Add --no-gnu-unique option to disable STB_GNU_UNIQUE
- References: <CAHACq4p-mOuFWWPHWyV+v1it3zrxXUKHpo3QSeXsk+o51YDPLw@mail.gmail.com>
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