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]

Fix mips_in_small_data_p for -mabicalls


This patch fixes an oversight in mips_in_small_data_p.  If you use
__attribute__((section)) to put a variable into .sdata, gcc would
expect gas to use small data references even for the combination
-mabicalls -mno-explicit-relocs.  This meant that loads from small
data were incorrectly treated as being suitable for delay slots.

Although we could continue using %gp_rel() for -mexplicit-relocs, it
needs some thought, and should only really be done as part of a
concerted attempt to make -G work for this combination.  At a minimum,
we should check whether the symbol binds locally.

Bootstrapped and regression tested on mips-sgi-irix6.5.  Applied to
HEAD and 3.4 (since it's a regression).

Richard


	* config/mips/mips.c (mips_in_small_data_p): Return false if
	TARGET_ABICALLS.

testsuite/
	* gcc.dg/torture/mips-sdata-1.c: Restrict to mips*-*-elf*.

Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.362.4.10
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.362.4.10 mips.c
*** config/mips/mips.c	19 Feb 2004 22:56:11 -0000	1.362.4.10
--- config/mips/mips.c	6 Mar 2004 20:31:46 -0000
*************** mips_in_small_data_p (tree decl)
*** 7344,7349 ****
--- 7344,7354 ----
    if (TREE_CODE (decl) == STRING_CST || TREE_CODE (decl) == FUNCTION_DECL)
      return false;
  
+   /* We don't yet generate small-data references for -mabicalls.  See related
+      -G handling in override_options.  */
+   if (TARGET_ABICALLS)
+     return false;
+ 
    if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl) != 0)
      {
        const char *name;
Index: testsuite/gcc.dg/torture/mips-sdata-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/torture/mips-sdata-1.c,v
retrieving revision 1.2
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 mips-sdata-1.c
*** testsuite/gcc.dg/torture/mips-sdata-1.c	28 Sep 2003 07:38:14 -0000	1.2
--- testsuite/gcc.dg/torture/mips-sdata-1.c	6 Mar 2004 20:31:46 -0000
***************
*** 1,6 ****
  /* Check that sdata-accesses are applied regardless of size or ABI.  */
  /* { dg-options -mexplicit-relocs } */
! /* { dg-do compile { target mips*-*-* } } */
  
  struct s { int x[4]; };
  struct s my_struct __attribute__((__section__(".sdata")));
--- 1,6 ----
  /* Check that sdata-accesses are applied regardless of size or ABI.  */
  /* { dg-options -mexplicit-relocs } */
! /* { dg-do compile { target mips*-*-elf* } } */
  
  struct s { int x[4]; };
  struct s my_struct __attribute__((__section__(".sdata")));


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