Do not bail out for multiple PREVAILING_DEF_IRONLY for common symbols.

Message ID bd811211-ce38-dab2-5261-010afb5f2830@suse.cz
State New
Headers show
Series
  • Do not bail out for multiple PREVAILING_DEF_IRONLY for common symbols.
Related show

Commit Message

Martin Liška April 19, 2018, 8:40 a.m.
Hi.

This patch handles the lto-wrapper failure seen on multiple packages in
openSUSE OBS w/ -flto. It's explained here in more details:
https://sourceware.org/bugzilla/show_bug.cgi?id=23079

The patch is approved by Honza, I'm going to install it.

Martin

gcc/lto/ChangeLog:

2018-04-19  Martin Liska  <mliska@suse.cz>

	* lto-symtab.c (lto_symtab_resolve_symbols): Do not bail out
	for multiple PREVAILING_DEF_IRONLY for common symbols.
---
 gcc/lto/lto-symtab.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch

diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index 2660542300e..3663ab7a9b2 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -466,9 +466,14 @@  lto_symtab_resolve_symbols (symtab_node *first)
   /* If the chain is already resolved there is nothing else to do.  */
   if (prevailing)
     {
-      /* Assert it's the only one.  */
+      /* Assert it's the only one.
+	 GCC should silence multiple PREVAILING_DEF_IRONLY defs error
+	 on COMMON symbols since it isn't error.
+	 See: https://sourceware.org/bugzilla/show_bug.cgi?id=23079.  */
       for (e = prevailing->next_sharing_asm_name; e; e = e->next_sharing_asm_name)
 	if (lto_symtab_symbol_p (e)
+	    && !DECL_COMMON (prevailing->decl)
+	    && !DECL_COMMON (e->decl)
 	    && (e->resolution == LDPR_PREVAILING_DEF_IRONLY
 		|| e->resolution == LDPR_PREVAILING_DEF_IRONLY_EXP
 		|| e->resolution == LDPR_PREVAILING_DEF))