re PR middle-end/20622 (Alias to nocommon variable fails to assemble on ppc64)

PR middle-end/20622
	* cgraph.h (struct cgraph_varpool_node): Add alias field.
	* cgraph.c (cgraph_varpool_assemble_pending_decls): Don't call
	assemble_variable on aliases.
	* varasm.c (assemble_alias): Set node->alias.
	* toplev.c (wrapup_global_declarations): Don't call
	rest_of_decl_compilation on aliases again.

	* gcc.dg/alias-7.c: New test.

From-SVN: r97161
This commit is contained in:
Jakub Jelinek 2005-03-29 17:37:29 +02:00 committed by Jakub Jelinek
parent 64a1ec409f
commit 1a612e0a6c
7 changed files with 38 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2005-03-29 Jakub Jelinek <jakub@redhat.com>
PR middle-end/20622
* cgraph.h (struct cgraph_varpool_node): Add alias field.
* cgraph.c (cgraph_varpool_assemble_pending_decls): Don't call
assemble_variable on aliases.
* varasm.c (assemble_alias): Set node->alias.
* toplev.c (wrapup_global_declarations): Don't call
rest_of_decl_compilation on aliases again.
2005-03-29 Paul Brook <paul@codesourcery.com>
* config/arm/arm-protos.h (arm_dbx_register_number): Add prototype.

View File

@ -724,11 +724,11 @@ cgraph_varpool_assemble_pending_decls (void)
while (cgraph_varpool_nodes_queue)
{
tree decl = cgraph_varpool_nodes_queue->decl;
struct cgraph_varpool_node *node = cgraph_varpool_nodes_queue;
tree decl = node->decl;
cgraph_varpool_nodes_queue = cgraph_varpool_nodes_queue->next_needed;
if (!TREE_ASM_WRITTEN (decl))
if (!TREE_ASM_WRITTEN (decl) && !node->alias)
{
assemble_variable (decl, 0, 1, 0);
changed = true;

View File

@ -153,6 +153,8 @@ struct cgraph_varpool_node GTY(())
bool finalized;
/* Set when function is scheduled to be assembled. */
bool output;
/* Set for aliases once they got through assemble_alias. */
bool alias;
};
extern GTY(()) struct cgraph_node *cgraph_nodes;

View File

@ -1,3 +1,8 @@
2005-03-29 Jakub Jelinek <jakub@redhat.com>
PR middle-end/20622
* gcc.dg/alias-7.c: New test.
2005-03-29 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/sparc-reg-1.c: New test.

View File

@ -0,0 +1,16 @@
/* { dg-do run } */
/* { dg-require-alias "" } */
/* { dg-options "-O2" } */
extern void abort (void);
int foo __asm__ ("foo") __attribute__((nocommon));
extern __typeof (foo) bar __attribute__ ((weak, alias ("foo")));
int
main (void)
{
if (&foo != &bar || foo || bar)
abort ();
return bar;
}

View File

@ -783,6 +783,8 @@ wrapup_global_declarations (tree *vec, int len)
if (flag_unit_at_a_time && node->finalized)
needed = 0;
else if (node->alias)
needed = 0;
else if ((flag_unit_at_a_time && !cgraph_global_info_ready)
&& (TREE_USED (decl)
|| TREE_USED (DECL_ASSEMBLER_NAME (decl))))

View File

@ -4518,7 +4518,7 @@ assemble_alias (tree decl, tree target)
if (TREE_CODE (decl) == FUNCTION_DECL)
cgraph_node (decl);
else
cgraph_varpool_node (decl);
cgraph_varpool_node (decl)->alias = true;
/* If the target has already been emitted, we don't have to queue the
alias. This saves a tad o memory. */