gas/tc-mips.c patch (absolute expressions)

Aldy Hernandez aldyh@redhat.com
Tue Jun 27 16:49:00 GMT 2000


Hello everyone.

The following code does not assemble on the mips port of gas:

	L1:
		lui $2, %hi(ABC)
		addiu $2, $2, %lo(ABC)
		addiu $31, $31, (L1 - . - 4)
				^^^^^^^^^^^^
This is the error:

	a.s: Assembler messages:
	a.s:4: Error: absolute expression required `addiu'

The patch below fixes the problem.

Richard Henderson has approved the patch.  I will be applying it
shortly (where "shortly" = "however long it takes to get my cvs
account set up").

Cheerios.
Aldy

2000-06-27  Aldy Hernandez  <aldyh@redhat.com>

	* config/tc-mips.c (mips_ip): handle "(foo-.-4)" type of
	expressions.  Ignore the problem when handling 16 bit signed
	immediates, because the assembler will take care of the relocation
	later.

Index: config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.18
diff -u -p -r1.18 tc-mips.c
--- tc-mips.c	2000/06/16 19:11:27	1.18
+++ tc-mips.c	2000/06/27 23:43:45
@@ -7746,10 +7746,8 @@ mips_ip (str, ip)
 		      if (insn + 1 < &mips_opcodes[NUMOPCODES] &&
 			  !strcmp (insn->name, insn[1].name))
 			break;
-		      if (imm_expr.X_op != O_constant
-			  && imm_expr.X_op != O_big)
-			insn_error = _("absolute expression required");
-		      else
+		      if (imm_expr.X_op == O_constant
+			  || imm_expr.X_op == O_big)
 			as_bad (_("16 bit expression not in range 0..65535"));
 		    }
 		}
@@ -7785,10 +7783,8 @@ mips_ip (str, ip)
 		    {
 		      if (more)
 			break;
-		      if (imm_expr.X_op != O_constant
-			  && imm_expr.X_op != O_big)
-			insn_error = _("absolute expression required");
-		      else
+		      if (imm_expr.X_op == O_constant
+			  || imm_expr.X_op == O_big)
 			as_bad (_("16 bit expression not in range -32768..32767"));
 		    }
 		}


More information about the Binutils mailing list