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: PowerPC-sysV/eabi, harmonization of section attribute and small data optimization


The previous patch was incomplete (a fix is also required in sysv4.h).

-----------------------------------------------------------
ChangeLog entry:

2003-02-18 Thierry Moreau <thierry.moreau@connotech.com>

* config/rs6000/rs6000.c and config/rs6000/sysv4.h: PowerPC- sysV/eabi,
harmonization of section attribute and small data optimization
-----------------------------------------------------------



--

- Thierry Moreau

CONNOTECH Experts-conseils inc.
9130 Place de Montgolfier
Montreal, Qc
H2M 2A1

Tel.: (514)385-5691
Fax:  (514)385-5900

e-mail: thierry.moreau@connotech.com

*** ../../../../gcc-3.2.2-orig/gcc/config/rs6000/sysv4.h	Thu Jan 30 09:03:42 2003
--- sysv4.h	Tue Feb 18 08:25:46 2003
*************** do {									\
*** 873,879 ****
  #define	ASM_OUTPUT_LABELREF(FILE,NAME)		\
  do {						\
    const char *_name = NAME;			\
!   if (*_name == '@')				\
      _name++;					\
   						\
    if (*_name == '*')				\
--- 873,879 ----
  #define	ASM_OUTPUT_LABELREF(FILE,NAME)		\
  do {						\
    const char *_name = NAME;			\
!   while (*_name == '@')				\
      _name++;					\
   						\
    if (*_name == '*')				\
*** ../../../../gcc-3.2.2-orig/gcc/config/rs6000/rs6000.c	Thu Jan 23 17:19:42 2003
--- rs6000.c	Mon Feb 17 08:55:31 2003
*************** small_data_operand (op, mode)
*** 1679,1691 ****
        rtx sum = XEXP (op, 0);
        HOST_WIDE_INT summand;
  
-       /* We have to be careful here, because it is the referenced address
-         that must be 32k from _SDA_BASE_, not just the symbol.  */
        summand = INTVAL (XEXP (sum, 1));
!       if (summand < 0 || summand > g_switch_value)
         return 0;
  
        sym_ref = XEXP (sum, 0);
      }
  
    if (*XSTR (sym_ref, 0) != '@')
--- 1679,1697 ----
        rtx sum = XEXP (op, 0);
        HOST_WIDE_INT summand;
  
        summand = INTVAL (XEXP (sum, 1));
!       if (summand < 0)
         return 0;
  
        sym_ref = XEXP (sum, 0);
+       /* We have to be careful here, because it is the referenced address
+         that must be 32k from _SDA_BASE_, not just the symbol,
+ 			e.g. as in int x[4]; x[25000-x]; -- the instruction referenced
+ 			address is x+100000.
+         Do not apply this test to objects explicitly allocated to a small section,
+ 			the g_switch _value does not apply to them. */
+       if ( XSTR (sym_ref, 0)[1] != '@' && summand > g_switch_value )
+        return 0;
      }
  
    if (*XSTR (sym_ref, 0) != '@')
*************** rs6000_encode_section_info (decl)
*** 11033,11060 ****
  	    abort ();
  	}
  
!       if ((size > 0 && size <= g_switch_value)
! 	  || (name
! 	      && ((len == sizeof (".sdata") - 1
  		   && strcmp (name, ".sdata") == 0)
! 		  || (len == sizeof (".sdata2") - 1
  		      && strcmp (name, ".sdata2") == 0)
! 		  || (len == sizeof (".sbss") - 1
  		      && strcmp (name, ".sbss") == 0)
! 		  || (len == sizeof (".sbss2") - 1
  		      && strcmp (name, ".sbss2") == 0)
! 		  || (len == sizeof (".PPC.EMB.sdata0") - 1
  		      && strcmp (name, ".PPC.EMB.sdata0") == 0)
! 		  || (len == sizeof (".PPC.EMB.sbss0") - 1
! 		      && strcmp (name, ".PPC.EMB.sbss0") == 0))))
  	{
  	  rtx sym_ref = XEXP (DECL_RTL (decl), 0);
  	  size_t len = strlen (XSTR (sym_ref, 0));
! 	  char *str = alloca (len + 2);
  
  	  str[0] = '@';
! 	  memcpy (str + 1, XSTR (sym_ref, 0), len + 1);
! 	  XSTR (sym_ref, 0) = ggc_alloc_string (str, len + 1);
  	}
      }
  }
--- 11039,11068 ----
  	    abort ();
  	}
  
!       if (name?
! 		   ((len == sizeof (".sdata")
  		   && strcmp (name, ".sdata") == 0)
! 		  || (len == sizeof (".sdata2")
  		      && strcmp (name, ".sdata2") == 0)
! 		  || (len == sizeof (".sbss")
  		      && strcmp (name, ".sbss") == 0)
! 		  || (len == sizeof (".sbss2")
  		      && strcmp (name, ".sbss2") == 0)
! 		  || (len == sizeof (".PPC.EMB.sdata0")
  		      && strcmp (name, ".PPC.EMB.sdata0") == 0)
! 		  || (len == sizeof (".PPC.EMB.sbss0")
! 		      && strcmp (name, ".PPC.EMB.sbss0") == 0))
! 		   :(size > 0 && size <= g_switch_value))
  	{
  	  rtx sym_ref = XEXP (DECL_RTL (decl), 0);
  	  size_t len = strlen (XSTR (sym_ref, 0));
! 	  char *str = alloca (len + 3);
  
  	  str[0] = '@';
!      if (name)
!        str[1] = '@';
! 	  memcpy (str + 1 +(name!=NULL), XSTR (sym_ref, 0), len + 1);
! 	  XSTR (sym_ref, 0) = ggc_alloc_string (str, len + 1 +(name!=NULL));
  	}
      }
  }

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