diff mbox

LTO: Error out for missing function body

Message ID 20100715131241.GA32039@basil.fritz.box
State New
Headers show

Commit Message

Andi Kleen July 15, 2010, 1:12 p.m. UTC
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  <ak@linux.intel.com>

	* lto-symtab (lto_symtab_resolve_symbols): Error out for missing
	function body with a prevailing IR definition.

Comments

Richard Biener July 15, 2010, 3:52 p.m. UTC | #1
On Thu, Jul 15, 2010 at 3:12 PM, Andi Kleen <andi@firstfloor.org> wrote:
> 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.

If this bootstraps & tests ok it is ok with ...

> 2010-07-15  Andi Kleen  <ak@linux.intel.com>
>
>        * 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)

the && moved to the next line according to coding conventions and
the same diagnostic for LDPR_PREVAILING_DEF added.

Thanks,
Richard.


> +           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);
>
diff mbox

Patch

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);