Kazu Hirata's output reloc for mov.
authorAlan Modra <amodra@gmail.com>
Sun, 14 May 2000 11:48:42 +0000 (11:48 +0000)
committerAlan Modra <amodra@gmail.com>
Sun, 14 May 2000 11:48:42 +0000 (11:48 +0000)
Don't rely on short being 16 bits.

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

index 65bbf5bc73ce187a13e8994cfbbd2ddeb1c4fdd0..f12872d38d478c0955c7853dbf2cf09562497644 100644 (file)
@@ -1,3 +1,15 @@
+2000-05-14  Alan Modra  <alan@linuxcare.com.au>
+
+       * config/tc-h8300.c (do_a_fix_imm): Don't rely on `short' being 16
+       bits.  Instead explicitly mask and sign extend.  Do the 8 bit mask
+       and sign extend without an if statement.
+       (build_bytes): Likewise.
+
+2000-05-14  Kazu Hirata  <kazu@hxi.com>
+
+       * config/tc-h8300.c (do_a_fix_imm): Output a reloc for no
+       X_add_symbol L_32 case.
+
 2000-05-14  David O'Brien  <obrien@FreeBSD.org>
 
        * config/te-freebsd.h: New file.
index 736d6b91294ddc952de8d746886c808d024fc6de..2b63b00986d0335a20008b0cfd2199a1ec72e617 100644 (file)
@@ -1,5 +1,6 @@
 /* tc-h8300.c -- Assemble code for the Hitachi H8/300
-   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation.
+   Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 2000
+   Free Software Foundation.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -886,6 +887,11 @@ do_a_fix_imm (offset, operand, relaxmode)
          bytes[1] = operand->exp.X_add_number >> 16;
          bytes[2] = operand->exp.X_add_number >> 8;
          bytes[3] = operand->exp.X_add_number >> 0;
+         if (relaxmode != 0)
+           {
+             idx = (relaxmode == 2) ? R_MOV24B1 : R_MOVL1;
+             fix_new_exp (frag_now, offset, 4, &operand->exp, 0, idx);
+           }
          break;
        }
 
@@ -915,19 +921,15 @@ do_a_fix_imm (offset, operand, relaxmode)
            idx = R_MOV16B1;
          else
            idx = R_RELWORD;
-         operand->exp.X_add_number = (short)operand->exp.X_add_number;
+         operand->exp.X_add_number =
+           ((operand->exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000;
          break;
        case L_8:
          size = 1;
          where = 0;
          idx = R_RELBYTE;
-         /* This used to use a cast to char, but that fails if char is an
-            unsigned type.  We can't use `signed char', as that isn't valid
-            K&R C.  */
-         if (operand->exp.X_add_number & 0x80)
-           operand->exp.X_add_number |= ((offsetT) -1 << 8);
-         else
-           operand->exp.X_add_number &= 0xff;
+         operand->exp.X_add_number =
+           ((operand->exp.X_add_number & 0xff) ^ 0x80) - 0x80;
        }
 
       fix_new_exp (frag_now,
@@ -1114,13 +1116,8 @@ build_bytes (this_try, operand)
            }
 
          operand[i].exp.X_add_number -= 1;
-         /* This used to use a cast to char, but that fails if char is an
-            unsigned type.  We can't use `signed char', as that isn't valid
-            K&R C.  */
-         if (operand[i].exp.X_add_number & 0x80)
-           operand[i].exp.X_add_number |= ((offsetT) -1 << 8);
-         else
-           operand[i].exp.X_add_number &= 0xff;
+         operand[i].exp.X_add_number =
+           ((operand[i].exp.X_add_number & 0xff) ^ 0x80) - 0x80;
 
          fix_new_exp (frag_now,
                       output - frag_now->fr_literal + where,
@@ -1151,7 +1148,8 @@ build_bytes (this_try, operand)
                       (unsigned long) operand->exp.X_add_number);
            }
          if (!Hmode)
-           operand[i].exp.X_add_number = (short) operand[i].exp.X_add_number;
+           operand[i].exp.X_add_number = 
+             ((operand[i].exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000;
          fix_new_exp (frag_now,
                       output - frag_now->fr_literal,
                       4,