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]

Fix IRIX scan-assembler failures


mips-sgi-irix6.5 fails most scan-assembler tests because it writes strings
as individual bytes.  This patch makes it write the original string in a
comment, thereby allowing the tests to pass.

Bootstrapped & regression tested on mips-sgi-irix6.5 and mips64{,el}-linux-gnu.
Installed mainline and branch.

Richard


	* config/mips/iris5.h (ASM_OUTPUT_ASCII): Use mips_output_ascii to
	put the original string in a comment.
	* config/mips/mips-protos.h (mips_output_ascii): Add prefix argument.
	* config/mips/mips.c (mips_output_ascii): Likewise.
	* config/mips/mips.h (ASM_OUTPUT_ASCII): Adjust accordingly.

Index: config/mips/iris5.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris5.h,v
retrieving revision 1.24
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.24 iris5.h
--- config/mips/iris5.h	17 Oct 2003 11:44:31 -0000	1.24
+++ config/mips/iris5.h	3 Feb 2004 22:37:09 -0000
@@ -193,13 +193,16 @@ #define LABEL_AFTER_LOC(STREAM) fprintf 
 #define MIPS_DEFAULT_GVALUE 0
 
 /* Some assemblers have a bug that causes backslash escaped chars in .ascii
-   to be misassembled, so we just completely avoid it.  */
+   to be misassembled, so avoid it by using .byte instead.  Write the original
+   string in a comment, partly to improve readability and partly for the sake
+   of scan-assembler-type tests.  */
 #undef ASM_OUTPUT_ASCII
 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)				\
 do {								\
   const unsigned char *s_ = (const unsigned char *)(PTR);	\
   unsigned len_ = (LEN);					\
   unsigned i_;							\
+  mips_output_ascii (FILE, (const char *) s_, len_, "\t# ");	\
   for (i_ = 0; i_ < len_; s_++, i_++)				\
     {								\
       if ((i_ % 8) == 0)					\
Index: config/mips/mips-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips-protos.h,v
retrieving revision 1.61
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.61 mips-protos.h
--- config/mips/mips-protos.h	25 Jan 2004 17:23:00 -0000	1.61
+++ config/mips/mips-protos.h	3 Feb 2004 22:37:10 -0000
@@ -101,7 +101,7 @@ extern void irix_output_external_libcall
 #endif
 extern void mips_output_filename (FILE *, const char *);
 extern void mips_output_lineno (FILE *, int);
-extern void mips_output_ascii (FILE *, const char *, size_t);
+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_declare_object (FILE *, const char *, const char *,
Index: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.314
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.314 mips.h
--- config/mips/mips.h	1 Feb 2004 08:05:50 -0000	1.314
+++ config/mips/mips.h	3 Feb 2004 22:37:11 -0000
@@ -3301,7 +3301,7 @@ #define ASM_OUTPUT_SKIP(STREAM,SIZE)				
 /* This is how to output a string.  */
 #undef ASM_OUTPUT_ASCII
 #define ASM_OUTPUT_ASCII(STREAM, STRING, LEN)				\
-  mips_output_ascii (STREAM, STRING, LEN)
+  mips_output_ascii (STREAM, STRING, LEN, "\t.ascii\t")
 
 /* Output #ident as a in the read-only data section.  */
 #undef  ASM_OUTPUT_IDENT
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.374
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.374 mips.c
--- config/mips/mips.c	2 Feb 2004 15:18:19 -0000	1.374
+++ config/mips/mips.c	3 Feb 2004 22:37:13 -0000
@@ -5816,17 +5816,20 @@ mips_output_lineno (FILE *stream, int li
     }
 }
 
-/* Output an ASCII string, in a space-saving way.  */
+/* Output an ASCII string, in a space-saving way.  PREFIX is the string
+   that should be written before the opening quote, such as "\t.ascii\t"
+   for real string data or "\t# " for a comment.  */
 
 void
-mips_output_ascii (FILE *stream, const char *string_param, size_t len)
+mips_output_ascii (FILE *stream, const char *string_param, size_t len,
+		   const char *prefix)
 {
   size_t i;
   int cur_pos = 17;
   register const unsigned char *string =
     (const unsigned char *)string_param;
 
-  fprintf (stream, "\t.ascii\t\"");
+  fprintf (stream, "%s\"", prefix);
   for (i = 0; i < len; i++)
     {
       register int c = string[i];
@@ -5886,7 +5889,7 @@ mips_output_ascii (FILE *stream, const c
       if (cur_pos > 72 && i+1 < len)
 	{
 	  cur_pos = 17;
-	  fprintf (stream, "\"\n\t.ascii\t\"");
+	  fprintf (stream, "\"\n%s\"", prefix);
 	}
     }
   fprintf (stream, "\"\n");


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