[PATCH] MIPS gas: More flexible $gp handling

Thiemo Seufer ica2_ts@csv.ica.uni-stuttgart.de
Tue May 28 11:18:00 GMT 2002


Richard Sandiford wrote:
> Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> writes:
> > 	(load_address): Use mips_gp_register instead of hardcoded value. Use
> > 	dbl instead of HAVE_32BIT_ADDRESSES to check for 64 bit expansions.
> 
> Why do it this way, instead of removing the dbl argument entirely?

Good point. I updated my patch accordingly.


Thiemo


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

	/gas/ChangeLog
	* config/tc-mips.c: Replace GP in comments by $gp.
	(mips_big_got): Initialize.
	(mips_trap): Initialize.
	(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.
	(macro2): Change load_address calls.
	(md_pcrel_from): Comment formatting.
	(s_cpload): Use mips_gp_register instead of hardcoded value.
	(s_cprestore): Likewise. Comment formatting.
	(s_gpword): Fix data type.
	(s_cpadd): Use mips_gp_register instead of hardcoded value.
	(nopic_need_relax): Replace GP in comments by $gp.
	(mips_elf_final_processing): Better comment.


diff -BurpNX /bigdisk/src/binutils-exclude source-orig/gas/config/tc-mips.c source/gas/config/tc-mips.c
--- source-orig/gas/config/tc-mips.c	Mon May 27 17:31:07 2002
+++ source/gas/config/tc-mips.c	Mon May 27 20:05:20 2002
@@ -326,13 +340,13 @@ static enum mips_pic_level mips_pic;
 /* Warn about all NOPS that the assembler generates.  */
 static int warn_nops = 0;
 
-/* 1 if we should generate 32 bit offsets from the GP register in
+/* 1 if we should generate 32 bit offsets from the $gp register in
    SVR4_PIC mode.  Currently has no meaning in other modes.  */
-static int mips_big_got;
+static int mips_big_got = 0;
 
 /* 1 if trap instructions should used for overflow rather than break
    instructions.  */
-static int mips_trap;
+static int mips_trap = 0;
 
 /* 1 if double width floating point constants should not be constructed
    by assembling two single width halves into two single width floating
@@ -696,7 +711,7 @@ static void macro_build ();
 static void check_absolute_expr PARAMS ((struct mips_cl_insn * ip,
 					 expressionS *));
 static void load_register PARAMS ((int *, int, expressionS *, int));
-static void load_address PARAMS ((int *, int, expressionS *, int, int *));
+static void load_address PARAMS ((int *, int, expressionS *, int *));
 static void move_register PARAMS ((int *, int, int));
 static void macro PARAMS ((struct mips_cl_insn * ip));
 static void mips16_macro PARAMS ((struct mips_cl_insn * ip));
@@ -3660,11 +3702,10 @@ load_register (counter, reg, ep, dbl)
 /* Load an address into a register.  */
 
 static void
-load_address (counter, reg, ep, dbl, used_at)
+load_address (counter, reg, ep, used_at)
      int *counter;
      int reg;
      expressionS *ep;
-     int dbl;
      int *used_at;
 {
   char *p = NULL;
@@ -3678,7 +3719,7 @@ load_address (counter, reg, ep, dbl, use
 
   if (ep->X_op == O_constant)
     {
-      load_register (counter, reg, ep, dbl);
+      load_register (counter, reg, ep, HAVE_64BIT_ADDRESSES);
       return;
     }
 
@@ -3708,7 +3749,7 @@ load_address (counter, reg, ep, dbl, use
 	   dsll		$reg,16
 	   daddiu	$reg,<sym>		(BFD_RELOC_LO16)
        */
-      if (dbl)
+      if (HAVE_64BIT_ADDRESSES)
 	{
 	  /* We don't do GP optimization for now because RELAX_ENCODE can't
 	     hold the data for such large chunks.  */
@@ -3752,8 +3793,8 @@ load_address (counter, reg, ep, dbl, use
 	    {
 	      frag_grow (20);
 	      macro_build ((char *) NULL, counter, ep,
-			   dbl ? "daddiu" : "addiu", "t,r,j", reg, GP,
-			   (int) BFD_RELOC_GPREL16);
+			   HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu", "t,r,j",
+			   reg, mips_gp_register, (int) BFD_RELOC_GPREL16);
 	      p = frag_var (rs_machine_dependent, 8, 0,
 			    RELAX_ENCODE (4, 8, 0, 4, 0,
 					  mips_opts.warn_about_macros),
@@ -3762,7 +3803,8 @@ load_address (counter, reg, ep, dbl, use
 	  macro_build_lui (p, counter, ep, reg);
 	  if (p != NULL)
 	    p += 4;
-	  macro_build (p, counter, ep, dbl ? "daddiu" : "addiu",
+	  macro_build (p, counter, ep,
+		       HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu",
 		       "t,r,j", reg, reg, (int) BFD_RELOC_LO16);
 	}
     }
@@ -3781,8 +3823,8 @@ load_address (counter, reg, ep, dbl, use
       ep->X_add_number = 0;
       frag_grow (20);
       macro_build ((char *) NULL, counter, ep,
-		   HAVE_32BIT_ADDRESSES ? "lw" : "ld",
-		   "t,o(b)", reg, (int) BFD_RELOC_MIPS_GOT16, GP);
+		   HAVE_32BIT_ADDRESSES ? "lw" : "ld", "t,o(b)",
+		   reg, (int) BFD_RELOC_MIPS_GOT16, mips_gp_register);
       macro_build ((char *) NULL, counter, (expressionS *) NULL, "nop", "");
       p = frag_var (rs_machine_dependent, 4, 0,
 		    RELAX_ENCODE (0, 4, -8, 0, 0, mips_opts.warn_about_macros),
@@ -3861,9 +3923,10 @@ load_address (counter, reg, ep, dbl, use
     {
       /* We always do
 	   addiu	$reg,$gp,<sym>		(BFD_RELOC_GPREL16)
-	 */
-      macro_build ((char *) NULL, counter, ep, dbl ? "daddiu" : "addiu",
-		   "t,r,j", reg, GP, (int) BFD_RELOC_GPREL16);
+       */
+      macro_build ((char *) NULL, counter, ep,
+		   HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu",
+		   "t,r,j", reg, mips_gp_register, (int) BFD_RELOC_GPREL16);
     }
   else
     abort ();
@@ -4744,7 +4807,8 @@ macro (ip)
 		{
 		  frag_grow (20);
 		  macro_build ((char *) NULL, &icnt, &offset_expr, "addiu",
-			       "t,r,j", tempreg, GP, (int) BFD_RELOC_GPREL16);
+			       "t,r,j", tempreg, mips_gp_register,
+			       (int) BFD_RELOC_GPREL16);
 		  p = frag_var (rs_machine_dependent, 8, 0,
 				RELAX_ENCODE (4, 8, 0, 4, 0,
 					      mips_opts.warn_about_macros),
@@ -4796,7 +4860,7 @@ macro (ip)
 	    lw_reloc_type = (int) BFD_RELOC_MIPS_CALL16;
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
-		       "t,o(b)", tempreg, lw_reloc_type, GP);
+		       "t,o(b)", tempreg, lw_reloc_type, mips_gp_register);
 	  if (expr1.X_add_number == 0)
 	    {
 	      int off;
@@ -4950,7 +5039,7 @@ macro (ip)
 		       tempreg, lui_reloc_type);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		       HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
-		       "d,v,t", tempreg, tempreg, GP);
+		       "d,v,t", tempreg, tempreg, mips_gp_register);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
 		       "t,o(b)", tempreg, lw_reloc_type, tempreg);
@@ -5056,7 +5145,8 @@ macro (ip)
 	    }
 	  macro_build (p, &icnt, &offset_expr,
 		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
-		       "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16, GP);
+		       "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16,
+		       mips_gp_register);
 	  p += 4;
 	  if (expr1.X_add_number >= -0x8000
 	      && expr1.X_add_number < 0x8000)
@@ -5109,8 +5199,8 @@ macro (ip)
 	       addiu	$tempreg,$gp,<sym>	(BFD_RELOC_GPREL16)
 	     */
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu",
-		       "t,r,j", tempreg, GP, (int) BFD_RELOC_GPREL16);
+		       HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu", "t,r,j",
+		       tempreg, mips_gp_register, (int) BFD_RELOC_GPREL16);
 	}
       else
 	abort ();
@@ -5182,7 +5272,8 @@ macro (ip)
 		  expr1.X_add_number = mips_cprestore_offset;
 		  macro_build ((char *) NULL, &icnt, &expr1,
 			       HAVE_32BIT_ADDRESSES ? "lw" : "ld", "t,o(b)",
-			       GP, (int) BFD_RELOC_LO16, mips_frame_reg);
+			       mips_gp_register, (int) BFD_RELOC_LO16,
+			       mips_frame_reg);
 		}
 	    }
 	}
