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 target/10913 (-mmips-as causing an abort)


TARGET_FILE_SWITCHING causes an abort() for most non-irix configurations.
As Zack discovered, it also generates bogus code for irix6.

To quote from an earlier message:

Richard Sandiford <rsandifo@redhat.com> writes:
> I'd prepared a patch to remove TARGET_FILE_SWITCHING as one
> possible fix for target/10913.  At the time I thought that that was
> going too far, but from what you say, it sounds like it might not
> have been.  The code seems to be in such bad shape that I can't
> believe it's in active use.
> 
> As I understand it:
> 
>   - The code is only used for assemblers other than gas.
> 
>   - The only assemblers we support are gas and SGI's.
>     (Comments in the port refer to MIPS' assembler, but most
>     non-irix configuration will uncerimoniously abort when
>     passed -mmips-as -O[123].)
>
>   - The code is only used for -non_shared.
> 
>   - The irix configurations don't build -non_shared libraries
>     by default.  You would have to hack the config files to
>     get a libgcc that was usable with -non_shared.
> 
>   - Now that we use explicit relocation operators for n32 & n64,
>     the code would only be needed for o32.
> 
>   - gas works fine for o32 on irix.
> 
> The hack is still needed if you want to do gp optimisations on
> -non_shared o32 code with SGI's assembler.  But given the above,
> it's probably better not to try.
> 
> I'll dust off the patch and submit it later...

Attached.  The patch turns off small data optimisations in the cases
that used to need TARGET_FILE_SWITCHING.  We can then get rid of the
asm_out_text_file/asm_out_data_file distinction.

mips.h had many PUT_SDB* macros that only differed from the default
in their use of asm_out_text_file.  Those macros can go too.

Bootstrapped & regression tested on mips-sgi-irix6.5 and
mips-sgi-irix6.5o32 (before Rainer's recent patches).
Also tested on mips64vrel-elf and mipsisa64-elf.

I checked that the PUT_SDB_* changes cause no change in the -gcoff
output for dhrystone using mips-sgi-irix6.5o32 --with-gnu-as.
GAS can't actually understand the output, but that's
another story...

OK to install?

Richard


	PR target/10913
	* config/mips/mips.h (TARGET_FILE_SWITCHING, NO_DBX_FUNCTION_END,
	PUT_SDB_SCL, PUT_SDB_INT_VAL, PUT_SDB_VAL, PUT_SDB_ENDEF,
	PUT_SDB_TYPE, PUT_SDB_SIZE, PUT_SDB_DIM, PUT_SDB_START_DIM,
	PUT_SDB_NEXT_DIM, PUT_SDB_LAST_DIM, PUT_SDB_TAG, PUT_SDB_SRC_FILE,
	SDB_GENERATE_FAKE, TEXT_SECTION): Delete.
	(PUT_SDB_DEF, PUT_SDB_PLAIN_DEF, PUT_SDB_BLOCK_START,
	PUT_SDB_BLOCK_END, PUT_SDB_FUNCTION_END): Replace use of
	asm_out_text_file with asm_out_file.
	* config/mips/iris5gas.h (PUT_SDB_SIZE, PUT_SDB_TYPE): Likewise.
	* config/mips/elf.h (TEXT_SECTION): Undefine.
	* config/mips/elf64.h (TEXT_SECION): Undefine.
	* config/mips/openbsd.h (TEXT_SECION): Undefine.
	* config/mips/mips.c (asm_out_text_file, asm_out_data_file): Delete.
	(override_options): Disable small-data optimizations unless using
	gas or explicit relocations.
	(mips_asm_file_start, mips_asm_file_end, mips_output_function_epilogue,
	iris6_asm_named_section, iris6_asm_file_start): Remove code for
	handling TARGET_FILE_SWITCHING.
	(copy_file_data): Move into TARGET_IRIX6 block.

Index: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.255
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.255 mips.h
*** config/mips/mips.h	30 May 2003 12:02:45 -0000	1.255
--- config/mips/mips.h	7 Jun 2003 11:58:33 -0000
*************** #define TARGET_BRANCHLIKELY	(target_flag
*** 307,318 ****
  #define TARGET_EXPLICIT_RELOCS	(target_flags & MASK_EXPLICIT_RELOCS)
  
  
- /* This is true if we must enable the assembly language file switching
-    code.  */
- 
- #define TARGET_FILE_SWITCHING \
-   (TARGET_GP_OPT && ! TARGET_GAS && ! TARGET_MIPS16)
- 
  /* True if the call patterns should be split into a jalr followed by
     an instruction to restore $gp.  This is only ever true for SVR4 PIC,
     in which $gp is call-clobbered.  It is only safe to split the load
--- 307,312 ----
*************** #define TARGET_SIBCALLS \
*** 342,353 ****
  
  #define TARGET_GPWORD (TARGET_ABICALLS && (!TARGET_NEWABI || TARGET_GAS))
  
- 
- /* We must disable the function end stabs when doing the file switching trick,
-    because the Lscope stabs end up in the wrong place, making it impossible
-    to debug the resulting code.  */
- #define NO_DBX_FUNCTION_END TARGET_FILE_SWITCHING
- 
  					/* Generate mips16 code */
  #define TARGET_MIPS16		(target_flags & MASK_MIPS16)
  
--- 336,341 ----
*************** #define DWARF_CIE_DATA_ALIGNMENT 4
*** 1356,1456 ****
  
  #define FIND_BASE_TERM(X) mips_delegitimize_address (X)
  
- /* Overrides for the COFF debug format.  */
- #define PUT_SDB_SCL(a)					\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "\t.scl\t%d;", (a));	\
- } while (0)
- 
- #define PUT_SDB_INT_VAL(a)				\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "\t.val\t" HOST_WIDE_INT_PRINT_DEC ";", \
- 	   (HOST_WIDE_INT)(a));			        \
- } while (0)
- 
- #define PUT_SDB_VAL(a)					\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fputs ("\t.val\t", asm_out_text_file);		\
-   output_addr_const (asm_out_text_file, (a));		\
-   fputc (';', asm_out_text_file);			\
- } while (0)
- 
  #define PUT_SDB_DEF(a)					\
  do {							\
!   extern FILE *asm_out_text_file;			\
!   fprintf (asm_out_text_file, "\t%s.def\t",		\
  	   (TARGET_GAS) ? "" : "#");			\
!   ASM_OUTPUT_LABELREF (asm_out_text_file, a); 		\
!   fputc (';', asm_out_text_file);			\
  } while (0)
  
  #define PUT_SDB_PLAIN_DEF(a)				\
  do {							\
!   extern FILE *asm_out_text_file;			\
!   fprintf (asm_out_text_file, "\t%s.def\t.%s;",		\
  	   (TARGET_GAS) ? "" : "#", (a));		\
  } while (0)
  
