Fix partitioning ICE with external comdats

Message ID 20191217155854.pjzovhvqqfuiz7o5@kam.mff.cuni.cz
State New
Headers show
Series
  • Fix partitioning ICE with external comdats
Related show

Commit Message

Jan Hubicka Dec. 17, 2019, 3:58 p.m.
Hi,
while hacking firefox to work around ABI compatibility issues with LLVM
I ran into an ICE where comdat group was resolved externaly but contains
a static alias (for thunk). In this case parittioner attempts to put
that static definition into a partition which triggers an ICE.

Bootstrapped/regtested x86_64-linux, comitted.

	* symtab.c (symtab_node::get_partitioning_class): Aliases of external
	symbols are external.

Comments

Andreas Schwab Dec. 17, 2019, 4:04 p.m. | #1
On Dez 17 2019, Jan Hubicka wrote:

> Index: symtab.c

> ===================================================================

> --- symtab.c	(revision 279178)

> +++ symtab.c	(working copy)

> @@ -1952,6 +1952,11 @@ symtab_node::get_partitioning_class (voi

>    if (DECL_EXTERNAL (decl))

>      return SYMBOL_EXTERNAL;

>  

> +  /* Even static aliases of external functions as external.  Those can happen


s/as/are/

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

Patch

Index: symtab.c
===================================================================
--- symtab.c	(revision 279178)
+++ symtab.c	(working copy)
@@ -1952,6 +1952,11 @@  symtab_node::get_partitioning_class (voi
   if (DECL_EXTERNAL (decl))
     return SYMBOL_EXTERNAL;
 
+  /* Even static aliases of external functions as external.  Those can happen
+     when COMDAT got resolved to non-IL implementation.  */
+  if (alias && DECL_EXTERNAL (ultimate_alias_target ()->decl))
+    return SYMBOL_EXTERNAL;
+
   if (varpool_node *vnode = dyn_cast <varpool_node *> (this))
     {
       if (alias && definition && !ultimate_alias_target ()->definition)