From ebccb65d5a5a9dbeffbba9824cd2c4fbfdd684a6 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 22 Apr 2005 11:15:09 +0100 Subject: [PATCH] varasm.c (do_assemble_alias): Return early if TREE_ASM_WRITTEN (decl). * varasm.c (do_assemble_alias): Return early if TREE_ASM_WRITTEN (decl). testsuite: * gcc.dg/weak/weak-13.c: New test. From-SVN: r98551 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/weak/weak-13.c | 13 +++++++++++++ gcc/varasm.c | 3 +++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/weak/weak-13.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6dd395..c2ac0f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-04-22 Joseph S. Myers + + * varasm.c (do_assemble_alias): Return early if TREE_ASM_WRITTEN + (decl). + 2005-04-22 Nathan Sidwell * config/i386/i386.md (length_immediate): Use gcc_assert or diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 61c9bf8..c55ee24 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-04-22 Joseph S. Myers + + * gcc.dg/weak/weak-13.c: New test. + 2005-04-21 Geoffrey Keating * lib/target-supports.exp (check_effective_target_sync_int_long): diff --git a/gcc/testsuite/gcc.dg/weak/weak-13.c b/gcc/testsuite/gcc.dg/weak/weak-13.c new file mode 100644 index 0000000..15106a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak-13.c @@ -0,0 +1,13 @@ +/* Test for weak aliases with multiple declarations. Sun assembler + rejects multiple weak alias definitions in the output. */ +/* { dg-do assemble } */ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ +/* { dg-options "" } */ + +#pragma weak foo = _foo + +extern int foo; +extern int foo; + +int _foo = 4; diff --git a/gcc/varasm.c b/gcc/varasm.c index 832b55b..a3aa44a 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4486,6 +4486,9 @@ find_decl_and_mark_needed (tree decl, tree target) static void do_assemble_alias (tree decl, tree target ATTRIBUTE_UNUSED) { + if (TREE_ASM_WRITTEN (decl)) + return; + TREE_ASM_WRITTEN (decl) = 1; TREE_ASM_WRITTEN (DECL_ASSEMBLER_NAME (decl)) = 1; -- 2.7.4