- #define PUT_SDB_ENDEF					\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "\t.endef\n");		\
- } while (0)
- 
- #define PUT_SDB_TYPE(a)					\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "\t.type\t0x%x;", (a));	\
- } while (0)
- 
- #define PUT_SDB_SIZE(a)					\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "\t.size\t" HOST_WIDE_INT_PRINT_DEC ";", \
- 	   (HOST_WIDE_INT)(a));			        \
- } while (0)
- 
- #define PUT_SDB_DIM(a)					\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "\t.dim\t%d;", (a));	\
- } while (0)
- 
- #ifndef PUT_SDB_START_DIM
- #define PUT_SDB_START_DIM				\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "\t.dim\t");		\
- } while (0)
- #endif
- 
- #ifndef PUT_SDB_NEXT_DIM
- #define PUT_SDB_NEXT_DIM(a)				\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "%d,", a);		\
- } while (0)
- #endif
- 
- #ifndef PUT_SDB_LAST_DIM
- #define PUT_SDB_LAST_DIM(a)				\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "%d;", a);		\
- } while (0)
- #endif
- 
- #define PUT_SDB_TAG(a)					\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   fprintf (asm_out_text_file, "\t.tag\t");		\
-   ASM_OUTPUT_LABELREF (asm_out_text_file, a); 		\
-   fputc (';', asm_out_text_file);			\
- } while (0)
- 
  /* For block start and end, we create labels, so that
     later we can figure out where the correct offset is.
     The normal .ent/.end serve well enough for functions,
--- 1344,1363 ----
  
  #define FIND_BASE_TERM(X) mips_delegitimize_address (X)
  
  #define PUT_SDB_DEF(a)					\
  do {							\
!   fprintf (asm_out_file, "\t%s.def\t",			\
  	   (TARGET_GAS) ? "" : "#");			\
!   ASM_OUTPUT_LABELREF (asm_out_file, a); 		\
!   fputc (';', asm_out_file);				\
  } while (0)
  
  #define PUT_SDB_PLAIN_DEF(a)				\
  do {							\
!   fprintf (asm_out_file, "\t%s.def\t.%s;",		\
  	   (TARGET_GAS) ? "" : "#", (a));		\
  } while (0)
  
  /* For block start and end, we create labels, so that
     later we can figure out where the correct offset is.
     The normal .ent/.end serve well enough for functions,
*************** do {							\
*** 1458,1465 ****
  
  #define PUT_SDB_BLOCK_START(LINE)			\
  do {							\
!   extern FILE *asm_out_text_file;			\
!   fprintf (asm_out_text_file,				\
  	   "%sLb%d:\n\t%s.begin\t%sLb%d\t%d\n",		\
  	   LOCAL_LABEL_PREFIX,				\
  	   sdb_label_count,				\
--- 1365,1371 ----
  
  #define PUT_SDB_BLOCK_START(LINE)			\
  do {							\
!   fprintf (asm_out_file,				\
  	   "%sLb%d:\n\t%s.begin\t%sLb%d\t%d\n",		\
  	   LOCAL_LABEL_PREFIX,				\
  	   sdb_label_count,				\
*************** do {							\
*** 1472,1479 ****
  
  #define PUT_SDB_BLOCK_END(LINE)				\
  do {							\
!   extern FILE *asm_out_text_file;			\
!   fprintf (asm_out_text_file,				\
  	   "%sLe%d:\n\t%s.bend\t%sLe%d\t%d\n",		\
  	   LOCAL_LABEL_PREFIX,				\
  	   sdb_label_count,				\
--- 1378,1384 ----
  
  #define PUT_SDB_BLOCK_END(LINE)				\
  do {							\
!   fprintf (asm_out_file,				\
  	   "%sLe%d:\n\t%s.bend\t%sLe%d\t%d\n",		\
  	   LOCAL_LABEL_PREFIX,				\
  	   sdb_label_count,				\
*************** #define PUT_SDB_FUNCTION_START(LINE)
*** 1488,1508 ****
  
  #define PUT_SDB_FUNCTION_END(LINE)			\
  do {							\
!   extern FILE *asm_out_text_file;			\
!   ASM_OUTPUT_SOURCE_LINE (asm_out_text_file, LINE + sdb_begin_function_line); \
  } while (0)
  
  #define PUT_SDB_EPILOGUE_END(NAME)
  
- #define PUT_SDB_SRC_FILE(FILENAME)			\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   output_file_directive (asm_out_text_file, (FILENAME));\
- } while (0)
- 
- #define SDB_GENERATE_FAKE(BUFFER, NUMBER)		\
-   sprintf ((BUFFER), ".%dfake", (NUMBER));
- 
  /* Correct the offset of automatic variables and arguments.  Note that
     the MIPS debug format wants all automatic variables and arguments
     to be in terms of the virtual frame pointer (stack pointer before
--- 1393,1403 ----
  
  #define PUT_SDB_FUNCTION_END(LINE)			\
  do {							\
!   ASM_OUTPUT_SOURCE_LINE (asm_out_file, LINE + sdb_begin_function_line); \
  } while (0)
  
  #define PUT_SDB_EPILOGUE_END(NAME)
  
  /* Correct the offset of automatic variables and arguments.  Note that
     the MIPS debug format wants all automatic variables and arguments
     to be in terms of the virtual frame pointer (stack pointer before
*************** #define ASM_OUTPUT_EXTERNAL(STREAM,DECL,
*** 3919,3937 ****
  /* This says what to print at the end of the assembly file */
  #undef ASM_FILE_END
  #define ASM_FILE_END(STREAM) mips_asm_file_end(STREAM)
