https://sourceware.org/bugzilla/show_bug.cgi?id=23309
--- Comment #2 from zenith432 at users dot sourceforge.net --- So here's what's going... In ld/plugin.c (ld.bfd)... the following code in get_symbols_v2 ===== if (res == LDPR_PREVAILING_DEF_IRONLY) { /* We need to know if the sym is referenced from non-IR files. Or even potentially-referenced, perhaps in a future final link if this is a partial one, perhaps dynamically at load-time if the symbol is externally visible. */ if (blhe->non_ir_ref_regular) res = LDPR_PREVAILING_DEF; else if (is_visible_from_outside (&syms[n], blhe)) res = def_ironly_exp; } ===== For symbol 'main', no_ir_ref_regular is true, so it sets resolution of LDPR_PREVAILING_DEF and the symbol is handled correctly. For symbol 'KeepMe', no_ir_ref_regular is false, and it calls is_visible_from_outside(), which return true because KeepMe is in the list of entry points. The makes it set a resolution of LDPR_PREVAILING_DEF_IRONLY_EXP (the value of def_ironly_exp) - which is what cases KeepMe to be incorrectly converted from "global hidden" to "local". And in gold? ===== { if (is_referenced_from_outside(lsym)) res = LDPR_PREVAILING_DEF; else if (is_visible_from_outside(lsym)) res = ldpr_prevailing_def_ironly_exp; else res = LDPR_PREVAILING_DEF_IRONLY; } ===== is in function Pluginobj::get_symbol_resolution_info. The function is_referenced_from_outside returns true for both "main", and "KeepMe", which sets a resolution of LDPR_PREVAILING_DEF for both of them getting them to be handled correctly. In is_referenced_from_outside, lsym->in_real_elf returns true for "main" and parameters->options().is_undefined(lsym->name()) returns true for "KeepMe". To resolve this, the logic in ld.bfd needs to be changed so that both symbols end up with a resolution of LDPR_PREVAILING_DEF. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils