re PR lto/46940 (asm aliases with linker plugin segfaults)

PR lto/46940
	PR lto/44463
	* lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Construct nodes
	for aliases when they are used.

	* gcc.dg/lto/pr46940_0.c: New testcase.
	* gcc.dg/lto/pr46940_1.c: New testcase.

From-SVN: r167822
This commit is contained in:
Jan Hubicka 2010-12-15 00:22:23 +01:00 committed by Jan Hubicka
parent 42cbb8c178
commit 5ba58d4f04
5 changed files with 48 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2010-12-14 Jan Hubicka <jh@suse.cz>
PR lto/46940
PR lto/44463
* lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Construct nodes
for aliases when they are used.
2010-12-14 Joseph Myers <joseph@codesourcery.com>
* config.gcc (sparc-*-elf*, sparc-*-rtems*, sparc-*-linux*,

View file

@ -795,9 +795,26 @@ lto_symtab_merge_cgraph_nodes_1 (void **slot, void *data ATTRIBUTE_UNUSED)
for (e = prevailing->next; e; e = e->next)
{
if (e->node != NULL)
lto_cgraph_replace_node (e->node, prevailing->node);
{
/* In case we prevail funcion by an alias, we can run into case
that the alias has no cgraph node attached, since it was
previously unused. Create the node. */
if (!prevailing->node)
{
prevailing->node = cgraph_node (prevailing->decl);
prevailing->node->alias = true;
}
lto_cgraph_replace_node (e->node, prevailing->node);
}
if (e->vnode != NULL)
lto_varpool_replace_node (e->vnode, prevailing->vnode);
{
if (!prevailing->vnode)
{
prevailing->vnode = varpool_node (prevailing->decl);
prevailing->vnode->alias = true;
}
lto_varpool_replace_node (e->vnode, prevailing->vnode);
}
}
/* Drop all but the prevailing decl from the symtab. */

View file

@ -1,3 +1,10 @@
2010-12-14 Jan Hubicka <jh@suse.cz>
PR lto/46940
PR lto/44463
* gcc.dg/lto/pr46940_0.c: New testcase.
* gcc.dg/lto/pr46940_1.c: New testcase.
2010-12-14 Nathan Froyd <froydnj@codesourcery.com>
PR c++/45330

View file

@ -0,0 +1,10 @@
* { dg-require-linker-plugin "" } */
* { dg-extra-ld-options "-fuse-linker-plugin" } */
extern __attribute__((visibility("hidden"))) void _moz_foo (void);
extern __typeof (_moz_foo) _moz_foo __asm__ ("" "INT__foo") __attribute__((__visibility__("hidden"))) ;
void _moz_foo(void)
{
printf ("blah\n");
}
extern __typeof (_moz_foo) EXT__foo __asm__("" "_moz_foo") __attribute__((__alias__("" "INT__foo")));

View file

@ -0,0 +1,5 @@
extern void _moz_foo (void);
main()
{
_moz_foo ();
}