varasm.c (asm_emit_uninitialized): Return false if global BSS and ASM_EMIT_BSS not...
authorDavid Edelsohn <edelsohn@gnu.org>
Fri, 2 Aug 2002 01:12:09 +0000 (01:12 +0000)
committerDavid Edelsohn <dje@gcc.gnu.org>
Fri, 2 Aug 2002 01:12:09 +0000 (21:12 -0400)
        * varasm.c (asm_emit_uninitialized): Return false if global BSS
        and ASM_EMIT_BSS not supported by target.
        (assemble_variable): Do not duplicate uninitialized logic.
        Fall through if asm_emit_uninitialized failed.

From-SVN: r55964

gcc/ChangeLog
gcc/varasm.c

index ecf77dcfe3bee2861825c7ee11ab706d47576b95..480722d12b6abf70dc9f4943ceb40ccec95d9341 100644 (file)
@@ -1,3 +1,10 @@
+2002-08-01  David Edelsohn  <edelsohn@gnu.org>
+
+       * varasm.c (asm_emit_uninitialized): Return false if global BSS
+       and ASM_EMIT_BSS not supported by target.
+       (assemble_variable): Do not duplicate uninitialized logic.
+       Fall through if asm_emit_uninitialized failed.
+
 2002-08-01  Chris Demetriou  <cgd@broadcom.com>
 
        * config/mips/mips.h (BRANCH_LIKELY_P): Remove unused macro.
index e35d8a2167e3431415afc53279954de4e4ec7234..71ab7b6b6b8d0e28c267fcd1e2a8d0ad40724d86 100644 (file)
@@ -172,7 +172,7 @@ static void asm_output_aligned_bss  PARAMS ((FILE *, tree, const char *,
 #endif /* BSS_SECTION_ASM_OP */
 static hashval_t const_str_htab_hash   PARAMS ((const void *x));
 static int const_str_htab_eq           PARAMS ((const void *x, const void *y));
-static void asm_emit_uninitialised     PARAMS ((tree, const char*, int, int));
+static bool asm_emit_uninitialised     PARAMS ((tree, const char*, int, int));
 static void resolve_unique_section     PARAMS ((tree, int, int));
 static void mark_weak                   PARAMS ((tree));
 \f
@@ -1350,7 +1350,7 @@ assemble_string (p, size)
 #endif
 #endif
 
-static void
+static bool
 asm_emit_uninitialised (decl, name, size, rounded)
      tree decl;
      const char *name;
@@ -1365,13 +1365,17 @@ asm_emit_uninitialised (decl, name, size, rounded)
   }
   destination = asm_dest_local;
 
+  /* ??? We should handle .bss via select_section mechanisms rather than
+     via special target hooks.  That would eliminate this special case.  */
   if (TREE_PUBLIC (decl))
     {
-#if defined ASM_EMIT_BSS
-      if (! DECL_COMMON (decl))
+      if (!DECL_COMMON (decl))
+#ifdef ASM_EMIT_BSS
        destination = asm_dest_bss;
-      else
+#else
+       return false;
 #endif
+      else
        destination = asm_dest_common;
     }
 
@@ -1420,7 +1424,7 @@ asm_emit_uninitialised (decl, name, size, rounded)
       abort ();
     }
 
-  return;
+  return true;
 }
 
 /* Assemble everything that is needed for a variable or function declaration.
@@ -1593,16 +1597,6 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
       if (DECL_COMMON (decl))
        sorry ("thread-local COMMON data not implemented");
     }
-#ifndef ASM_EMIT_BSS
-  /* If the target can't output uninitialized but not common global data
-     in .bss, then we have to use .data.  */
-  /* ??? We should handle .bss via select_section mechanisms rather than
-     via special target hooks.  That would eliminate this special case.  */
-  /* Duplicate BSS test in asm_emit_uninitialized instead of having it
-     return success or failure for that case.  Shrug.  */
-  else if (TREE_PUBLIC (decl) && !DECL_COMMON (decl))
-    ;
-#endif
   else if (DECL_INITIAL (decl) == 0
           || DECL_INITIAL (decl) == error_mark_node
           || (flag_zero_initialized_in_bss
@@ -1629,9 +1623,10 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
          (decl, "requested alignment for %s is greater than implemented alignment of %d",rounded);
 #endif
 
-      asm_emit_uninitialised (decl, name, size, rounded);
-
-      return;
+      /* If the target cannot output uninitialized but not common global data
+        in .bss, then we have to use .data, so fall through.  */
+      if (asm_emit_uninitialised (decl, name, size, rounded))
+       return;
     }
 
   /* Handle initialized definitions.