- 
- 
- /* Play switch file games if we're optimizing the global pointer.  */
- 
- #undef TEXT_SECTION
- #define TEXT_SECTION()					\
- do {							\
-   extern FILE *asm_out_text_file;			\
-   if (TARGET_FILE_SWITCHING)				\
-     asm_out_file = asm_out_text_file;			\
-   fputs (TEXT_SECTION_ASM_OP, asm_out_file);		\
-   fputc ('\n', asm_out_file);            		\
- } while (0)
  
  
  /* This is how to declare a function name.  The actual work of
--- 3814,3819 ----
Index: config/mips/elf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/elf.h,v
retrieving revision 1.50
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.50 elf.h
*** config/mips/elf.h	12 May 2003 13:59:13 -0000	1.50
--- config/mips/elf.h	7 Jun 2003 11:58:33 -0000
*************** #define MAX_OFILE_ALIGNMENT (32768*8)
*** 48,66 ****
  #undef  TARGET_ASM_NAMED_SECTION
  #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
  
- /* Given that Irix has it's own headers, not having TARGET_GAS here
-    seems a mistake.  If we actually need to be prepared for file
-    switching, then we need a custom TARGET_ASM_NAMED_SECTION too.  */
- 
- #undef  TEXT_SECTION
- #define TEXT_SECTION()				\
- do {						\
-   if (TARGET_FILE_SWITCHING)			\
-     abort ();					\
-   fputs (TEXT_SECTION_ASM_OP, asm_out_file);	\
-   fputc ('\n', asm_out_file);			\
- } while (0)
- 
  /* The following macro defines the format used to output the second
     operand of the .type assembler directive.  Different svr4 assemblers
     expect various different forms for this operand.  The one given here
--- 48,53 ----
Index: config/mips/elf64.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/elf64.h,v
retrieving revision 1.54
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.54 elf64.h
*** config/mips/elf64.h	1 May 2003 02:33:11 -0000	1.54
--- config/mips/elf64.h	7 Jun 2003 11:58:33 -0000
*************** #define MAX_OFILE_ALIGNMENT (32768*8)
*** 45,63 ****
  #undef TARGET_ASM_NAMED_SECTION
  #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
  
- /* Given that Irix has it's own headers, not having TARGET_GAS here
-    seems a mistake.  If we actually need to be prepared for file
-    switching, then we need a custom TARGET_ASM_NAMED_SECTION too.  */
- 
- #undef TEXT_SECTION
- #define TEXT_SECTION()				\
- do {						\
-   if (TARGET_FILE_SWITCHING)			\
-     abort ();					\
-   fputs (TEXT_SECTION_ASM_OP, asm_out_file);	\
-   fputc ('\n', asm_out_file);			\
- } while (0)
- 
  /* The following macro defines the format used to output the second
     operand of the .type assembler directive.  Different svr4 assemblers
     expect various different forms for this operand.  The one given here
--- 45,50 ----
Index: config/mips/iris5gas.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris5gas.h,v
retrieving revision 1.11
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.11 iris5gas.h
*** config/mips/iris5gas.h	16 May 2003 18:57:42 -0000	1.11
--- config/mips/iris5gas.h	7 Jun 2003 11:58:33 -0000
*************** #define LABEL_AFTER_LOC(STREAM)
*** 50,67 ****
     avoid conflicting with ELF directives.  These are only recognized
     by gas, anyhow, not the native assembler.  */
  #undef PUT_SDB_SIZE
