]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
varasm.c (assemble_start_function): Remove the function from the pending weak decls...
authorRobert Lipe <robertlipe@usa.net>
Mon, 7 Jun 1999 19:46:39 +0000 (19:46 +0000)
committerJeff Law <law@gcc.gnu.org>
Mon, 7 Jun 1999 19:46:39 +0000 (13:46 -0600)
        * varasm.c (assemble_start_function): Remove the function
        from the pending weak decls list when we define a function.
        (assemble_variable): Similarly for variables.
        (weak_finish): Ignore items on the list with a NULL name.
        (remove_from_ending_weak_list); New function to "remove" an item
        from the pending weak declarations list.

Co-Authored-By: Jeffrey A Law <law@cygnus.com>
From-SVN: r27402

gcc/ChangeLog
gcc/varasm.c

index f23c46e992b725a54f6a82395214d82a5a35c1fb..13e893a73101b4b51ccbae3916853b6e19712d4f 100644 (file)
@@ -1,3 +1,13 @@
+Mon Jun  7 20:34:20 1999  Robert Lipe <robertlipe@usa.net>
+                          Jeffrey A Law  (law@cygnus.com)
+
+       * varasm.c (assemble_start_function): Remove the function
+       from the pending weak decls list when we define a function.
+       (assemble_variable): Similarly for variables.
+       (weak_finish): Ignore items on the list with a NULL name.
+       (remove_from_ending_weak_list); New function to "remove" an item
+       from the pending weak declarations list.
+
 Mon Jun  7 19:27:07 1999  Jerry Quinn <jquinn@nortelnetworks.com>
 
        * pa.md (fmpyfadd, fmpynfadd, fnegabs): New patterns.
index c6f15b8115fd25ff6baf6cb33a2ab7d341fc636e..76f40587943929ca7ac0954282e25925fa61249f 100644 (file)
@@ -141,6 +141,7 @@ static void mark_constants          PROTO((rtx));
 static int output_addressed_constants  PROTO((tree));
 static void output_after_function_constants PROTO((void));
 static void output_constructor         PROTO((tree, int));
+static void remove_from_pending_weak_list      PROTO ((char *));
 #ifdef ASM_OUTPUT_BSS
 static void asm_output_bss             PROTO((FILE *, tree, char *, int, int));
 #endif
@@ -1012,7 +1013,13 @@ assemble_start_function (decl, fnname)
 
 #ifdef ASM_WEAKEN_LABEL
       if (DECL_WEAK (decl))
-       ASM_WEAKEN_LABEL (asm_out_file, fnname);
+       {
+         ASM_WEAKEN_LABEL (asm_out_file, fnname);
+         /* Remove this function from the pending weak list so that
+            we do not emit multiple .weak directives for it.  */
+         remove_from_pending_weak_list
+           (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+       }
       else
 #endif
       ASM_GLOBALIZE_LABEL (asm_out_file, fnname);
@@ -1445,8 +1452,14 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
   if (TREE_PUBLIC (decl) && DECL_NAME (decl))
     {
 #ifdef ASM_WEAKEN_LABEL
-      if (DECL_WEAK (decl))
-       ASM_WEAKEN_LABEL (asm_out_file, name);
+      if (DECL_WEAK (decl)) 
+       {
+         ASM_WEAKEN_LABEL (asm_out_file, name);
+          /* Remove this variable from the pending weak list so that
+             we do not emit multiple .weak directives for it.  */
+         remove_from_pending_weak_list
+           (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+       }
       else
 #endif
       ASM_GLOBALIZE_LABEL (asm_out_file, name);
@@ -4351,9 +4364,32 @@ weak_finish ()
       struct weak_syms *t;
       for (t = weak_decls; t; t = t->next)
        {
-         ASM_WEAKEN_LABEL (asm_out_file, t->name);
-         if (t->value)
-           ASM_OUTPUT_DEF (asm_out_file, t->name, t->value);
+         if (t->name)
+           {
+             ASM_WEAKEN_LABEL (asm_out_file, t->name);
+             if (t->value)
+               ASM_OUTPUT_DEF (asm_out_file, t->name, t->value);
+           }
+       }
+    }
+#endif
+}
+
+/* Remove NAME from the pending list of weak symbols.  This prevents
+   the compiler from emitting multiple .weak directives which confuses
+   some assemblers.  */
+static void
+remove_from_pending_weak_list (name)
+     char *name;
+{
+#ifdef HANDLE_PRAGMA_WEAK
+  if (HANDLE_PRAGMA_WEAK)
+    {
+      struct weak_syms *t;
+      for (t = weak_decls; t; t = t->next)
+       {
+         if (strcmp (name, t->name) == 0)
+           t->name = NULL;
        }
     }
 #endif
@@ -4375,7 +4411,13 @@ assemble_alias (decl, target)
     {
 #ifdef ASM_WEAKEN_LABEL
       if (DECL_WEAK (decl))
-       ASM_WEAKEN_LABEL (asm_out_file, name);
+       {
+         ASM_WEAKEN_LABEL (asm_out_file, name);
+         /* Remove this function from the pending weak list so that
+            we do not emit multiple .weak directives for it.  */
+         remove_from_pending_weak_list
+           (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
+       }
       else
 #endif
        ASM_GLOBALIZE_LABEL (asm_out_file, name);