This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: Old MIPS patch [drow@mvista.com: Re: Missing .cprestore warning]


On Wed, Jan 02, 2002 at 12:35:41AM -0800, Eric Christopher wrote:
> 
> > These testcases all depend on the fact that mips_frame_reg defaults to
> > SP.
> > 
> 
> This is true in most cases, but not set in stone as far as I can
> remember.
> 
> > I can fix the testcases to set .frame explicitly; I think it would be a
> > good idea, and that the warning is legitimate.  What do you think?
> 
> I can't even find where the warning is coming from in my sources... but
> from the above it should be a fine change to make.

That's because it came from the patch at the beginning of this thread
:)

Here's the patch as I committed it.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-01-05  Daniel Jacobowitz  <drow@mvista.com>

        * tc-mips.c (mips_cprestore_valid): New flag.
        (mips_frame_reg_valid): New flag.
        (macro) [M_JAL_2]: Check both flags.
        [M_JAL_A]: Likewise.
        (s_cprestore): Set mips_cprestore_valid.
        (tc_get_register): If setting mips_frame_reg, set
        mips_frame_reg_valid and clear mips_cprestore_valid.
        (s_mips_ent): Clear both flags.
        (s_mips_end): Clear both flags.

2002-01-05  Daniel Jacobowitz  <drow@mvista.com>

        * gas/mips/jal-svr4pic.s: Add .ent and .frame directives.
        * gas/mips/mips-abi32-pic.s: Add .frame directive.
        * gas/mips/mips-gp32-fp32-pic.s: Likewise.
        * gas/mips/mips-gp32-fp64-pic.s: Likewise.
        * gas/mips/mips-gp64-fp32-pic.s: Likewise.
        * gas/mips/mips-gp64-fp64-pic.s: Likewise.

Index: gas/mips/jal-svr4pic.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/jal-svr4pic.s,v
retrieving revision 1.2
diff -p -u -r1.2 jal-svr4pic.s
--- jal-svr4pic.s	2000/05/11 01:55:11	1.2
+++ jal-svr4pic.s	2002/01/05 19:01:33
@@ -2,7 +2,9 @@
 	
 .weak weak_text_label
 
+	.ent text_label
 text_label:	
+	.frame $sp,0,$31
 	.set	noreorder
 	.cpload	$25
 	.set	reorder
@@ -19,3 +21,5 @@ text_label:	
 # Round to a 16 byte boundary, for ease in testing multiple targets.
 	nop
 	nop
+
+	.end text_label
Index: gas/mips/mips-abi32-pic.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips-abi32-pic.s,v
retrieving revision 1.4
diff -p -u -r1.4 mips-abi32-pic.s
--- mips-abi32-pic.s	2001/10/24 20:12:36	1.4
+++ mips-abi32-pic.s	2002/01/05 19:01:33
@@ -12,6 +12,7 @@ unshared:
 	.text
 	.ent	func
 func:
+	.frame $sp,0,$31
 	.set noreorder
 	.cpload $25		# 0000 lui	gp,hi(_gp_disp)
 				# 0004 addiu	gp,gp,lo(_gp_disp)
Index: gas/mips/mips-gp32-fp32-pic.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips-gp32-fp32-pic.s,v
retrieving revision 1.4
diff -p -u -r1.4 mips-gp32-fp32-pic.s
--- mips-gp32-fp32-pic.s	2001/10/24 20:12:36	1.4
+++ mips-gp32-fp32-pic.s	2002/01/05 19:01:33
@@ -12,6 +12,7 @@ unshared:
 	.text
 	.ent	func
 func:
+	.frame $sp,0,$31
 	.set noreorder
 	.cpload $25		# 0000 lui	gp,hi(_gp_disp)
 				# 0004 addiu	gp,gp,lo(_gp_disp)
Index: gas/mips/mips-gp32-fp64-pic.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips-gp32-fp64-pic.s,v
retrieving revision 1.4
diff -p -u -r1.4 mips-gp32-fp64-pic.s
--- mips-gp32-fp64-pic.s	2001/10/24 20:12:36	1.4
+++ mips-gp32-fp64-pic.s	2002/01/05 19:01:33
@@ -12,6 +12,7 @@ unshared:
 	.text
 	.ent	func
 func:
+	.frame $sp,0,$31
 	.set noreorder
 	.cpload $25		# 0000 lui	gp,hi(_gp_disp)
 				# 0004 addiu	gp,gp,lo(_gp_disp)
Index: gas/mips/mips-gp64-fp32-pic.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips-gp64-fp32-pic.s,v
retrieving revision 1.5
diff -p -u -r1.5 mips-gp64-fp32-pic.s
--- mips-gp64-fp32-pic.s	2001/10/24 20:12:36	1.5
+++ mips-gp64-fp32-pic.s	2002/01/05 19:01:33
@@ -12,6 +12,7 @@ unshared:
 	.text
 	.ent	func
 func:
