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]

Re: mips address splitting breaks named section support



I've updated this patch to only set SYMBOL_REF_FLAG if the named
section is .sdata or .sbss (which, from looking at gas, to be the
only gp addressable sections).

OK now?

	* mips/mips.h (ENCODE_SECTION_INFO): Set SYMBOL_REF_FLAG for
	VAR_DECL's in gp addressable sections.

Index: mips.h
===================================================================
***************
*** 3123,3130 ****
     constants which are put in the .text section.  We also record the
     total length of all such strings; this total is used to decide
     whether we need to split the constant table, and need not be
!    precisely correct.  */
  
  #define ENCODE_SECTION_INFO(DECL)					\
  do									\
    {									\
--- 3123,3136 ----
     constants which are put in the .text section.  We also record the
     total length of all such strings; this total is used to decide
     whether we need to split the constant table, and need not be
!    precisely correct. 
  
+    When not mips16 code nor embedded PIC, if a symbol is in a
+    gp addresable section, SYMBOL_REF_FLAG is set prevent gcc from
+    splitting the reference so that gas can generate a gp relative
+    reference.
+  */
+ 
  #define ENCODE_SECTION_INFO(DECL)					\
  do									\
    {									\
***************
*** 3148,3153 ****
--- 3154,3169 ----
  	  SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 0;		\
          else								\
  	  SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1;		\
+       }									\
+ 									\
+     else if (TREE_CODE (DECL) == VAR_DECL				\
+              && DECL_SECTION_NAME (DECL) != NULL_TREE                   \
+              && (0 == strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (DECL)), \
+                               ".sdata")                                 \
+                 || 0 == strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (DECL)),\
+                               ".sbss")))                                \
+       {									\
+         SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;		\
        }									\
  									\
      else if (TARGET_GP_OPT && TREE_CODE (DECL) == VAR_DECL)		\


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