gas/
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 8 Jul 2013 08:39:32 +0000 (08:39 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Mon, 8 Jul 2013 08:39:32 +0000 (08:39 +0000)
* 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.

gas/ChangeLog
gas/config/tc-mips.c
gas/testsuite/ChangeLog
gas/testsuite/gas/mips/la-svr4pic.d
gas/testsuite/gas/mips/la-xgot.d
gas/testsuite/gas/mips/la.d
gas/testsuite/gas/mips/la.s

index 48b382e47baeb1a8c01b1896684a7dbc116d3bd9..65f13cf8a5eecabc6d60c07ae70ea89db05ebeff 100644 (file)
@@ -1,3 +1,9 @@
+2013-07-08  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * 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.
+
 2013-07-07  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * config/tc-mips.c (gprel16_reloc_p): New function.
index 5c6424e9f110dcf48b2e6725979480bec7b04b01..22ba44adedd61625e8ff7d3203960cd33d993d9d 100644 (file)
@@ -12702,17 +12702,17 @@ mips_ip (char *str, struct mips_cl_insn *ip)
              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 196e23822b197da99d265c363271ac48bf5f7fdb..e1e968998f3f4d17743428507b9ed809a14769f9 100644 (file)
@@ -1,3 +1,8 @@
+2013-07-08  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * gas/mips/la.s, gas/mips/la.d, gas/mips/la-svr4pic.d,
+       gas/mips/la-xgot.d: Add tests for bracketed addresses.
+
 2013-07-07  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * gas/mips/ldstla-32.d: Avoid "lui at,0x0" sequences for
index d53580faeb1f5630ee35e25c5fc57d8b0012e1ad..686db0321c9003a02a3cf3d6f46f4a399e2de25e 100644 (file)
@@ -452,5 +452,17 @@ Disassembly of section .text:
 [0-9a-f]+ <[^>]*> addiu        at,at,-22131
 [      ]*[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 50cc37c835307674335f3e4977537a6c27957cf4..168a72d108623d614fc328c4e001bdd1547ae29b 100644 (file)
@@ -596,5 +596,23 @@ Disassembly of section .text:
 [0-9a-f]+ <[^>]*> addiu        at,at,-22131
 [      ]*[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 449c6a2715ab38e27a98ad37ea969a8179b281fc..7395014fdf36e04455a62899b5d6d2d93e292ae0 100644 (file)
@@ -377,5 +377,20 @@ Disassembly of section .text:
 [      ]*[0-9a-f]+: [A-Z0-9_]*HI[A-Z0-9_]*     .sbss.*
 [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 dd0bff6ae66c0fdee41545120ccbfb0b2c80050b..2a6f99c59b500e8d472f9a89b249357c30278f3b 100644 (file)
@@ -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