OSDN Git Service

PR bootstrap/13617
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Feb 2004 19:08:34 +0000 (19:08 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 12 Feb 2004 19:08:34 +0000 (19:08 +0000)
* config/mips/mips-protos.h (mips_output_aligned_decl_common): Declare.
(mips_declare_object): Make variadic.
* config/mips/mips.h (ASM_OUTPUT_ALIGNED_DECL_COMMON): Use
mips_output_aligned_decl_common.
* config/mips/mips.c (mips_output_aligned_decl_common): New function.
(mips_declare_object): Make variadic.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77721 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/mips/mips-protos.h
gcc/config/mips/mips.c
gcc/config/mips/mips.h

index 3d38c29..3c3b860 100644 (file)
@@ -1,3 +1,13 @@
+2004-02-12  Richard Sandiford  <rsandifo@redhat.com>
+
+       PR bootstrap/13617
+       * config/mips/mips-protos.h (mips_output_aligned_decl_common): Declare.
+       (mips_declare_object): Make variadic.
+       * config/mips/mips.h (ASM_OUTPUT_ALIGNED_DECL_COMMON): Use
+       mips_output_aligned_decl_common.
+       * config/mips/mips.c (mips_output_aligned_decl_common): New function.
+       (mips_declare_object): Make variadic.
+
 2004-02-12  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * emit-rtl.c (set_mem_attributes_minus_bitpos): Don't kill
index 8a55e1a..a2b1d45 100644 (file)
@@ -104,8 +104,11 @@ extern void mips_output_lineno (FILE *, int);
 extern void mips_output_ascii (FILE *, const char *, size_t, const char *);
 extern void mips_output_aligned_bss (FILE *, tree, const char *,
                                     unsigned HOST_WIDE_INT, int);
+extern void mips_output_aligned_decl_common (FILE *, tree, const char *,
+                                            unsigned HOST_WIDE_INT,
+                                            unsigned int);
 extern void mips_declare_object (FILE *, const char *, const char *,
-                                const char *, int);
+                                const char *, ...);
 extern void mips_declare_object_name (FILE *, const char *, tree);
 extern void mips_finish_declare_object (FILE *, tree, int, int);
 
index 4d3a5bf..40b8014 100644 (file)
@@ -6022,17 +6022,63 @@ mips_file_end (void)
     }
 }
 
+/* Implement ASM_OUTPUT_ALIGNED_DECL_COMMON.  This is usually the same as
+   the elfos.h version, but we also need to handle -muninit-const-in-rodata
+   and the limitations of the SGI o32 assembler.  */
+
+void
+mips_output_aligned_decl_common (FILE *stream, tree decl, const char *name,
+                                unsigned HOST_WIDE_INT size,
+                                unsigned int align)
+{
+  /* If the target wants uninitialized const declarations in
+     .rdata then don't put them in .comm.   */
+  if (TARGET_EMBEDDED_DATA && TARGET_UNINIT_CONST_IN_RODATA
+      && TREE_CODE (decl) == VAR_DECL && TREE_READONLY (decl)
+      && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
+    {
+      if (TREE_PUBLIC (decl) && DECL_NAME (decl))
+       targetm.asm_out.globalize_label (stream, name);
+
+      readonly_data_section ();
+      ASM_OUTPUT_ALIGN (stream, floor_log2 (align / BITS_PER_UNIT));
+      mips_declare_object (stream, name, "",
+                          ":\n\t.space\t" HOST_WIDE_INT_PRINT_UNSIGNED "\n",
+                          size);
+    }
+  else if (TARGET_SGI_O32_AS)
+    {
+      /* The SGI o32 assembler doesn't accept an alignment, so round up
+        the size instead.  */
+      size += (align / BITS_PER_UNIT) - 1;
+      size -= size % (align / BITS_PER_UNIT);
+      mips_declare_object (stream, name, "\n\t.comm\t",
+                          "," HOST_WIDE_INT_PRINT_UNSIGNED "\n", size);
+    }
+  else
+    mips_declare_object (stream, name, "\n\t.comm\t",
+                        "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n",
+                        size, align / BITS_PER_UNIT);
+}
+
 /* Emit either a label, .comm, or .lcomm directive.  When using assembler
    macros, mark the symbol as written so that mips_file_end won't emit an
-   .extern for it.  */
+   .extern for it.  STREAM is the output file, NAME is the name of the
+   symbol, INIT_STRING is the string that should be written before the
+   symbol and FINAL_STRING is the string that shoulbe written after it.
+   FINAL_STRING is a printf() format that consumes the remaining arguments.  */
 
 void
 mips_declare_object (FILE *stream, const char *name, const char *init_string,
-                    const char *final_string, int size)
+                    const char *final_string, ...)
 {
-  fputs (init_string, stream);         /* "", "\t.comm\t", or "\t.lcomm\t" */
+  va_list ap;
+
+  fputs (init_string, stream);
   assemble_name (stream, name);
-  fprintf (stream, final_string, size);        /* ":\n", ",%u\n", ",%u\n" */
+  va_start (ap, final_string);
+  vfprintf (stream, final_string, ap);
+  va_end (ap);
 
   if (!TARGET_EXPLICIT_RELOCS)
     {
index 616557c..708b2e2 100644 (file)
@@ -3177,28 +3177,7 @@ while (0)
 
 /* This says how to define a global common symbol.  */
 
-#define ASM_OUTPUT_ALIGNED_DECL_COMMON(STREAM, DECL, NAME, SIZE, ALIGN) \
-  do {                                                                 \
-    /* If the target wants uninitialized const declarations in         \
-       .rdata then don't put them in .comm */                          \
-    if (TARGET_EMBEDDED_DATA && TARGET_UNINIT_CONST_IN_RODATA          \
-       && TREE_CODE (DECL) == VAR_DECL && TREE_READONLY (DECL)         \
-       && (DECL_INITIAL (DECL) == 0                                    \
-           || DECL_INITIAL (DECL) == error_mark_node))                 \
-      {                                                                        \
-       if (TREE_PUBLIC (DECL) && DECL_NAME (DECL))                     \
-         (*targetm.asm_out.globalize_label) (STREAM, NAME);            \
-                                                                       \
-       readonly_data_section ();                                       \
-       ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT));  \
-       mips_declare_object (STREAM, NAME, "", ":\n\t.space\t%u\n",     \
-           (SIZE));                                                    \
-      }                                                                        \
-    else                                                               \
-       mips_declare_object (STREAM, NAME, "\n\t.comm\t", ",%u\n",      \
-         (SIZE));                                                      \
-  } while (0)
-
+#define ASM_OUTPUT_ALIGNED_DECL_COMMON mips_output_aligned_decl_common
 
 /* This says how to define a local common symbol (ie, not visible to
    linker).  */