http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46319
--- Comment #9 from Dave Korn <davek at gcc dot gnu.org> 2010-11-08 06:27:25 UTC --- (In reply to comment #8) > This appears to be because plugin_init in selfassign.c isn't marked with > __attribute__((externally_visible)), and the resolution file marks it as > PREVAILING_DEF_IRONLY. > It works with GOLD because GOLD thinks the plugin's external symbols are > PREVAILING_DEF, not PREVAILING_DEF_IRONLY. Thanks to Ian T, I now have an understanding of why GOLD does this: it is because if the ELF symbol visibility is STV_DEFAULT or STV_PROTECTED, GOLD assumes it may be externally referenced, perhaps dynamically at runtime, so doesn't resolve it _IRONLY. I'll need to adjust GNU LD to match this behaviour. (Can't work around it just by tagging __attribute__((externally_visible)) onto the definition of plugin_init in selfassign.c, because cc1 has been lto-bootstrapped, and all the symbols that the plugin wants to reference have been made static for the same reason - they are seen as IRONLY - so the plugin can't resolve them and dlopen'ing it fails.)