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]

[patch] MIPS/gas: $at clobbered when noat is in effect


Hello,

 I've found a serious problem that makes it impossible to load a 64-bit
address (except from handcoding the operation explicitly) correctly in
non-PIC code with noat in effect.  The problem leads to $at being
clobbered e.g. in MIPS64/Linux TLB fault handlers, which in turn renders a
system unusable.  The reason is gas insists on dla optimization whenever
it wouldn't use $at for anything else itself. 

 Here is a fix.  I'd like to see it in the 2.13 branch as well. 

2002-07-26  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>

	* tc-mips.c (load_address): Don't clobber $at when loading a
	64-bit address in non-PIC code if noat is in effect.
	(macro): Likewise.

 OK to apply?

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

binutils-2.12.90-20020702-mips-noat.patch
diff -up --recursive --new-file binutils-2.12.90-20020702.macro/gas/config/tc-mips.c binutils-2.12.90-20020702/gas/config/tc-mips.c
--- binutils-2.12.90-20020702.macro/gas/config/tc-mips.c	2002-06-15 03:25:24.000000000 +0000
+++ binutils-2.12.90-20020702/gas/config/tc-mips.c	2002-07-26 05:57:51.000000000 +0000
@@ -3544,7 +3544,7 @@ load_address (counter, reg, ep, used_at)
 	  /* We don't do GP optimization for now because RELAX_ENCODE can't
 	     hold the data for such large chunks.  */
 
-	  if (*used_at == 0)
+	  if (*used_at == 0 && ! mips_opts.noat)
 	    {
 	      macro_build (p, counter, ep, "lui", "t,u",
 			   reg, (int) BFD_RELOC_MIPS_HIGHEST);
@@ -4559,7 +4559,7 @@ macro (ip)
 	      /* We don't do GP optimization for now because RELAX_ENCODE can't
 		 hold the data for such large chunks.  */
 
-	      if (used_at == 0)
+	      if (used_at == 0 && ! mips_opts.noat)
 		{
 		  macro_build (p, &icnt, &offset_expr, "lui", "t,u",
 			       tempreg, (int) BFD_RELOC_MIPS_HIGHEST);
@@ -5510,7 +5510,7 @@ macro (ip)
 	      /* We don't do GP optimization for now because RELAX_ENCODE can't
 		 hold the data for such large chunks.  */
 
-	      if (used_at == 0)
+	      if (used_at == 0 && ! mips_opts.noat)
 		{
 		  macro_build (p, &icnt, &offset_expr, "lui", "t,u",
 			       tempreg, (int) BFD_RELOC_MIPS_HIGHEST);


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