This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for gcc 3.3.x Bug#13617


I've modified this patch for gcc 3.3.x.
Best Regards 
		Sergey Samoylov
diff -NEbaur gcc-3.3.1-orig/gcc/config/mips/mips.c gcc-3.3.1/gcc/config/mips/mips.c
--- gcc-3.3.1-orig/gcc/config/mips/mips.c	2003-06-27 15:44:23.000000000 +0400
+++ gcc-3.3.1/gcc/config/mips/mips.c	2004-09-20 19:03:02.000000000 +0400
@@ -6562,20 +6562,55 @@
     fatal_io_error ("can't close temp file");
 }
 
-/* Emit either a label, .comm, or .lcomm directive, and mark that the symbol
-   is used, so that we don't emit an .extern for it in mips_asm_file_end.  */
+/* 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_declare_object (stream, name, init_string, final_string, size)
-     FILE *stream;
-     const char *name;
-     const char *init_string;
-     const char *final_string;
-     int size;
+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
+	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.  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, ...)
 {
-  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_GP_OPT)
     {
diff -NEbaur gcc-3.3.1-orig/gcc/config/mips/mips.h gcc-3.3.1/gcc/config/mips/mips.h
--- gcc-3.3.1-orig/gcc/config/mips/mips.h	2003-05-30 16:00:42.000000000 +0400
+++ gcc-3.3.1/gcc/config/mips/mips.h	2004-09-20 18:23:28.000000000 +0400
@@ -4326,28 +4326,7 @@
 
 /* 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).  */
diff -NEbaur gcc-3.3.1-orig/gcc/config/mips/mips-protos.h gcc-3.3.1/gcc/config/mips/mips-protos.h
--- gcc-3.3.1-orig/gcc/config/mips/mips-protos.h	2003-02-01 02:51:22.000000000 +0300
+++ gcc-3.3.1/gcc/config/mips/mips-protos.h	2004-09-20 18:46:20.000000000 +0400
@@ -36,9 +36,14 @@
 extern const char *	current_section_name PARAMS ((void));
 extern unsigned int	current_section_flags PARAMS ((void));
 extern int		mips_can_use_return_insn PARAMS ((void));
-extern void		mips_declare_object PARAMS ((FILE *, const char *,
+extern void 		mips_output_aligned_decl_common (FILE *, tree, const char *,
+                                            unsigned HOST_WIDE_INT,
+                                            unsigned int);
+/*extern void		mips_declare_object PARAMS ((FILE *, const char *,
 						     const char *,
-						     const char *, int));
+						     const char *, int));*/
+extern void             mips_declare_object (FILE *, const char *, const char *,
+                                                     const char *, ...);						    
 extern void		mips_expand_epilogue PARAMS ((void));
 extern void		mips_expand_prologue PARAMS ((void));
 extern void		mips_output_filename PARAMS ((FILE *, const char *));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]