@@ -5300,7 +5405,8 @@ macro (ip)
 		  expr1.X_add_number = mips_cprestore_offset;
 		  macro_build ((char *) NULL, &icnt, &expr1,
 			       HAVE_32BIT_ADDRESSES ? "lw" : "ld", "t,o(b)",
-			       GP, (int) BFD_RELOC_LO16, mips_frame_reg);
+			       mips_gp_register, (int) BFD_RELOC_LO16,
+			       mips_frame_reg);
 		}
 	    }
 	}
@@ -5663,7 +5759,8 @@ macro (ip)
 		{
 		  frag_grow (20);
 		  macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt,
-			       treg, (int) BFD_RELOC_GPREL16, GP);
+			       treg, (int) BFD_RELOC_GPREL16,
+			       mips_gp_register);
 		  p = frag_var (rs_machine_dependent, 8, 0,
 				RELAX_ENCODE (4, 8, 0, 4, 0,
 					      (mips_opts.warn_about_macros
@@ -5688,7 +5785,7 @@ macro (ip)
 		  frag_grow (28);
 		  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			       HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
-			       "d,v,t", tempreg, breg, GP);
+			       "d,v,t", tempreg, breg, mips_gp_register);
 		  macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt,
 			       treg, (int) BFD_RELOC_GPREL16, tempreg);
 		  p = frag_var (rs_machine_dependent, 12, 0,
@@ -5734,8 +5831,8 @@ macro (ip)
 	    as_bad (_("PIC code offset overflow (max 16 signed bits)"));
 	  frag_grow (20);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
-		       "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16, GP);
+		       HAVE_32BIT_ADDRESSES ? "lw" : "ld", "t,o(b)", tempreg,
+		       (int) BFD_RELOC_MIPS_GOT16, mips_gp_register);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "");
 	  p = frag_var (rs_machine_dependent, 4, 0,
 			RELAX_ENCODE (0, 4, -8, 0, 0, 0),
@@ -5786,7 +5911,7 @@ macro (ip)
 		       tempreg, (int) BFD_RELOC_MIPS_GOT_HI16);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		       HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
