aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-05-14 11:48:42 +0000
committerAlan Modra <amodra@gmail.com>2000-05-14 11:48:42 +0000
commit4132022df14e11a413f383a14042b49c663979ba (patch)
tree56cd3af0ba7d1c1658adc090dce69e8b0aa15f99
parente3a696124456c88ac2d10d7ae119b6375cf2a34f (diff)
downloadgdb-4132022df14e11a413f383a14042b49c663979ba.zip
gdb-4132022df14e11a413f383a14042b49c663979ba.tar.gz
gdb-4132022df14e11a413f383a14042b49c663979ba.tar.bz2
Kazu Hirata's output reloc for mov.
Don't rely on short being 16 bits.
-rw-r--r--gas/ChangeLog12
-rw-r--r--gas/config/tc-h8300.c32
2 files changed, 27 insertions, 17 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 65bbf5b..f12872d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index 736d6b9..2b63b00 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -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,