From: Alan Modra Date: Sun, 14 May 2000 11:48:42 +0000 (+0000) Subject: Kazu Hirata's output reloc for mov. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4132022df14e11a413f383a14042b49c663979ba;p=binutils-gdb.git Kazu Hirata's output reloc for mov. Don't rely on short being 16 bits. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 65bbf5bc73c..f12872d38d4 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,15 @@ +2000-05-14 Alan Modra + + * 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 + + * 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 * config/te-freebsd.h: New file. diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c index 736d6b91294..2b63b00986d 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,