[PATCH] MIPS gas: Fix NewABI .cpsetup

Thiemo Seufer ica2_ts@csv.ica.uni-stuttgart.de
Sat May 11 02:11:00 GMT 2002


Hi All,

this patch fixes the handling for the NewABI .cpsetup pseudo op,
I got this wrong before, obviously nobody used the code in the
meanwhile. :-)

Can this go also in the branch?


Thiemo


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

	/gas/ChangeLog
	* config/tc_mips.c (s_cpsetup): Fix completely bogus code which had
	worked sometimes by accident. Fix copy&paste 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	Wed Apr 10 18:40:57 2002
+++ source/gas/config/tc-mips.c	Fri May 10 21:22:46 2002
@@ -11499,7 +11784,7 @@ s_cpsetup (ignore)
   int icnt = 0;
   char *sym;
 
-  /* If we are not generating SVR4 PIC code, .cpload is ignored.
+  /* If we are not generating SVR4 PIC code, .cpsetup is ignored.
      We also need NewABI support.  */
   if (mips_pic != SVR4_PIC || ! HAVE_NEWABI)
     {
@@ -11556,18 +11847,15 @@ s_cpsetup (ignore)
 
   macro_build ((char *) NULL, &icnt, &ex_sym, "lui", "t,u", mips_gp_register,
 	       (int) BFD_RELOC_GPREL16);
-  fix_new (frag_now, (char *) prev_insn_fixp - 4 - frag_now->fr_literal, 0,
-	   NULL, 0, 0, BFD_RELOC_MIPS_SUB);
-  fix_new (frag_now, (char *) prev_insn_fixp - 4 - frag_now->fr_literal, 0,
-	   NULL, 0, 0, BFD_RELOC_HI16_S);
+  fix_new (frag_now, prev_insn_where, 0, NULL, 0, 0, BFD_RELOC_MIPS_SUB);
+  fix_new (frag_now, prev_insn_where, 0, NULL, 0, 0, BFD_RELOC_HI16_S);
   macro_build ((char *) NULL, &icnt, &ex_sym, "addiu", "t,r,j",
 	       mips_gp_register, mips_gp_register, (int) BFD_RELOC_GPREL16);
-  fix_new (frag_now, (char *) prev_insn_fixp - 4 - frag_now->fr_literal, 0,
-	   NULL, 0, 0, BFD_RELOC_MIPS_SUB);
-  fix_new (frag_now, (char *) prev_insn_fixp - 4 - frag_now->fr_literal, 0,
-	   NULL, 0, 0, BFD_RELOC_LO16);
-  macro_build ((char *) NULL, &icnt, (expressionS *) NULL, "daddu",
-	       "d,v,t", mips_gp_register, mips_gp_register, reg1);
+  fix_new (frag_now, prev_insn_where, 0, NULL, 0, 0, BFD_RELOC_MIPS_SUB);
+  fix_new (frag_now, prev_insn_where, 0, NULL, 0, 0, BFD_RELOC_LO16);
+  macro_build ((char *) NULL, &icnt, (expressionS *) NULL,
+	       HAVE_64BIT_ADDRESSES ? "daddu" : "addu", "d,v,t",
+	       mips_gp_register, mips_gp_register, reg1);
 
   demand_empty_rest_of_line ();
 }



More information about the Binutils mailing list