varasm.c (globalize_decl): New fn.
authorJason Merrill <jason@redhat.com>
Wed, 13 Mar 2002 14:20:17 +0000 (09:20 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 13 Mar 2002 14:20:17 +0000 (09:20 -0500)
        * varasm.c (globalize_decl): New fn.
        (assemble_start_function): Use it.
        (asm_emit_uninitialized): Use it.
        (assemble_alias): Use it.
        (assemble_variable): Use it.

From-SVN: r50736

gcc/ChangeLog
gcc/varasm.c

index b8bd58417d6532aed383a1e2c02231a37271edd5..2ee542cae722ac231f18ff41f736d0b5c397aa12 100644 (file)
@@ -1,3 +1,11 @@
+2002-03-13  Jason Merrill  <jason@redhat.com>
+
+       * varasm.c (globalize_decl): New fn.
+       (assemble_start_function): Use it.
+       (asm_emit_uninitialized): Use it.
+       (assemble_alias): Use it.
+       (assemble_variable): Use it.
+
 2002-03-13  Hans-Peter Nilsson  <hp@axis.com>
 
        * config/cris/cris.c (cris_target_asm_function_prologue): Revert
index 187429eb5120cc1d92ce0a1d024e098d25fb0e6f..5d41f638ab1f0250960cbc84ea054b0c580d24cf 100644 (file)
@@ -171,6 +171,7 @@ static void mark_weak_decls         PARAMS ((void *));
 #if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
 static void remove_from_pending_weak_list      PARAMS ((const char *));
 #endif
+static void globalize_decl             PARAMS ((tree));
 static void maybe_assemble_visibility  PARAMS ((tree));
 static int in_named_entry_eq           PARAMS ((const PTR, const PTR));
 static hashval_t in_named_entry_hash   PARAMS ((const PTR));
@@ -1237,22 +1238,7 @@ assemble_start_function (decl, fnname)
            weak_global_object_name = name;
        }
 
-#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
-      if (DECL_WEAK (decl))
-       {
-#ifdef ASM_WEAKEN_DECL
-         ASM_WEAKEN_DECL (asm_out_file, decl, fnname, 0);
-#else
-         ASM_WEAKEN_LABEL (asm_out_file, fnname);
-#endif
-         /* 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);
+      globalize_decl (decl);
 
       maybe_assemble_visibility (decl);
     }
@@ -1443,6 +1429,7 @@ asm_emit_uninitialised (decl, name, size, rounded)
     {
 #ifdef ASM_EMIT_BSS
     case asm_dest_bss:
+      globalize_decl (decl);
       ASM_EMIT_BSS (decl, name, size, rounded);
       break;
 #endif
@@ -1657,24 +1644,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
 
   /* First make the assembler name(s) global if appropriate.  */
   if (TREE_PUBLIC (decl) && DECL_NAME (decl))
-    {
-#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
-      if (DECL_WEAK (decl))
-       {
-#ifdef ASM_WEAKEN_DECL
-         ASM_WEAKEN_DECL (asm_out_file, decl, name, 0);
-#else
-         ASM_WEAKEN_LABEL (asm_out_file, name);
-#endif
-          /* 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);
-    }
+    globalize_decl (decl);
 
   /* Output any data that we will need to use the address of.  */
   if (DECL_INITIAL (decl) == error_mark_node)
@@ -5151,6 +5121,32 @@ remove_from_pending_weak_list (name)
 }
 #endif /* defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL) */
 
+/* Emit the assembly bits to indicate that DECL is globally visible.  */
+
+static void
+globalize_decl (decl)
+     tree decl;
+{
+  const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+
+#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
+  if (DECL_WEAK (decl))
+    {
+#ifdef ASM_WEAKEN_DECL
+      ASM_WEAKEN_DECL (asm_out_file, decl, name, 0);
+#else
+      ASM_WEAKEN_LABEL (asm_out_file, name);
+#endif
+      /* Remove this function from the pending weak list so that
+        we do not emit multiple .weak directives for it.  */
+      remove_from_pending_weak_list (name);
+      return;
+    }
+  /* else */
+#endif
+  ASM_GLOBALIZE_LABEL (asm_out_file, name);
+}
+
 /* Emit an assembler directive to make the symbol for DECL an alias to
    the symbol for TARGET.  */
 
@@ -5171,22 +5167,7 @@ assemble_alias (decl, target)
 
   if (TREE_PUBLIC (decl))
     {
-#if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
-      if (DECL_WEAK (decl))
-       {
-#ifdef ASM_WEAKEN_DECL
-         ASM_WEAKEN_DECL (asm_out_file, decl, name, 0);
-#else
-         ASM_WEAKEN_LABEL (asm_out_file, name);
-#endif
-         /* 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);
+      globalize_decl (decl);
 
       maybe_assemble_visibility (decl);
     }