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]

make mips-elf build again



This patch makes mips-elf build again.

There were two problems.  The first was that dwarf2asm calls

      ASM_OUTPUT_ASCII (asm_out_file, str, len);

and this preprocesses to

  register int i, c, len = (len), cur_pos = 17;

which you can imagine doesn't work very well.

The second was that the default definition of DWARF_CIE_DATA_ALIGNMENT
is 8 in 64-bit mode, but in the right mips multilib (it might have
been -mgp64 -msingle-float) some things are still stored on the stack
at offsets of 4.

Tested on mips-elf.

-- 
- Geoffrey Keating <geoffk@geoffk.org>

===File ~/patches/cygnus/gcc-mipsneweh.patch================
2001-05-29  Geoff Keating  <geoffk@anubis.cygnus.com>

	* config/mips/mips.h (ASM_OUTPUT_ASCII): Convert to function.
	* config/mips/mips.c (mips_output_ascii): New function.
	* config/mips/mips-protos.h (mips_output_ascii): Prototype.

	* config/mips/mips.h (DWARF_CIE_DATA_ALIGNMENT): Force to 4.

Index: config/mips/mips-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips-protos.h,v
retrieving revision 1.6
diff -u -p -r1.6 mips-protos.h
--- mips-protos.h	2001/05/26 01:31:43	1.6
+++ mips-protos.h	2001/05/30 08:59:01
@@ -41,6 +41,7 @@ extern void		mips_output_float PARAMS ((
 #endif /* REAL_VALUE_TYPE */
 extern void		mips_output_filename PARAMS ((FILE *, const char *));
 extern void		mips_output_lineno PARAMS ((FILE *, int));
+extern void		mips_output_ascii PARAMS ((FILE *, const char *, size_t));
 extern void		mips_order_regs_for_local_alloc PARAMS ((void));
 extern struct rtx_def *	mips16_gp_pseudo_reg PARAMS ((void));
 #ifdef ASM_OUTPUT_UNDEF_FUNCTION
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.116
diff -u -p -r1.116 mips.c
--- mips.c	2001/05/20 00:35:24	1.116
+++ mips.c	2001/05/30 08:59:01
@@ -5882,6 +5882,85 @@ mips_output_lineno (stream, line)
     }
 }
 
