http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54709
--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-26 13:47:02 UTC --- Index: gcc/lto-symtab.c =================================================================== --- gcc/lto-symtab.c (revision 191756) +++ gcc/lto-symtab.c (working copy) @@ -326,11 +326,7 @@ lto_symtab_resolve_symbols (symtab_node for (e = first; e; e = e->symbol.next_sharing_asm_name) { if (!lto_symtab_resolve_can_prevail_p (e)) - { - e->symbol.resolution = LDPR_RESOLVED_IR; - set_resolution_guessed (e, true); - continue; - } + continue; /* Set a default resolution - the final prevailing one will get adjusted later. */ @@ -387,9 +383,25 @@ lto_symtab_resolve_symbols (symtab_node } if (!prevailing) - return; + { + /* There was no prevailing definition - adjust the symbol resolutions + according to that. */ + for (e = first; e; e = e->symbol.next_sharing_asm_name) + e->symbol.resolution = LDPR_UNDEF; + return; + } found: + /* We found a prevailing definition - adjust the pre-empted symbols + resolutions. */ + for (e = first; e; e = e->symbol.next_sharing_asm_name) + { + if (!lto_symtab_resolve_can_prevail_p (e)) + { + e->symbol.resolution = LDPR_RESOLVED_IR; + set_resolution_guessed (e, true); + } + } /* If current lto files represent the whole program, it is correct to use LDPR_PREVALING_DEF_IRONLY. If current lto files are part of whole program, internal fixes the testcase for me.