diff options
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cgraph.c | 4 | ||||
-rw-r--r-- | gcc/cgraph.h | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/alias-7.c | 16 | ||||
-rw-r--r-- | gcc/toplev.c | 2 | ||||
-rw-r--r-- | gcc/varasm.c | 2 |
7 files changed, 38 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4bb181..9922f7e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 3aabc40..b769f841 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -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; diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 2a1c1b3..46f9f0a 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ba4ac9..2cc2451 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/gcc.dg/alias-7.c b/gcc/testsuite/gcc.dg/alias-7.c new file mode 100644 index 0000000..6974970 --- /dev/null +++ b/gcc/testsuite/gcc.dg/alias-7.c @@ -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; +} diff --git a/gcc/toplev.c b/gcc/toplev.c index 7c8723c..5895d37 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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)))) diff --git a/gcc/varasm.c b/gcc/varasm.c index 751c8bc..c51f6c0 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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. */ |