! #define PUT_SDB_SIZE(a)                                       \
! do {                                                  \
!   extern FILE *asm_out_text_file;                     \
!   fprintf (asm_out_text_file, "\t.esize\t" HOST_WIDE_INT_PRINT_DEC ";", \
!  	   (HOST_WIDE_INT) (a));		      \
  } while (0)
  
  #undef PUT_SDB_TYPE
! #define PUT_SDB_TYPE(a)                                       \
! do {                                                  \
!   extern FILE *asm_out_text_file;                     \
!   fprintf (asm_out_text_file, "\t.etype\t0x%x;", (a));        \
  } while (0)
  
  /* Switch into a generic section.  */
--- 50,65 ----
     avoid conflicting with ELF directives.  These are only recognized
     by gas, anyhow, not the native assembler.  */
  #undef PUT_SDB_SIZE
! #define PUT_SDB_SIZE(a)					\
! do {							\
!   fprintf (asm_out_file, "\t.esize\t" HOST_WIDE_INT_PRINT_DEC ";", \
!  	   (HOST_WIDE_INT) (a));			\
  } while (0)
  
  #undef PUT_SDB_TYPE
! #define PUT_SDB_TYPE(a)					\
! do {							\
!   fprintf (asm_out_file, "\t.etype\t0x%x;", (a));	\
  } while (0)
  
  /* Switch into a generic section.  */
