aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto/lto-symtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/lto/lto-symtab.c')
-rw-r--r--gcc/lto/lto-symtab.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index 10c3fbe49f3..01cc0b7602e 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -465,9 +465,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))
@@ -571,6 +576,9 @@ lto_symtab_merge_p (tree prevailing, tree decl)
return false;
}
}
+
+ /* FIXME: after MPX is removed, use flags_from_decl_or_type
+ function instead. PR lto/85248. */
if (DECL_ATTRIBUTES (prevailing) != DECL_ATTRIBUTES (decl))
{
tree prev_attr = lookup_attribute ("error", DECL_ATTRIBUTES (prevailing));
@@ -598,6 +606,16 @@ lto_symtab_merge_p (tree prevailing, tree decl)
"warning attribute mismatch\n");
return false;
}
+
+ prev_attr = lookup_attribute ("noreturn", DECL_ATTRIBUTES (prevailing));
+ attr = lookup_attribute ("noreturn", DECL_ATTRIBUTES (decl));
+ if ((prev_attr == NULL) != (attr == NULL))
+ {
+ if (symtab->dump_file)
+ fprintf (symtab->dump_file, "Not merging decls; "
+ "noreturn attribute mismatch\n");
+ return false;
+ }
}
return true;
}