This is the mail archive of the binutils@sourceware.org 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 "Remove o(b) MIPS macros and use A(b) instead" breaks compressed linux build


Manuel Lauss <manuel.lauss@gmail.com> writes:
> your patch "Remove o(b) MIPS macros and use A(b) instead" makes gas choke
> on the following code in linux/arch/mips/boot/compressed/head.S:
>
> arch/mips/boot/compressed/head.S: Assembler messages:
> arch/mips/boot/compressed/head.S:35: Error: Illegal operands `la $4,(.heap)'
> arch/mips/boot/compressed/head.S:36: Error: Illegal operands `la
> $29,(.stack+8192)'

Gah, sorry for the breakage.  Here's what I committed.

FWIW, this is temporary: the later patches in the series handle
parsing in a different way.

Thanks,
Richard


gas/
	* config/tc-mips.c (mips_ip): Unconditionally parse an expression
	for 'A' and assume that the constant has been elided if the result
	is an O_register.

gas/testsuite/
	* gas/mips/la.s, gas/mips/la.d, gas/mips/la-svr4pic.d,
	gas/mips/la-xgot.d: Add tests for bracketed addresses.

Index: gas/config/tc-mips.c
===================================================================
--- gas/config/tc-mips.c	2013-07-08 09:34:28.173920535 +0100
+++ gas/config/tc-mips.c	2013-07-08 09:35:58.038714420 +0100
@@ -12702,17 +12702,17 @@ mips_ip (char *str, struct mips_cl_insn
 	      continue;
 
 	    case 'A':
-	      /* If we expect a base register, check whether there is only
-		 a single bracketed expression left.  If so, it must be the
-		 base register and the constant must be zero.  */
-	      if (args[1] == '(' && *s == '(' && strchr (s + 1, '(') == 0)
+	      my_getSmallExpression (&offset_expr, offset_reloc, s);
+	      if (offset_expr.X_op == O_register)
 		{
+		  /* Assume that the offset has been elided and that what
+		     we saw was a base register.  The match will fail later
+		     if that assumption turns out to be wrong.  */
 		  offset_expr.X_op = O_constant;
 		  offset_expr.X_add_number = 0;
 		}
 	      else
 		{
-		  my_getSmallExpression (&offset_expr, offset_reloc, s);
 		  normalize_address_expr (&offset_expr);
 		  s = expr_end;
 		}
Index: gas/testsuite/gas/mips/la.s
===================================================================
--- gas/testsuite/gas/mips/la.s	2013-07-08 09:34:28.173920535 +0100
+++ gas/testsuite/gas/mips/la.s	2013-07-08 09:34:48.470100058 +0100
@@ -106,6 +106,11 @@ data_label:
 	la	$4,small_external_common+0x1a5a5($5)
 	la	$4,big_local_common+0x1a5a5($5)
 	la	$4,small_local_common+0x1a5a5($5)
+	la	$4,($5)
+	la	$4,(0x123456)
+	la	$4,(0x123456)($5)
+	la	$4,(big_external_data_label)
+	la	$4,(big_external_data_label)($5)
 
 # Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
 	.space  8
Index: gas/testsuite/gas/mips/la.d
===================================================================
--- gas/testsuite/gas/mips/la.d	2013-07-08 09:34:28.173920535 +0100
+++ gas/testsuite/gas/mips/la.d	2013-07-08 09:34:48.470100058 +0100
@@ -378,4 +378,19 @@ Disassembly of section .text:
 [0-9a-f]+ <[^>]*> addiu	a0,a0,[-0-9]+
 [ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	.sbss.*
 [0-9a-f]+ <[^>]*> addu	a0,a0,a1
+[0-9a-f]+ <[^>]*> addiu	a0,a1,0
+[0-9a-f]+ <[^>]*> lui	a0,0x12
+[0-9a-f]+ <[^>]*> ori	a0,a0,0x3456
+[0-9a-f]+ <[^>]*> lui	a0,0x12
+[0-9a-f]+ <[^>]*> ori	a0,a0,0x3456
+[0-9a-f]+ <[^>]*> addu	a0,a0,a1
+[0-9a-f]+ <[^>]*> lui	a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	a0,a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	a0,0x0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addiu	a0,a0,0
+[ 	]*[0-9a-f]+: [A-Z0-9_]*LO[A-Z0-9_]*	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	a0,a0,a1
 	...
Index: gas/testsuite/gas/mips/la-svr4pic.d
===================================================================
--- gas/testsuite/gas/mips/la-svr4pic.d	2013-07-08 09:34:28.173920535 +0100
+++ gas/testsuite/gas/mips/la-svr4pic.d	2013-07-08 09:34:48.469100049 +0100
@@ -453,4 +453,16 @@ Disassembly of section .text:
 [ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
 [0-9a-f]+ <[^>]*> addu	a0,a0,at
 [0-9a-f]+ <[^>]*> addu	a0,a0,a1
+[0-9a-f]+ <[^>]*> addiu	a0,a1,0
+[0-9a-f]+ <[^>]*> lui	a0,0x12
+[0-9a-f]+ <[^>]*> ori	a0,a0,0x3456
+[0-9a-f]+ <[^>]*> lui	a0,0x12
+[0-9a-f]+ <[^>]*> ori	a0,a0,0x3456
+[0-9a-f]+ <[^>]*> addu	a0,a0,a1
+[0-9a-f]+ <[^>]*> lw	a0,0\(gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> lw	a0,0\(gp\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	a0,a0,a1
 	...
Index: gas/testsuite/gas/mips/la-xgot.d
===================================================================
--- gas/testsuite/gas/mips/la-xgot.d	2013-07-08 09:34:28.173920535 +0100
+++ gas/testsuite/gas/mips/la-xgot.d	2013-07-08 09:34:48.469100049 +0100
@@ -597,4 +597,22 @@ Disassembly of section .text:
 [ 	]*[0-9a-f]+: R_MIPS_LO16	.bss
 [0-9a-f]+ <[^>]*> addu	a0,a0,at
 [0-9a-f]+ <[^>]*> addu	a0,a0,a1
+[0-9a-f]+ <[^>]*> addiu	a0,a1,0
+[0-9a-f]+ <[^>]*> lui	a0,0x12
+[0-9a-f]+ <[^>]*> ori	a0,a0,0x3456
+[0-9a-f]+ <[^>]*> lui	a0,0x12
+[0-9a-f]+ <[^>]*> ori	a0,a0,0x3456
+[0-9a-f]+ <[^>]*> addu	a0,a0,a1
+[0-9a-f]+ <[^>]*> lui	a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	a0,a0,gp
+[0-9a-f]+ <[^>]*> lw	a0,0\(a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> lui	a0,0x0
+[ 	]*[0-9a-f]+: R_MIPS_GOT_HI16	big_external_data_label
+[0-9a-f]+ <[^>]*> addu	a0,a0,gp
+[0-9a-f]+ <[^>]*> lw	a0,0\(a0\)
+[ 	]*[0-9a-f]+: R_MIPS_GOT_LO16	big_external_data_label
+[0-9a-f]+ <[^>]*> nop
+[0-9a-f]+ <[^>]*> addu	a0,a0,a1
 	...


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