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]

mips/{elf64.h,mips.c,mips.h} patch


I have checked in this patch.

The first part fixes an inconsistency from the Apr 7 elf.h change.  The change
should have gone into elf.h and elf64.h at the same time.

The second part fixes a mips16 multilib libstdc++ build failure.  We get
assembler error messages complaining about PC-relative accesses to a
different section.  This occurs because templates go into gnulinkonce sections
instead of text (as a result of the above change), but some other stuff was
still being put in text giving us cross-section references where we did not
want them.  The patch fixes this by putting the constant pool in the same
section as the function, and indirecting through the constant pool to reach
shared strings in the text section.

Fri May  7 12:38:54 1999  Jim Wilson  <wilson@cygnus.com>

	* mips/elf64.h (MAKE_DECL_ONE_ONLY, UNIQUE_SECTION_P): Define.
	* mips/mips.c (mips_select_rtx_section): When TARGET_MIPS16, use
	function_section instead of text_section.
	* mips/mips.h (ENCODE_SECTION_INFO): Add check for UNIQUE_SECTION_P
	in TARGET_MIPS16 STRING_CST handling.

Index: elf64.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/mips/elf64.h,v
retrieving revision 1.10
diff -p -r1.10 elf64.h
*** elf64.h	1999/04/14 10:46:44	1.10
--- elf64.h	1999/05/07 19:38:09
*************** do {									 \
*** 195,200 ****
--- 195,202 ----
    fputc ('\n', FILE);				\
   } while (0)
  
+ #define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+ #define UNIQUE_SECTION_P(DECL) (DECL_ONE_ONLY (DECL))
  #define UNIQUE_SECTION(DECL,RELOC)					   \
  do {									   \
    int len, size, sec;							   \
Index: mips.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/mips/mips.c,v
retrieving revision 1.55
diff -p -r1.55 mips.c
*** mips.c	1999/03/18 05:32:31	1.55
--- mips.c	1999/05/07 19:38:10
*************** mips_select_rtx_section (mode, x)
*** 6884,6893 ****
  {
    if (TARGET_MIPS16)
      {
!       /* In mips16 mode, the constant table always goes in the .text
!          section, so that constants can be loaded using PC relative
           addressing.  */
!       text_section ();
      }
    else if (TARGET_EMBEDDED_DATA)
      {
--- 6884,6893 ----
  {
    if (TARGET_MIPS16)
      {
!       /* In mips16 mode, the constant table always goes in the same section
!          as the function, so that constants can be loaded using PC relative
           addressing.  */
!       function_section (current_function_decl);
      }
    else if (TARGET_EMBEDDED_DATA)
      {
Index: mips.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/mips/mips.h,v
retrieving revision 1.52
diff -p -r1.52 mips.h
*** mips.h	1999/05/03 13:18:01	1.52
--- mips.h	1999/05/07 19:38:10
*************** do									\
*** 3168,3174 ****
      if (TARGET_MIPS16)							\
        {									\
  	if (TREE_CODE (DECL) == STRING_CST				\
! 	    && ! flag_writable_strings)					\
  	  {								\
  	    SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1;	\
  	    mips_string_length += TREE_STRING_LENGTH (DECL);		\
--- 3168,3187 ----
      if (TARGET_MIPS16)							\
        {									\
  	if (TREE_CODE (DECL) == STRING_CST				\
! 	    && ! flag_writable_strings					\
! 	    /* If this string is from a function, and the function will	\
! 	       go in a gnu linkonce section, then we can't directly	\
! 	       access the string.  This gets an assembler error		\
! 	       "unsupported PC relative reference to different section".\
! 	       If we modify SELECT_SECTION to put it in function_section\
! 	       instead of text_section, it still fails because		\
! 	       DECL_SECTION_NAME isn't set until assemble_start_function.\
! 	       If we fix that, it still fails because strings are shared\
! 	       among multiple functions, and we have cross section	\
! 	       references again.  We force it to work by putting string	\
! 	       addresses in the constant pool and indirecting.  */	\
! 	    && (! current_function_decl					\
! 		|| ! UNIQUE_SECTION_P (current_function_decl)))		\
  	  {								\
  	    SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1;	\
  	    mips_string_length += TREE_STRING_LENGTH (DECL);		\


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