Index: config/mips/openbsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/openbsd.h,v
retrieving revision 1.10
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.10 openbsd.h
*** config/mips/openbsd.h	3 Jun 2003 09:06:54 -0000	1.10
--- config/mips/openbsd.h	7 Jun 2003 11:58:33 -0000
*************** #define MIPS_DEFAULT_GVALUE 0
*** 110,128 ****
  #undef TARGET_ASM_NAMED_SECTION
  #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
  
- /* Not having TARGET_GAS here seems a mistake.  If we actually need to
-    be prepared for file switching, then we need a custom
-    TARGET_ASM_NAMED_SECTION too.  */
- 
- #undef TEXT_SECTION
- #define TEXT_SECTION()				\
- do {						\
-   if (TARGET_FILE_SWITCHING)			\
-     abort ();					\
-   fputs (TEXT_SECTION_ASM_OP, asm_out_file);	\
-   fputc ('\n', asm_out_file);			\
- } while (0)
- 
  /* collect2 support (Macros for initialization).  */
  
  /* Mips default configuration is COFF-only, and confuses collect2.  */
--- 110,115 ----
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.272
diff -c -d -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.272 mips.c
*** config/mips/mips.c	3 Jun 2003 08:57:54 -0000	1.272
--- config/mips/mips.c	7 Jun 2003 11:58:36 -0000
*************** static bool mips_matching_cpu_name_p		PA
*** 262,269 ****
  static const struct mips_cpu_info *mips_parse_cpu   PARAMS ((const char *,
  							      const char *));
  static const struct mips_cpu_info *mips_cpu_info_from_isa PARAMS ((int));
- static void copy_file_data			PARAMS ((FILE *, FILE *));
  #ifdef TARGET_IRIX6
  static void iris6_asm_named_section_1		PARAMS ((const char *,
  							 unsigned int,
  							 unsigned int));
--- 262,269 ----
  static const struct mips_cpu_info *mips_parse_cpu   PARAMS ((const char *,
  							      const char *));
  static const struct mips_cpu_info *mips_cpu_info_from_isa PARAMS ((int));
  #ifdef TARGET_IRIX6
+ static void copy_file_data			PARAMS ((FILE *, FILE *));
  static void iris6_asm_named_section_1		PARAMS ((const char *,
  							 unsigned int,
  							 unsigned int));
*************** int sym_lineno = 0;
*** 447,458 ****
     handle .files inside of functions.  */
  int inside_function = 0;
  
- /* Files to separate the text and the data output, so that all of the data
-    can be emitted before the text, which will mean that the assembler will
-    generate smaller code, based on the global pointer.  */
- FILE *asm_out_data_file;
- FILE *asm_out_text_file;
- 
  /* Linked list of all externals that are to be emitted when optimizing
     for the global pointer if they haven't been declared by the end of
     the program with an appropriate .comm or initialization.  */
--- 447,452 ----
*************** override_options ()
*** 5403,5408 ****
--- 5397,5412 ----
    else
      mips_abicalls = MIPS_ABICALLS_NO;
  
+   /* The MIPS and SGI o32 assemblers expect small-data variables to
+      be declared before they are used.  Although we once had code to
+      do this, it was very invasive and fragile.  It no longer seems
+      worth the effort.  */
+   if (!TARGET_EXPLICIT_RELOCS && !TARGET_GAS)
+     {
+       mips_section_threshold = 0;
+       target_flags &= ~MASK_GPOPT;
+     }
+ 
    /* -membedded-pic is a form of PIC code suitable for embedded
       systems.  All calls are made using PC relative addressing, and
       all data is addressed using the $gp register.  This requires gas,
*************** #define ABICALLS_ASM_OP "\t.abicalls"
*** 6528,6544 ****
    if (TARGET_MIPS16)
      fprintf (stream, "\t.set\tmips16\n");
  
-   /* This code exists so that we can put all externs before all symbol
-      references.  This is necessary for the MIPS assembler's global pointer
-      optimizations to work.  */
-   if (TARGET_FILE_SWITCHING)
-     {
-       asm_out_data_file = stream;
-       asm_out_text_file = tmpfile ();
-     }
-   else
-     asm_out_data_file = asm_out_text_file = stream;
- 
    if (flag_verbose_asm)
      fprintf (stream, "\n%s -G value = %d, Arch = %s, ISA = %d\n",
  	     ASM_COMMENT_START,
--- 6532,6537 ----
*************** mips_asm_file_end (file)
*** 6582,6614 ****
  	    }
  	}
      }