-		       "d,v,t", tempreg, tempreg, GP);
+		       "d,v,t", tempreg, tempreg, mips_gp_register);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
 		       "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT_LO16,
@@ -5801,7 +5926,8 @@ macro (ip)
 	    }
 	  macro_build (p, &icnt, &offset_expr,
 		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
-		       "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16, GP);
+		       "t,o(b)", tempreg, (int) BFD_RELOC_MIPS_GOT16,
+		       mips_gp_register);
 	  p += 4;
 	  macro_build (p, &icnt, (expressionS *) NULL, "nop", "");
 	  p += 4;
@@ -5827,14 +5953,14 @@ macro (ip)
 	  if (breg == 0)
 	    {
 	      macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt,
-			   treg, (int) BFD_RELOC_GPREL16, GP);
+			   treg, (int) BFD_RELOC_GPREL16, mips_gp_register);
 	      used_at = 0;
 	    }
 	  else
 	    {
 	      macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			   HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
-			   "d,v,t", tempreg, breg, GP);
+			   "d,v,t", tempreg, breg, mips_gp_register);
 	      macro_build ((char *) NULL, &icnt, &offset_expr, s, fmt,
 			   treg, (int) BFD_RELOC_GPREL16, tempreg);
 	    }
@@ -5872,7 +5998,7 @@ macro (ip)
 			     ".lit4") == 0
 		  && offset_expr.X_add_number == 0);
 	  macro_build ((char *) NULL, &icnt, &offset_expr, "lwc1", "T,o(b)",
-		       treg, (int) BFD_RELOC_MIPS_LITERAL, GP);
+		       treg, (int) BFD_RELOC_MIPS_LITERAL, mips_gp_register);
 	  return;
 	}
 
@@ -5926,15 +6052,16 @@ macro (ip)
 	{
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
-		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP);
+		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16,
+		       mips_gp_register);
 	}
       else if (mips_pic == EMBEDDED_PIC)
 	{
 	  /* For embedded PIC we pick up the entire address off $gp in
 	     a single instruction.  */
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu",
-		       "t,r,j", AT, GP, (int) BFD_RELOC_GPREL16);
+		       HAVE_32BIT_ADDRESSES ? "addiu" : "daddiu", "t,r,j", AT,
+		       mips_gp_register, (int) BFD_RELOC_GPREL16);
 	  offset_expr.X_op = O_constant;
 	  offset_expr.X_add_number = 0;
 	}
@@ -6007,10 +6134,11 @@ macro (ip)
 	  if (mips_opts.isa != ISA_MIPS1)
 	    {
 	      macro_build ((char *) NULL, &icnt, &offset_expr, "ldc1",
-			   "T,o(b)", treg, (int) BFD_RELOC_MIPS_LITERAL, GP);
+			   "T,o(b)", treg, (int) BFD_RELOC_MIPS_LITERAL,
+			   mips_gp_register);
 	      return;
 	    }
