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]

Re: Patch for gcc 3.3.x Bug#13617


"Sergey M. Samoylov" <ssamoylov@dev.rtsoft.ru> writes:
> Richard  I've rewrited this patch with every comments which you gave me.
> So here it is.

Thanks for the update.  The new patch still had one or two problems:
it was still using an ISO prototype for mips_output_aligned_decl_common
and had various small formatting glitches.  I fixed those and bootstrapped
& regression tested on mips-sgi-irix6.5 and mips-sgi-irix6.5o32 (in both
cases using MIPSpro tools).  There were no regressions.

Gaby, is this OK for 3.3?

Richard


2004-11-10  Sergey M. Samoylov  <ssamoylov@dev.rtsoft.ru>

	Backport:
	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.

Index: config/mips/mips-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips-protos.h,v
retrieving revision 1.30.4.1
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.30.4.1 mips-protos.h
*** config/mips/mips-protos.h	31 Jan 2003 23:51:22 -0000	1.30.4.1
--- config/mips/mips-protos.h	9 Nov 2004 11:43:40 -0000
*************** extern void		iris6_asm_output_align PARA
*** 36,44 ****
  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 *,
! 						     const char *,
! 						     const char *, int));
  extern void		mips_expand_epilogue PARAMS ((void));
  extern void		mips_expand_prologue PARAMS ((void));
  extern void		mips_output_filename PARAMS ((FILE *, const char *));
--- 36,48 ----
  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_output_aligned_decl_common
! 				PARAMS ((FILE *, tree, const char *,
! 					 unsigned HOST_WIDE_INT,
! 					 unsigned int));
! extern void		mips_declare_object
! 				PARAMS ((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: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.241.2.4
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.241.2.4 mips.c
*** config/mips/mips.c	27 Jun 2003 11:44:23 -0000	1.241.2.4
--- config/mips/mips.c	9 Nov 2004 11:43:50 -0000
*************** copy_file_data (to, from)
*** 6562,6587 ****
      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.  */
  
  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;
  {
!   fputs (init_string, stream);		/* "", "\t.comm\t", or "\t.lcomm\t" */
    assemble_name (stream, name);
!   fprintf (stream, final_string, size);	/* ":\n", ",%u\n", ",%u\n" */
  
    if (TARGET_GP_OPT)
      {
        tree name_tree = get_identifier (name);
        TREE_ASM_WRITTEN (name_tree) = 1;
      }
  }
  
  /* Return the bytes needed to compute the frame pointer from the current
--- 6562,6645 ----
      fatal_io_error ("can't close temp file");
  }
  
! /* 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 (stream, decl, name, size, align)
       FILE *stream;
+      tree decl;
       const char *name;
!      unsigned HOST_WIDE_INT size;
!      unsigned int align;
  {
!   const char *format;
! 
!   /* 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));
! 
!       format = ACONCAT ((":\n\t.space\t", HOST_WIDE_INT_PRINT_UNSIGNED,
! 			 "\n", NULL));
!       mips_declare_object (stream, name, "", format, size);
!     }
! #ifdef TARGET_IRIX6
!     /* The SGI o32 assembler doesn't accept an alignment, so round up
!        the size instead.  */
!   else if (mips_abi == ABI_32 && !TARGET_GAS)
!     {
!       size += (align / BITS_PER_UNIT) - 1;
!       size -= size % (align / BITS_PER_UNIT);
!       format = ACONCAT ((",", HOST_WIDE_INT_PRINT_UNSIGNED, "\n", NULL));
!       mips_declare_object (stream, name, "\n\t.comm\t", format, size);
!     }
! #endif
!   else
!     {
!       format = ACONCAT ((",", HOST_WIDE_INT_PRINT_UNSIGNED, ",%u\n", NULL));
!       mips_declare_object (stream, name, "\n\t.comm\t", format,
! 			   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 VPARAMS ((FILE *stream, const char *name,
! 			      const char *init_string,
! 			      const char *final_string, ...))
! {
!   VA_OPEN (ap, final_string);
!   VA_FIXEDARG (ap, FILE *, stream);
!   VA_FIXEDARG (ap, const char *, name);
!   VA_FIXEDARG (ap, const char *, init_string);
!   VA_FIXEDARG (ap, const char *, final_string);
! 
!   fputs (init_string, stream);
    assemble_name (stream, name);
!   vfprintf (stream, final_string, ap);
  
    if (TARGET_GP_OPT)
      {
        tree name_tree = get_identifier (name);
        TREE_ASM_WRITTEN (name_tree) = 1;
      }
+ 
+   VA_CLOSE (ap);
  }
  
  /* Return the bytes needed to compute the frame pointer from the current


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