- 
-   if (TARGET_FILE_SWITCHING)
-     {
-       fprintf (file, "\n\t.text\n");
-       copy_file_data (file, asm_out_text_file);
-     }
- }
- 
- static void
- copy_file_data (to, from)
-      FILE *to, *from;
- {
-   char buffer[8192];
-   size_t len;
-   rewind (from);
-   if (ferror (from))
-     fatal_error ("can't rewind temp file: %m");
- 
-   while ((len = fread (buffer, 1, sizeof (buffer), from)) > 0)
-     if (fwrite (buffer, 1, len, to) != len)
-       fatal_error ("can't write to output file: %m");
- 
-   if (ferror (from))
-     fatal_error ("can't read from temp file: %m");
- 
-   if (fclose (from))
-     fatal_error ("can't close temp file: %m");
  }
  
  /* Emit either a label, .comm, or .lcomm directive, and mark that the symbol
--- 6575,6580 ----
*************** mips_output_function_epilogue (file, siz
*** 7842,7856 ****
    for (string = mips16_strings; string != 0; string = XEXP (string, 1))
      SYMBOL_REF_FLAG (XEXP (string, 0)) = 0;
    free_EXPR_LIST_list (&mips16_strings);
- 
-   /* Restore the output file if optimizing the GP (optimizing the GP causes
-      the text to be diverted to a tempfile, so that data decls come before
-      references to the data).  */
-   if (TARGET_FILE_SWITCHING)
-     {
-       asm_out_file = asm_out_data_file;
-       data_section ();
-     }
  }
  
  /* Expand the epilogue into a bunch of separate insns.  SIBCALL_P is true
--- 7808,7813 ----
*************** iris6_asm_named_section (name, flags)
*** 10616,10623 ****
       const char *name;
       unsigned int flags;
  {
-   if (TARGET_FILE_SWITCHING && (flags & SECTION_CODE))
-     asm_out_file = asm_out_text_file;
    iris6_asm_named_section_1 (name, flags, 0);
  }
  
--- 10573,10578 ----
*************** iris6_asm_output_align (file, log)
*** 10684,10691 ****
  }
  
  /* The Iris assembler does not record alignment from .align directives,
!    but takes it from the first .section directive seen.  Play yet more
!    file switching games so that we can emit a .section directive at the
     beginning of the file with the proper alignment attached.  */
  
  void
--- 10639,10646 ----
  }
  
  /* The Iris assembler does not record alignment from .align directives,
!    but takes it from the first .section directive seen.  Play file
!    switching games so that we can emit a .section directive at the
     beginning of the file with the proper alignment attached.  */
  
  void
*************** iris6_asm_file_start (stream)
*** 10697,10705 ****
    iris_orig_asm_out_file = asm_out_file;
    stream = tmpfile ();
    asm_out_file = stream;
-   asm_out_data_file = stream;
-   if (! TARGET_FILE_SWITCHING)
-     asm_out_text_file = stream;
  
    iris_section_align_htab = htab_create (31, iris_section_align_entry_hash,
  					 iris_section_align_entry_eq, NULL);
--- 10652,10657 ----
*************** iris6_section_align_1 (slot, data)
*** 10715,10720 ****
--- 10667,10693 ----
  
    iris6_asm_named_section_1 (entry->name, entry->flags, 1 << entry->log);
    return 1;
+ }
+ 
+ static void
+ copy_file_data (to, from)
+      FILE *to, *from;
+ {
+   char buffer[8192];
+   size_t len;
+   rewind (from);
+   if (ferror (from))
+     fatal_error ("can't rewind temp file: %m");
+ 
+   while ((len = fread (buffer, 1, sizeof (buffer), from)) > 0)
+     if (fwrite (buffer, 1, len, to) != len)
+       fatal_error ("can't write to output file: %m");
+ 
+   if (ferror (from))
+     fatal_error ("can't read from temp file: %m");
+ 
+   if (fclose (from))
+     fatal_error ("can't close temp file: %m");
  }
  
  void


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