-	  breg = GP;
+	  breg = mips_gp_register;
 	  r = BFD_RELOC_MIPS_LITERAL;
 	  goto dob;
 	}
@@ -6020,7 +6148,8 @@ macro (ip)
 	  if (mips_pic == SVR4_PIC)
 	    macro_build ((char *) NULL, &icnt, &offset_expr,
 			 HAVE_32BIT_ADDRESSES ? "lw" : "ld",
-			 "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP);
+			 "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16,
+			 mips_gp_register);
 	  else
 	    {
 	      /* FIXME: This won't work for a 64 bit address.  */
@@ -6195,7 +6324,7 @@ macro (ip)
 	      if (breg == 0)
 		{
 		  frag_grow (28);
-		  tempreg = GP;
+		  tempreg = mips_gp_register;
 		  off = 0;
 		  used_at = 0;
 		}
@@ -6204,7 +6333,7 @@ macro (ip)
 		  frag_grow (36);
 		  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			       HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
-			       "d,v,t", AT, breg, GP);
+			       "d,v,t", AT, breg, mips_gp_register);
 		  tempreg = AT;
 		  off = 4;
 		  used_at = 1;
@@ -6305,8 +6434,8 @@ macro (ip)
 	    off = 4;
 	  frag_grow (24 + off);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
-		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
-		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP);
+		       HAVE_32BIT_ADDRESSES ? "lw" : "ld", "t,o(b)", AT,
+		       (int) BFD_RELOC_MIPS_GOT16, mips_gp_register);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "nop", "");
 	  if (breg != 0)
 	    macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
@@ -6358,7 +6487,7 @@ macro (ip)
 	  if (expr1.X_add_number < -0x8000
 	      || expr1.X_add_number >= 0x8000 - 4)
 	    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;
@@ -6371,7 +6500,7 @@ macro (ip)
 		       AT, (int) BFD_RELOC_MIPS_GOT_HI16);
 	  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		       HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
-		       "d,v,t", AT, AT, GP);
+		       "d,v,t", AT, AT, mips_gp_register);
 	  macro_build ((char *) NULL, &icnt, &offset_expr,
 		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
 		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT_LO16, AT);
@@ -6408,7 +6537,8 @@ macro (ip)
 	    }
 	  macro_build (p, &icnt, &offset_expr,
 		       HAVE_32BIT_ADDRESSES ? "lw" : "ld",
-		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16, GP);
+		       "t,o(b)", AT, (int) BFD_RELOC_MIPS_GOT16,
+		       mips_gp_register);
 	  p += 4;
 	  macro_build (p, &icnt, (expressionS *) NULL, "nop", "");
 	  p += 4;
@@ -6448,14 +6578,14 @@ macro (ip)
 	     */
 	  if (breg == 0)
 	    {
-	      tempreg = GP;
+	      tempreg = mips_gp_register;
 	      used_at = 0;
 	    }
 	  else
 	    {
 	      macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 			   HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
-			   "d,v,t", AT, breg, GP);
+			   "d,v,t", AT, breg, mips_gp_register);
 	      tempreg = AT;
 	      used_at = 1;
 	    }
@@ -7225,7 +7363,7 @@ macro2 (ip)
       off = 3;
     ulwa:
       used_at = 1;
-      load_address (&icnt, AT, &offset_expr, HAVE_64BIT_ADDRESSES, &used_at);
+      load_address (&icnt, AT, &offset_expr, &used_at);
       if (breg != 0)
 	macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		     HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
@@ -7247,7 +7385,7 @@ macro2 (ip)
     case M_ULH_A:
     case M_ULHU_A:
       used_at = 1;
-      load_address (&icnt, AT, &offset_expr, HAVE_64BIT_ADDRESSES, &used_at);
+      load_address (&icnt, AT, &offset_expr, &used_at);
       if (breg != 0)
 	macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		     HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
@@ -7321,7 +7459,7 @@ macro2 (ip)
       off = 3;
     uswa:
       used_at = 1;
-      load_address (&icnt, AT, &offset_expr, HAVE_64BIT_ADDRESSES, &used_at);
+      load_address (&icnt, AT, &offset_expr, &used_at);
       if (breg != 0)
 	macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		     HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
@@ -7342,7 +7480,7 @@ macro2 (ip)
 
     case M_USH_A:
       used_at = 1;
