Second fix for microblaze gas port's ability to parse constants.
authorNick Clifton <nickc@redhat.com>
Thu, 2 Apr 2015 16:13:12 +0000 (17:13 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 2 Apr 2015 16:13:12 +0000 (17:13 +0100)
PR gas/18189
* config/tc-microblaze.c (parse_imm): Use offsetT as the type for
min and max parameters.  Sign extend values before testing.

gas/ChangeLog
gas/config/tc-microblaze.c

index e08b0f72cbf32d94933f7d89e33b92e4b0d0180c..a2383a91e3eabde30f7808e3c7e906aa0ba9401b 100644 (file)
@@ -2,7 +2,7 @@
 
        PR gas/18189
        * config/tc-microblaze.c (parse_imm): Use offsetT as the type for
-       min and max parameters.
+       min and max parameters.  Sign extend values before testing.
 
 2015-04-02  Renlin Li  <renlin.li@arm.com>
 
index 6f0e795781a075a2ef26a115fa36a55793e3c5b0..3309e59823d76402b6526a1ba407ff8c6694f6a3 100644 (file)
@@ -736,11 +736,17 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
     ; /* An error message has already been emitted.  */
   else if ((e->X_op != O_constant && e->X_op != O_symbol) )
     as_fatal (_("operand must be a constant or a label"));
-  else if ((e->X_op == O_constant) && (e->X_add_number < min
-                                      || e->X_add_number > max))
+  else if (e->X_op == O_constant)
     {
-      as_fatal (_("operand must be absolute in range %lx..%lx, not %lx"),
-                (long) min, (long) max, (long) e->X_add_number);
+      /* Special case: sign extend negative 32-bit values to 64-bits.  */
+      if ((e->X_add_number >> 31) == 1)
+       e->X_add_number |= (-1 << 31);
+
+      if (e->X_add_number < min || e->X_add_number > max)
+       {
+         as_fatal (_("operand must be absolute in range %lx..%lx, not %lx"),
+                   (long) min, (long) max, (long) e->X_add_number);
+       }
     }
 
   if (atp)
This page took 0.030224 seconds and 4 git commands to generate.