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: [PATCH] MIPS gas: More flexible $gp handling


Eric Christopher wrote:
> Thiemo,
> 
> > Uh, it would seem that should be "mostly updated."
> > 
> > Current binutils fails to compile:
> > 
> 
> Can you get this tonight or revert your patch? I'd like to avoid
> breakages.
> 
> Also, can you please build and test on mips-elf and mips64-elf with the
> changes that you wish to make before submitting? Thanks.

I believe this patch fixes it. Test build is currently running.


Thiemo


2002-05-30  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/gas/ChangeLog
	* config/tc-mips.c (load_address): Use mips_gp_register instead
	of hardcoded value. Remove dbl parameter, use HAVE_32BIT_ADDRESSES
	instead.
	(macro): Use mips_gp_register instead of hardcoded value.


--- /bigdisk/cvs/cygnus/src/gas/config/tc-mips.c	Thu May 30 15:44:25 2002
+++ /bigdisk/combined/source-orig/gas/config/tc-mips.c	Thu May 30 16:44:40 2002
@@ -3817,7 +3817,7 @@ load_address (counter, reg, ep, used_at)
 	 If there is a constant, it must be added in after.  */
       ex.X_add_number = ep->X_add_number;
       ep->X_add_number = 0;
-      if (reg_needs_delay (GP))
+      if (reg_needs_delay (mips_gp_register))
 	off = 4;
       else
 	off = 0;
@@ -3825,9 +3825,11 @@ load_address (counter, reg, ep, used_at)
       macro_build ((char *) NULL, counter, ep, "lui", "t,u", reg,
 		   (int) BFD_RELOC_MIPS_GOT_HI16);
       macro_build ((char *) NULL, counter, (expressionS *) NULL,
-		   dbl ? "daddu" : "addu", "d,v,t", reg, reg, GP);
-      macro_build ((char *) NULL, counter, ep, dbl ? "ld" : "lw",
-		   "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT_LO16, reg);
+		   HAVE_32BIT_ADDRESS ? "addu" : "daddu", "d,v,t", reg,
+		   reg, mips_gp_register);
+      macro_build ((char *) NULL, counter, ep,
+		   HAVE_32BIT_ADDRESS ? "lw" : "ld", "t,o(b)", reg,
+		   (int) BFD_RELOC_MIPS_GOT_LO16, reg);
       p = frag_var (rs_machine_dependent, 12 + off, 0,
 		    RELAX_ENCODE (12, 12 + off, off, 8 + off, 0,
 				  mips_opts.warn_about_macros),
@@ -3841,19 +3843,21 @@ load_address (counter, reg, ep, used_at)
 	  macro_build (p, counter, (expressionS *) NULL, "nop", "");
 	  p += 4;
 	}
-      macro_build (p, counter, ep, dbl ? "ld" : "lw",
-		   "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16, GP);
+      macro_build (p, counter, ep, HAVE_32BIT_ADDRESS ? "lw" : "ld",
+		   "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16,
+		   mips_gp_register);
       p += 4;
       macro_build (p, counter, (expressionS *) NULL, "nop", "");
       p += 4;
-      macro_build (p, counter, ep, dbl ? "daddiu" : "addiu",
+      macro_build (p, counter, ep, HAVE_32BIT_ADDRESS ? "addiu" : "daddiu",
 		   "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
       if (ex.X_add_number != 0)
 	{
 	  if (ex.X_add_number < -0x8000 || ex.X_add_number >= 0x8000)
 	    as_bad (_("PIC code offset overflow (max 16 signed bits)"));
 	  ex.X_op = O_constant;
-	  macro_build ((char *) NULL, counter, &ex, dbl ? "daddiu" : "addiu",
+	  macro_build ((char *) NULL, counter, &ex,
+		       HAVE_32BIT_ADDRESS ? "addiu" : "daddiu",
 		       "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
 	}
     }
@@ -4939,7 +4943,7 @@ macro (ip)
 	  expr1.X_add_number = offset_expr.X_add_number;
 	  offset_expr.X_add_number = 0;
 	  frag_grow (52);
-	  if (reg_needs_delay (GP))
+	  if (reg_needs_delay (mips_gp_register))
 	    gpdel = 4;
 	  else
 	    gpdel = 0;
@@ -5231,7 +5235,7 @@ macro (ip)
 	      macro_build ((char *) NULL, &icnt, &offset_expr,
 			   HAVE_32BIT_ADDRESSES ? "lw" : "ld",
 			   "t,o(b)", PIC_CALL_REG,
-			   (int) BFD_RELOC_MIPS_CALL16, GP);
+			   (int) BFD_RELOC_MIPS_CALL16, mips_gp_register);
 	      macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			   "nop", "");
 	      p = frag_var (rs_machine_dependent, 4, 0,
@@ -5242,7 +5246,7 @@ macro (ip)
 	    {
 	      int gpdel;
 
-	      if (reg_needs_delay (GP))
+	      if (reg_needs_delay (mips_gp_register))
 		gpdel = 4;
 	      else
 		gpdel = 0;
@@ -5250,7 +5254,8 @@ macro (ip)
 			   PIC_CALL_REG, (int) BFD_RELOC_MIPS_CALL_HI16);
 	      macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			   HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
-			   "d,v,t", PIC_CALL_REG, PIC_CALL_REG, GP);
+			   "d,v,t", PIC_CALL_REG, PIC_CALL_REG,
+			   mips_gp_register);
 	      macro_build ((char *) NULL, &icnt, &offset_expr,
 			   HAVE_32BIT_ADDRESSES ? "lw" : "ld",
 			   "t,o(b)", PIC_CALL_REG,
@@ -5269,7 +5274,7 @@ macro (ip)
 	      macro_build (p, &icnt, &offset_expr,
 			   HAVE_32BIT_ADDRESSES ? "lw" : "ld",
 			   "t,o(b)", PIC_CALL_REG,
-			   (int) BFD_RELOC_MIPS_GOT16, GP);
+			   (int) BFD_RELOC_MIPS_GOT16, mips_gp_register);
 	      p += 4;
 	      macro_build (p, &icnt, (expressionS *) NULL, "nop", "");
 	      p += 4;
@@ -5783,7 +5788,7 @@ macro (ip)
 	  if (expr1.X_add_number < -0x8000
 	      || expr1.X_add_number >= 0x8000)
 	    as_bad (_("PIC code offset overflow (max 16 signed bits)"));
-	  if (reg_needs_delay (GP))
+	  if (reg_needs_delay (mips_gp_register))
 	    gpdel = 4;
 	  else
 	    gpdel = 0;


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