+/* Output an ASCII string, in a space-saving way.  */
+
+void 
+mips_output_ascii (stream, string_param, len)
+     FILE *stream;
+     const char *string_param;
+     size_t len;
+{
+  size_t i;
+  int cur_pos = 17;
+  register const unsigned char *string =
+    (const unsigned char *)string_param;
+
+  fprintf (stream, "\t.ascii\t\"");					
+  for (i = 0; i < len; i++)						
+    {									
+      register int c = string[i];					
+      
+      switch (c)							
+	{								
+	case '\"':							
+	case '\\':							
+	  putc ('\\', stream);					
+	  putc (c, stream);						
+	  cur_pos += 2;							
+	  break;							
+	  
+	case TARGET_NEWLINE:						
+	  fputs ("\\n", stream);					
+	  if (i+1 < len							
+	      && (((c = string[i+1]) >= '\040' && c <= '~')		
+		  || c == TARGET_TAB))					
+	    cur_pos = 32767;		/* break right here */		
+	  else								
+	    cur_pos += 2;						
+	  break;							
+	  
+	case TARGET_TAB:						
+	  fputs ("\\t", stream);					
+	  cur_pos += 2;							
+	  break;							
+	  
+	case TARGET_FF:							
+	  fputs ("\\f", stream);					
+	  cur_pos += 2;							
+	  break;							
+	  
+	case TARGET_BS:							
+	  fputs ("\\b", stream);					
+	  cur_pos += 2;							
+	  break;							
+	  
+	case TARGET_CR:							
+	  fputs ("\\r", stream);					
+	  cur_pos += 2;							
+	  break;							
+	  
+	default:							
+	  if (c >= ' ' && c < 0177)					
+	    {								
+	      putc (c, stream);					
+	      cur_pos++;						
+	    }								
+	  else								
+	    {								
+	      fprintf (stream, "\\%03o", c);				
+	      cur_pos += 4;						
+	    }								
+	}								
+      
+      if (cur_pos > 72 && i+1 < len)					
+	{								
+	  cur_pos = 17;							
+	  fprintf (stream, "\"\n\t.ascii\t\"");			
+	}								
+    }									
+  fprintf (stream, "\"\n");						
+}
+
 /* If defined, a C statement to be executed just prior to the output of
    assembler code for INSN, to modify the extracted operands so they will be
    output differently.
Index: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.111
diff -u -p -r1.111 mips.h
--- mips.h	2001/05/20 00:35:24	1.111
+++ mips.h	2001/05/30 08:59:02
@@ -1109,6 +1109,11 @@ while (0)
 #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + GP_ARG_FIRST : INVALID_REGNUM)
 #define EH_RETURN_STACKADJ_RTX  gen_rtx_REG (Pmode, GP_REG_FIRST + 3)
 
+/* Offsets recorded in opcodes are a multiple of this alignment factor.  
+   The default for this in 64-bit mode is 8, which causes problems with
+   SFmode register saves.  */
+#define DWARF_CIE_DATA_ALIGNMENT 4
+
 /* Overrides for the COFF debug format.  */
 #define PUT_SDB_SCL(a)					\
 do {							\
@@ -4392,75 +4397,7 @@ do {									\
 /* This is how to output a string.  */
 #undef ASM_OUTPUT_ASCII
 #define ASM_OUTPUT_ASCII(STREAM, STRING, LEN)				\
-do {									\
-  register int i, c, len = (LEN), cur_pos = 17;				\
-  register const unsigned char *string =				\
-    (const unsigned char *)(STRING);					\
-  fprintf ((STREAM), "\t.ascii\t\"");					\
-  for (i = 0; i < len; i++)						\
-    {									\
-      register int c = string[i];					\
-									\
-      switch (c)							\
-	{								\
-	case '\"':							\
-	case '\\':							\
-	  putc ('\\', (STREAM));					\
-	  putc (c, (STREAM));						\
-	  cur_pos += 2;							\
-	  break;							\
-									\
-	case TARGET_NEWLINE:						\
-	  fputs ("\\n", (STREAM));					\
-	  if (i+1 < len							\
-	      && (((c = string[i+1]) >= '\040' && c <= '~')		\
-		  || c == TARGET_TAB))					\
-	    cur_pos = 32767;		/* break right here */		\
-	  else								\
-	    cur_pos += 2;						\
-	  break;							\
-									\
-	case TARGET_TAB:						\
-	  fputs ("\\t", (STREAM));					\
-	  cur_pos += 2;							\
-	  break;							\
-									\
-	case TARGET_FF:							\
-	  fputs ("\\f", (STREAM));					\
-	  cur_pos += 2;							\
-	  break;							\
-									\
-	case TARGET_BS:							\
-	  fputs ("\\b", (STREAM));					\
-	  cur_pos += 2;							\
-	  break;							\
-									\
-	case TARGET_CR:							\
-	  fputs ("\\r", (STREAM));					\
-	  cur_pos += 2;							\
-	  break;							\
-									\
-	default:							\
-	  if (c >= ' ' && c < 0177)					\
-	    {								\
-	      putc (c, (STREAM));					\
-	      cur_pos++;						\
-	    }								\
-	  else								\
-	    {								\
-	      fprintf ((STREAM), "\\%03o", c);				\
-	      cur_pos += 4;						\
-	    }								\
-	}								\
-									\
-      if (cur_pos > 72 && i+1 < len)					\
-	{								\
-	  cur_pos = 17;							\
-	  fprintf ((STREAM), "\"\n\t.ascii\t\"");			\
-	}								\
-    }									\
-  fprintf ((STREAM), "\"\n");						\
-} while (0)
+  mips_output_ascii (STREAM, STRING, LEN)
 
 /* Handle certain cpp directives used in header files on sysV.  */
 #define SCCS_DIRECTIVE
============================================================


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