From patchwork Thu Jul 15 13:12:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: LTO: Error out for missing function body Date: Thu, 15 Jul 2010 03:12:42 -0000 From: Andi Kleen X-Patchwork-Id: 58981 Message-Id: <20100715131241.GA32039@basil.fritz.box> To: gcc-patches@gcc.gnu.org LTO: Error out for missing function body When the linker is confused in WHOPR mode and passes incorrect resolution files lto1 could eventually crash when it sees a PREVAILING_DEF_IRONLY with missing body. Error out early when this happens and print the function name. 2010-07-15 Andi Kleen * lto-symtab (lto_symtab_resolve_symbols): Error out for missing function body with a prevailing IR definition. diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 6eaf22c..864587f 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -492,7 +492,13 @@ lto_symtab_resolve_symbols (void **slot) for (e = (lto_symtab_entry_t) *slot; e; e = e->next) { if (TREE_CODE (e->decl) == FUNCTION_DECL) - e->node = cgraph_get_node_or_alias (e->decl); + { + e->node = cgraph_get_node_or_alias (e->decl); + if (e->resolution == LDPR_PREVAILING_DEF_IRONLY && + e->node == NULL) + fatal_error ("prevailing def ironly function decl node without body %qE", + e->decl); + } else if (TREE_CODE (e->decl) == VAR_DECL) { e->vnode = varpool_get_node (e->decl);