+	.frame $sp,0,$31
 	.set noreorder
 	.cpload $25		# 0000 lui	gp,hi(_gp_disp)
 				# 0004 addiu	gp,gp,lo(_gp_disp)
Index: gas/mips/mips-gp64-fp64-pic.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/mips/mips-gp64-fp64-pic.s,v
retrieving revision 1.5
diff -p -u -r1.5 mips-gp64-fp64-pic.s
--- mips-gp64-fp64-pic.s	2001/10/24 20:12:36	1.5
+++ mips-gp64-fp64-pic.s	2002/01/05 19:01:33
@@ -12,6 +12,7 @@ unshared:
 	.text
 	.ent	func
 func:
+	.frame $sp,0,$31
 	.set noreorder
 	.cpload $25		# 0000 lui	gp,hi(_gp_disp)
 				# 0004 addiu	gp,gp,lo(_gp_disp)
Index: config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.103
diff -u -r1.103 tc-mips.c
--- tc-mips.c	2001/12/20 21:11:26	1.103
+++ tc-mips.c	2002/01/05 19:04:27
@@ -412,10 +412,18 @@
 static int mips_cpreturn_register = -1;
 static int mips_gp_register = GP;
 
+/* Whether mips_cprestore_offset has been set in the current function
+   (or whether it has already been warned about, if not).  */
+static int mips_cprestore_valid = 0;
+
 /* This is the register which holds the stack frame, as set by the
    .frame pseudo-op.  This is needed to implement .cprestore.  */
 static int mips_frame_reg = SP;
 
+/* Whether mips_frame_reg has been set in the current function
+   (or whether it has already been warned about, if not).  */
+static int mips_frame_reg_valid = 0;
+
 /* To output NOP instructions correctly, we need to keep information
    about the previous two instructions.  */
 
@@ -5110,6 +5118,18 @@
 		as_warn (_("No .cprestore pseudo-op used in PIC code"));
 	      else
 		{
+		  if (! mips_frame_reg_valid)
+		    {
+		      as_warn (_("No .frame pseudo-op used in PIC code"));
+		      /* Quiet this warning.  */
+		      mips_frame_reg_valid = 1;
+		    }
+		  if (! mips_cprestore_valid)
+		    {
+		      as_warn (_("No .cprestore pseudo-op used in PIC code"));
+		      /* Quiet this warning.  */
+		      mips_cprestore_valid = 1;
+		    }
 		  expr1.X_add_number = mips_cprestore_offset;
 		  macro_build ((char *) NULL, &icnt, &expr1,
 			       HAVE_32BIT_ADDRESSES ? "lw" : "ld", "t,o(b)",
@@ -5211,6 +5231,18 @@
 		as_warn (_("No .cprestore pseudo-op used in PIC code"));
 	      else
 		{
+		  if (! mips_frame_reg_valid)
+		    {
+		      as_warn (_("No .frame pseudo-op used in PIC code"));
+		      /* Quiet this warning.  */
+		      mips_frame_reg_valid = 1;
+		    }
+		  if (! mips_cprestore_valid)
+		    {
+		      as_warn (_("No .cprestore pseudo-op used in PIC code"));
+		      /* Quiet this warning.  */
+		      mips_cprestore_valid = 1;
+		    }
 		  if (mips_opts.noreorder)
 		    macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			     "nop", "");
@@ -11472,6 +11504,7 @@
     }
 
   mips_cprestore_offset = get_absolute_expression ();
+  mips_cprestore_valid = 1;
 
   ex.X_op = O_constant;
   ex.X_add_symbol = NULL;
@@ -11738,7 +11771,11 @@
       input_line_pointer += 2;
     }
   if (frame)
-    mips_frame_reg = reg != 0 ? reg : SP;
+    {
+      mips_frame_reg = reg != 0 ? reg : SP;
+      mips_frame_reg_valid = 1;
+      mips_cprestore_valid = 0;
+    }
   return reg;
 }
 
@@ -12806,6 +12843,10 @@
   symbolS *p;
   int maybe_text;
 
+  /* Following functions need their own .frame and .cprestore directives.  */
+  mips_frame_reg_valid = 0;
+  mips_cprestore_valid = 0;
+
   if (!is_end_of_line[(unsigned char) *input_line_pointer])
     {
       p = get_symbol ();
@@ -12923,6 +12964,10 @@
 
   if (!aent)
     {
+      /* This function needs its own .frame and .cprestore directives.  */
+      mips_frame_reg_valid = 0;
+      mips_cprestore_valid = 0;
+
       cur_proc_ptr = &cur_proc;
       memset (cur_proc_ptr, '\0', sizeof (procS));
 


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