-      load_address (&icnt, AT, &offset_expr, HAVE_64BIT_ADDRESSES, &used_at);
+      load_address (&icnt, AT, &offset_expr, &used_at);
       if (breg != 0)
 	macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 		     HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
@@ -10402,7 +10581,7 @@ md_pcrel_from (fixP)
 	return 1;
     }
 
-  /* return the address of the delay slot */
+  /* Return the address of the delay slot.  */
   return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address;
 }
 
@@ -11568,12 +11794,12 @@ s_cpload (ignore)
   /* In ELF, this symbol is implicitly an STT_OBJECT symbol.  */
   symbol_get_bfdsym (ex.X_add_symbol)->flags |= BSF_OBJECT;
 
-  macro_build_lui (NULL, &icnt, &ex, GP);
-  macro_build ((char *) NULL, &icnt, &ex, "addiu", "t,r,j", GP, GP,
-	       (int) BFD_RELOC_LO16);
+  macro_build_lui (NULL, &icnt, &ex, mips_gp_register);
+  macro_build ((char *) NULL, &icnt, &ex, "addiu", "t,r,j",
+	       mips_gp_register, mips_gp_register, (int) BFD_RELOC_LO16);
 
   macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "addu", "d,v,t",
-	       GP, GP, tc_get_register (0));
+	       mips_gp_register, mips_gp_register, tc_get_register (0));
 
   demand_empty_rest_of_line ();
 }
@@ -11700,7 +11932,7 @@ s_cprestore (ignore)
   int icnt = 0;
 
   /* If we are not generating SVR4 PIC code, or if this is NewABI code,
-   .cprestore is ignored.  */
+     .cprestore is ignored.  */
   if (mips_pic != SVR4_PIC || HAVE_NEWABI)
     {
       s_ignore (0);
@@ -11715,9 +11947,8 @@ s_cprestore (ignore)
   ex.X_op_symbol = NULL;
   ex.X_add_number = mips_cprestore_offset;
 
-  macro_build ((char *) NULL, &icnt, &ex,
-	       HAVE_32BIT_ADDRESSES ? "sw" : "sd",
-	       "t,o(b)", GP, (int) BFD_RELOC_LO16, SP);
+  macro_build ((char *) NULL, &icnt, &ex, HAVE_32BIT_ADDRESSES ? "sw" : "sd",
+	       "t,o(b)", mips_gp_register, (int) BFD_RELOC_LO16, SP);
 
   demand_empty_rest_of_line ();
 }
@@ -11815,7 +12046,7 @@ s_gpword (ignore)
 
   p = frag_more (4);
   md_number_to_chars (p, (valueT) 0, 4);
-  fix_new_exp (frag_now, p - frag_now->fr_literal, 4, &ex, 0,
+  fix_new_exp (frag_now, p - frag_now->fr_literal, 4, &ex, false,
 	       BFD_RELOC_GPREL32);
 
   demand_empty_rest_of_line ();
@@ -11843,7 +12074,7 @@ s_cpadd (ignore)
   reg = tc_get_register (0);
   macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
 	       HAVE_32BIT_ADDRESSES ? "addu" : "daddu",
-	       "d,v,t", reg, reg, GP);
+	       "d,v,t", reg, reg, mips_gp_register);
 
   demand_empty_rest_of_line ();
 }
@@ -12021,10 +12254,10 @@ nopic_need_relax (sym, before_relaxing)
       const char *symname;
       int change;
 
-      /* Find out whether this symbol can be referenced off the GP
+      /* Find out whether this symbol can be referenced off the $gp
 	 register.  It can be if it is smaller than the -G size or if
 	 it is in the .sdata or .sbss section.  Certain symbols can
-	 not be referenced off the GP, although it appears as though
+	 not be referenced off the $gp, although it appears as though
 	 they can.  */
       symname = S_GET_NAME (sym);
       if (symname != (const char *) NULL
@@ -12071,7 +12304,7 @@ nopic_need_relax (sym, before_relaxing)
       return change;
     }
   else
-    /* We are not optimizing for the GP register.  */
+    /* We are not optimizing for the $gp register.  */
     return 1;
 }
 
@@ -12914,7 +13155,7 @@ mips_elf_final_processing ()
   else if (file_mips_abi == N32_ABI)
     elf_elfheader (stdoutput)->e_flags |= EF_MIPS_ABI2;
 
-  /* Nothing to do for "64".  */
+  /* Nothing to do for N64_ABI.  */
 
   if (mips_32bitmode)
     elf_elfheader (stdoutput)->e_flags |= EF_MIPS_32BITMODE;



More information about the Binutils mailing list