re PR middle-end/11397 (weak aliases broken on Tru64 UNIX)
authorRoger Sayle <roger@eyesopen.com>
Mon, 12 Jan 2004 17:22:12 +0000 (17:22 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Mon, 12 Jan 2004 17:22:12 +0000 (17:22 +0000)
PR middle-end/11397
* varasm.c (assemble_alias): Remove weak aliases from weak_decls.

* gcc.dg/special/wkali-2.c: Add dg-require-alias.

From-SVN: r75737

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/special/wkali-2.c
gcc/varasm.c

index da3258f66b1ad7cf8b03becbf4821e254201a6e9..d01473f88f67120b17b690cc5d30136361128c35 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-12  Roger Sayle  <roger@eyesopen.com>
+
+       PR middle-end/11397
+       * varasm.c (assemble_alias): Remove weak aliases from weak_decls.
+
 2004-01-12  Jan Hubicka  <jh@suse.cz>
 
        PR opt/12826
index 1c5950be7fd4185b2ca660f50095c26297970e4c..efe747befe721e7bf930d31d48fab467b1da4bff 100644 (file)
@@ -1,3 +1,8 @@
+2004-01-12  Roger Sayle  <roger@eyesopen.com>
+
+       PR middle-end/11397
+       * gcc.dg/special/wkali-2.c: Add dg-require-alias.
+
 2004-01-12  Jan Hubicka  <jh@suse.cz>
 
        PR opt/12826
index b53d4f270243e86882a95efc55c9a9eaa2b6f78a..c36024632c6be7893b26cc7fdd65d9835ccc1d0d 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-require-weak "" } */
+/* { dg-require-alias "" } */
 /* { dg-additional-sources "wkali-2a.c wkali-2b.c" } */
 
 #include <stdlib.h>
index 3f5905ab397a013280455fff76bd70fe9083d97a..17d2d341a124d7358013176425ef039e4849f307 100644 (file)
@@ -1,6 +1,6 @@
 /* Output variables, constants and external declarations, for GNU compiler.
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -4411,14 +4411,26 @@ assemble_alias (tree decl, tree target ATTRIBUTE_UNUSED)
 #endif
 #else /* !ASM_OUTPUT_DEF */
 #if defined (ASM_OUTPUT_WEAK_ALIAS) || defined (ASM_WEAKEN_DECL)
-  if (DECL_WEAK (decl))
-    warning ("only weak aliases are supported in this configuration");
-
+  if (DECL_WEAK (decl))
+    {
+      tree *p, t;
 #ifdef ASM_WEAKEN_DECL
-  ASM_WEAKEN_DECL (asm_out_file, decl, name, IDENTIFIER_POINTER (target));
+      ASM_WEAKEN_DECL (asm_out_file, decl, name, IDENTIFIER_POINTER (target));
 #else
-  ASM_OUTPUT_WEAK_ALIAS (asm_out_file, name, IDENTIFIER_POINTER (target));
+      ASM_OUTPUT_WEAK_ALIAS (asm_out_file, name, IDENTIFIER_POINTER (target));
 #endif
+      /* Remove this function from the pending weak list so that
+        we do not emit multiple .weak directives for it.  */
+      for (p = &weak_decls; (t = *p) ; )
+       if (DECL_ASSEMBLER_NAME (decl)
+           == DECL_ASSEMBLER_NAME (TREE_VALUE (t)))
+         *p = TREE_CHAIN (t);
+       else
+         p = &TREE_CHAIN (t);
+    }
+  else
+    warning ("only weak aliases are supported in this configuration");
+
 #else
   warning ("alias definitions not supported in this configuration; ignored");
 #endif