RFC: PATCH to use gnu_unique_object for non-artificial DECL_ONCE_ONLY data (the plugin problem, 2/2)

Jason Merrill jason@redhat.com
Thu Jul 23 00:39:00 GMT 2009


Repeated from the previous patch:

> For a while now some uses of C++ plugins (shared objects loaded with RTLD_LOCAL) have been broken because of symbol resolution rules: if you have two plugins that link against a common library, when the first one is loaded any vague linkage symbols in both the plugin and the library are resolved to the definition in the plugin, and then when the second plugin is loaded any references there are resolved to its own definitions, so any code that relies on vague linkage symbols being shared between the library and the second plugin breaks.  This applies to typeinfo comparison (including in EH), and any vague linkage objects such as template static data members and inline function local statics.

This patch solves the problem for template static data members and 
inline function local statics by using a new relocation type that has 
just been added to GAS: basically, this new relocation type causes 
affected symbols to ignore RTLD_LOCAL, so that both plugins will refer 
to the definition in the first one.

I was starting to ask for approval of this patch, but it occurs to me 
now that this functionality depends on ld.so support as well as 
assembler support, so I'll need to figure out a way to test that too.

Any comments on the patch as it is?

Jason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unique-object.patch
Type: text/x-patch
Size: 5695 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090723/f6794b8c/attachment.bin>


More information about the Gcc-patches mailing list