* config/tc-850.c (md_assemble): Handle hi() correctly. Handle
authorJeff Law <law@redhat.com>
Fri, 30 Aug 1996 06:44:44 +0000 (06:44 +0000)
committerJeff Law <law@redhat.com>
Fri, 30 Aug 1996 06:44:44 +0000 (06:44 +0000)
        hi0() too.
Bugfix.

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

index 4f636b72935837847977cbbb0f67e2d9715e922d..db3dd1d866c0fb4574a4bd151f81bb72f796d339 100644 (file)
@@ -1,3 +1,15 @@
+start-sanitize-v850
+Fri Aug 30 00:44:13 1996  Jeffrey A Law  (law@cygnus.com)
+
+       * config/tc-850.c (md_assemble): Handle hi() correctly.  Handle
+       hi0() too.
+
+Wed Aug 28 23:11:08 1996  Jeffrey A Law  (law@cygnus.com)
+
+       * config/tc-v850.c (md_begin): Deal with end of opcode
+       table marker.
+
+end-sanitize-v850
 start-sanitize-d10v
 Wed Aug 28 19:20:04 1996  Martin M. Hunt  <hunt@pizza.cygnus.com>
 
index f738a113bdf23eb8257aca09e49859848da8671c..007385d80d5ae5c8e7b8d551e65458783bd33edd 100644 (file)
@@ -448,15 +448,14 @@ md_begin ()
      the first opcode with a particular name in the opcode table.  */
 
   op     = v850_opcodes;
-  op_end = v850_opcodes + v850_num_opcodes;
-
-  for (; op < op_end; op++)
+  while (op->name)
     {
       if (strcmp (prev_name, op->name)) 
        {
          prev_name = (char *) op->name;
          hash_insert (v850_hash, op->name, (char *) op);
        }
+      op++;
     }
 }
 
@@ -598,7 +597,7 @@ md_assemble (str)
                }
              
              if (ex.X_op == O_constant) 
-               ex.X_add_number &= 0xffff;
+               ex.X_add_number = (signed)((ex.X_add_number & 0xffff) << 16) >> 16;
              else
                {
                  if (fc > MAX_INSN_FIXUPS)
@@ -622,7 +621,39 @@ md_assemble (str)
                }
              
              if (ex.X_op == O_constant)
-               ex.X_add_number = (ex.X_add_number >> 16) & 0xffff;
+               {
+                 unsigned long temp = ex.X_add_number;
+                 ex.X_add_number = (signed)(temp & 0xffff0000) >> 16;
+
+                 /* If the would be on for the low part, then we have
+                    to add it into the high part.  */
+                 if (temp & 0x8000)
+                   ex.X_add_number += 1;
+               }
+             else 
+               {
+                 if (fc > MAX_INSN_FIXUPS)
+                   as_fatal ("too many fixups");
+                 
+                 fixups[fc].exp = ex;
+                 fixups[fc].opindex = *opindex_ptr;
+                 fixups[fc].reloc = BFD_RELOC_HI16_S;
+                 fc++;
+               }
+           }
+         else if (strncmp(input_line_pointer, "hi0(", 4) == 0) 
+           {
+             input_line_pointer += 4;
+             expression(&ex);
+
+             if (*input_line_pointer++ != ')')
+               {
+                 errmsg = "syntax error: expected `)'";
+                 goto error;
+               }
+             
+             if (ex.X_op == O_constant)
+               ex.X_add_number = (signed)(ex.X_add_number & 0xffff0000) >> 16;
              else 
                {
                  if (fc > MAX_INSN_FIXUPS)